@@ -0,0 +1,2826 @@
+/*%0A * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.%0A *%0A * WSO2 Inc. licenses this file to you under the Apache License,%0A * Version 2.0 (the %22License%22); you may not use this file except%0A * in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A * http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing,%0A * software distributed under the License is distributed on an%0A * %22AS IS%22 BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY%0A * KIND, either express or implied. See the License for the%0A * specific language governing permissions and limitations%0A * under the License.%0A */%0Apackage org.wso2.carbon.identity.application.authenticator.fido.util;%0A%0Aimport org.apache.commons.logging.Log;%0Aimport org.wso2.carbon.CarbonConstants;%0Aimport org.wso2.carbon.identity.application.authenticator.fido.internal.FIDOAuthenticatorServiceComponent;%0Aimport org.wso2.carbon.user.api.UserStoreException;%0Aimport org.wso2.carbon.user.core.service.RealmService;%0Aimport org.wso2.carbon.utils.multitenancy.MultitenantUtils;%0A%0Aimport javax.servlet.http.HttpServletRequest;%0A%0A/**%0A * FIDOUtil class for FIDO authentication component.%0A */%0Apublic class FIDOUtil %7B%0A%09public static void logTrace(String msg, Log log) %7B%0A%09%09if (log.isTraceEnabled()) %7B%0A%09%09%09log.trace(msg);%0A%09%09%7D%0A%09%7D%0A%0A%09public static String getOrigin(HttpServletRequest request) %7B%0A%0A%09%09return request.getScheme() + %22://%22 + request.getServerName() + %22:%22 +%0A%09%09       request.getServerPort();%0A%09%7D%0A%0A    public static int getTenantID(String tenantDomain) throws UserStoreException %7B%0A%0A        RealmService realmService = null;%0A        int tenantId;%0A        realmService = FIDOAuthenticatorServiceComponent.getRealmService();%0A            tenantId = realmService.getTenantManager().getTenantId(tenantDomain);%0A        return tenantId;%0A    %7D%0A%0A%09public static String getSafeText(String text) %7B%0A%09%09if (text == null) %7B%0A%09%09%09return text;%0A%09%09%7D%0A%09%09text = text.trim();%0A%09%09if (text.indexOf('%3C') %3E -1) %7B%0A%09%09%09text = text.replace(%22%3C%22, %22&lt;%22);%0A%09%09%7D%0A%09%09if (text.indexOf('%3E') %3E -1) %7B%0A%09%09%09text = text.replace(%22%3E%22, %22&gt;%22);%0A%09%09%7D%0A%09%09return text;%0A%09%7D%0A%09public static String getUniqueUsername(HttpServletRequest request, String username)%7B%0A%09%09return request.getServerName() + %22/%22 + username;%0A%09%7D%0A%0A    public static String getDomainName(String username) %7B%0A        int index = username.indexOf(CarbonConstants.DOMAIN_SEPARATOR);%0A        if (index %3C 0) %7B%0A            return FIDOAuthenticatorConstants.PRIMARY_USER_DOMAIN;%0A        %7D%0A        return username.substring(0, index);%0A    %7D%0A%0A    public static String getUsernameWithoutDomain(String username) %7B%0A        int index = username.indexOf(CarbonConstants.DOMAIN_SEPARATOR);%0A        if (index %3C 0) %7B%0A            return username;%0A        %7D%0A        return username.substring(index + 1, username.length());%0A    %7D%0A%7D%0A

Add util file