@Override public Association load(String handle) { if(IdentityUtil.isBlank(handle)){ throw new IllegalArgumentException("Handle is empty"); } if(log.isDebugEnabled()){ log.debug("Inside load(); handle : " + handle); } String timeStamp = handle.substring((Integer.toString(storeId)).length(), handle.indexOf("-")); Date expireDate = new Date(Long.parseLong(timeStamp)+ this.expireIn); if(log.isDebugEnabled()){ log.debug("Calculated Expiry Time : " + expireDate.getTime()); } // SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1"); // PBEKeySpec spec = new PBEKeySpec(serverKey.toCharArray(), handle.getBytes(), 1, 256); // SecretKey secretKey = factory.generateSecret(spec); return Association.createHmacSha256(handle, (serverKey + handle).getBytes(), expireDate); }
public static boolean isRedirectionUriValid(String redirectUri) { if (log.isDebugEnabled()) { log.debug("Validating uri: " + redirectUri); } if (IdentityUtil.isBlank(redirectUri)) { log.error("The redirection URI is either null or blank."); return false; } try { //Trying to parse the URI, just to verify the URI syntax is correct. new URI(redirectUri); } catch (URISyntaxException e) { if (log.isDebugEnabled()) { String errorMessage = "The redirection URI: " + redirectUri + ", is not a valid URI."; log.debug(errorMessage, e); } return false; } return true; }
@Override public Association load(String handle) { if(IdentityUtil.isBlank(handle)){ throw new IllegalArgumentException("Handle is empty"); } if(log.isDebugEnabled()){ log.debug("Inside load(); handle : " + handle); } String timeStamp = handle.substring((Integer.toString(storeId)).length(), handle.indexOf("-")); Date expireDate = new Date(Long.parseLong(timeStamp)+ this.expireIn); if(log.isDebugEnabled()){ log.debug("Calculated Expiry Time : " + expireDate.getTime()); } // SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1"); // PBEKeySpec spec = new PBEKeySpec(serverKey.toCharArray(), handle.getBytes(), 1, 256); // SecretKey secretKey = factory.generateSecret(spec); return Association.createHmacSha256(handle, (serverKey + handle).getBytes(), expireDate); }
public static boolean isValidFileName(String fileName) { String fileNameRegEx = ServerConfiguration.getInstance().getFirstProperty(IdentityCoreConstants.FILE_NAME_REGEX); if (isBlank(fileNameRegEx)) { fileNameRegEx = DEFAULT_FILE_NAME_REGEX; } Pattern pattern = Pattern.compile(fileNameRegEx, Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE | Pattern.COMMENTS); Matcher matcher = pattern.matcher(fileName); return matcher.matches(); }
public static boolean isValidFileName(String fileName){ String fileNameRegEx = ServerConfiguration.getInstance().getFirstProperty(IdentityCoreConstants.FILE_NAME_REGEX); if(isBlank(fileNameRegEx)){ fileNameRegEx = DEFAULT_FILE_NAME_REGEX; } Pattern pattern = Pattern.compile(fileNameRegEx, Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE | Pattern.COMMENTS); Matcher matcher = pattern.matcher(fileName); return matcher.matches(); }
public static boolean isValidFileName(String fileName) { String fileNameRegEx = ServerConfiguration.getInstance().getFirstProperty(IdentityCoreConstants.FILE_NAME_REGEX); if (isBlank(fileNameRegEx)) { fileNameRegEx = DEFAULT_FILE_NAME_REGEX; } Pattern pattern = Pattern.compile(fileNameRegEx, Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE | Pattern.COMMENTS); Matcher matcher = pattern.matcher(fileName); return matcher.matches(); }
protected String splitAppendedTenantDomain(String issuer) throws UserStoreException, IdentityException { if(IdentityUtil.isBlank(SAMLSSOUtil.getTenantDomainFromThreadLocal())) { if (issuer.contains("@")) { String tenantDomain = issuer.substring(issuer.lastIndexOf('@') + 1); issuer = issuer.substring(0, issuer.lastIndexOf('@')); if (StringUtils.isNotBlank(tenantDomain) && StringUtils.isNotBlank(issuer)) { SAMLSSOUtil.setTenantDomainInThreadLocal(tenantDomain); if (log.isDebugEnabled()) { log.debug("Tenant Domain: " + tenantDomain + " & Issuer name: " + issuer + "has been " + "split"); } } } } if(IdentityUtil.isBlank(SAMLSSOUtil.getTenantDomainFromThreadLocal())){ SAMLSSOUtil.setTenantDomainInThreadLocal(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME); } return issuer; }
protected String splitAppendedTenantDomain(String issuer) throws UserStoreException, IdentityException { if(IdentityUtil.isBlank(SAMLSSOUtil.getTenantDomainFromThreadLocal())) { if (issuer.contains("@")) { String tenantDomain = issuer.substring(issuer.lastIndexOf('@') + 1); issuer = issuer.substring(0, issuer.lastIndexOf('@')); if (StringUtils.isNotBlank(tenantDomain) && StringUtils.isNotBlank(issuer)) { SAMLSSOUtil.setTenantDomainInThreadLocal(tenantDomain); if (log.isDebugEnabled()) { log.debug("Tenant Domain: " + tenantDomain + " & Issuer name: " + issuer + "has been " + "split"); } } } } if(IdentityUtil.isBlank(SAMLSSOUtil.getTenantDomainFromThreadLocal())){ SAMLSSOUtil.setTenantDomainInThreadLocal(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME); } return issuer; } }
protected String splitAppendedTenantDomain(String issuer) throws UserStoreException, IdentityException { if(IdentityUtil.isBlank(SAMLSSOUtil.getTenantDomainFromThreadLocal())) { if (issuer.contains("@")) { String tenantDomain = issuer.substring(issuer.lastIndexOf('@') + 1); issuer = issuer.substring(0, issuer.lastIndexOf('@')); if (StringUtils.isNotBlank(tenantDomain) && StringUtils.isNotBlank(issuer)) { SAMLSSOUtil.setTenantDomainInThreadLocal(tenantDomain); messageContext.setTenantDomain(tenantDomain); if (log.isDebugEnabled()) { log.debug("Tenant Domain: " + tenantDomain + " & Issuer name: " + issuer + "has been " + "split"); } } } } if(IdentityUtil.isBlank(SAMLSSOUtil.getTenantDomainFromThreadLocal())){ SAMLSSOUtil.setTenantDomainInThreadLocal(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME); messageContext.setTenantDomain(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME); } return issuer; }
/** * Create a challenge question object from the registry resource * * @param resource * @return */ private ChallengeQuestion createChallengeQuestion(Resource resource) throws RegistryException { ChallengeQuestion challengeQuestion = null; byte[] resourceContent = (byte[]) resource.getContent(); String questionText = new String(resourceContent, Charset.forName("UTF-8")); String questionSetId = resource.getProperty(IdentityRecoveryConstants.Questions.CHALLENGE_QUESTION_SET_ID); String questionId = resource.getProperty(IdentityRecoveryConstants.Questions.CHALLENGE_QUESTION_ID); String questionLocale = resource.getProperty(IdentityRecoveryConstants.Questions.CHALLENGE_QUESTION_LOCALE); if (questionSetId != null) { if (IdentityUtil.isBlank(questionLocale)) { questionLocale = LOCALE_EN_US; } challengeQuestion = new ChallengeQuestion(questionSetId, questionId, questionText, questionLocale); } return challengeQuestion; }
if(IdentityUtil.isBlank(handle)){ throw new IllegalArgumentException("Handle is \'NULL\'");
if(IdentityUtil.isBlank(handle)){ throw new IllegalArgumentException("Handle is \'NULL\'");
if(IdentityUtil.isBlank(SAMLSSOUtil.getTenantDomainFromThreadLocal())) { if (issuer.contains("@")) { String tenantDomain = issuer.substring(issuer.lastIndexOf('@') + 1); if (IdentityUtil.isBlank(SAMLSSOUtil.getTenantDomainFromThreadLocal())) { SAMLSSOServiceProviderDO serviceProvider = sessionInfoData.getServiceProviderList().get(issuer); if (serviceProvider != null) {