@Override public UUFUser authenticate(String username, char[] password, String domain) throws UserPortalUIException { try { //TODO if different claim is used, need identify that claim. Claim usernameClaim = new Claim(IdentityMgtConstants.CLAIM_ROOT_DIALECT, IdentityMgtConstants.USERNAME_CLAIM, username); PasswordCallback passwordCallback = new PasswordCallback("password", false); passwordCallback.setPassword(password); AuthenticationContext authenticationContext = getRealmService().getIdentityStore() .authenticate(usernameClaim, new Callback[]{passwordCallback}, domain); User identityUser = authenticationContext.getUser(); //TODO if another claim used, need to load username claim return new UUFUser(username, identityUser.getUniqueUserId(), identityUser.getDomainName()); } catch (AuthenticationFailure e) { String error = "Invalid credentials."; if (LOGGER.isDebugEnabled()) { LOGGER.debug(error, e); } throw new UserPortalUIException("Invalid credentials."); } catch (IdentityStoreException e) { String error = "Failed to authenticate user."; LOGGER.error(error, e); throw new UserPortalUIException(error); } }
throws IdentityStoreException { String domainUserId = (String) authenticationContext.getParameter(IdentityMgtConstants.DOMAIN_USER_ID); String state = (String) authenticationContext.getParameter(IdentityMgtConstants.STATE); if (authenticationContext.isAuthenticated()) { authenticationContext.setUser(new User.UserBuilder() .setUserId(getEncodedUniqueEntityId(domain.getId(), domainUserId)) .setIdentityStore(this)
try { AuthenticationContext authenticationContext = domain.authenticate(claim, credentials); if (authenticationContext.isAuthenticated()) { return getAuthenticationContext(authenticationContext, domain); } else { String domainUserId = (String) authenticationContext.getParameter( IdentityMgtConstants.DOMAIN_USER_ID); String state = (String) authenticationContext.getParameter( IdentityMgtConstants.STATE); failedAuthenticationContext.addFailedUserToList(new User.UserBuilder()
try { connector.authenticate(userPartition.getConnectorUserId(), credentials); AuthenticationContext successContext = new AuthenticationContext(); successContext.addParameter(IdentityMgtConstants.DOMAIN_USER_ID, domainUser.getDomainUserId()); successContext.addParameter(IdentityMgtConstants.STATE, domainUser.getState()); return successContext; } catch (CredentialStoreConnectorException | AuthenticationFailure e) {