@Override public String toString() { return "userName: " + getUsername(); } }
@Override public void validate(final IdentityContext context, final TOTPCredentials credentials, final CredentialStore<?> store) { super.validate(context, credentials, store); if (Status.VALID.equals(credentials.getStatus()) || Status.EXPIRED.equals(credentials.getStatus())) { if (!isValid(context, credentials, store)) { credentials.setStatus(Status.INVALID); credentials.setValidatedAccount(null); } } }
/** * Validate if the credential provided matches * * @param user * @param password * @return builder implementation */ public void validate(Agent user, String password) { Credentials credential = new UsernamePasswordCredentials(user.getLoginName(), new Password(password)); identityManager.validateCredentials(credential); this.credential = credential; } }
@Override protected Account getAccount(final IdentityContext context, final DigestCredentials credentials) { return getAccount(context, credentials.getDigest().getUsername()); }
public String getPassword() { if (credential != null && credential instanceof Password) { Password ptp = (Password) credential; return new String(ptp.getValue()); } return null; }
@Override public <I extends IdentityType> I extractIdentity(T token, Class<I> identityType, StereotypeProperty.Property stereotypeProperty, Object identifier) { if (token == null || token.getToken() == null) { throw MESSAGES.nullArgument("Token"); } if (identityType == null) { throw MESSAGES.nullArgument("IdentityType"); } if (stereotypeProperty == null) { throw MESSAGES.nullArgument("Identifier value"); } if (identifier == null) { throw MESSAGES.nullArgument("Identifier value"); } return extractIdentityTypeFromToken(token, identityType, stereotypeProperty, identifier); }
/** * Match the Client Response value with a generated digest based on the password * * @param digest * @param password * @return * @throws FormatException */ public static boolean matchCredential(Digest digest, char[] password) { return clientResponseValue(digest, password).equalsIgnoreCase(digest.getClientResponse()); }
/** * @param token * @return */ public static String userName(String token) { if (token.startsWith("Digest")) { token = token.substring(7).trim(); } return extract(token, "username="); }
@Override public void validate(final IdentityContext context, final TOTPCredentials credentials, final CredentialStore<?> store) { super.validate(context, credentials, store); if (Status.VALID.equals(credentials.getStatus()) || Status.EXPIRED.equals(credentials.getStatus())) { if (!isValid(context, credentials, store)) { credentials.setStatus(Status.INVALID); credentials.setValidatedAccount(null); } } }
@Override protected Account getAccount(final IdentityContext context, final DigestCredentials credentials) { return getAccount(context, credentials.getDigest().getUsername()); }
public String getPassword() { if (credential != null && credential instanceof Password) { Password ptp = (Password) credential; return new String(ptp.getValue()); } return null; }
@Override public <I extends IdentityType> I extractIdentity(T token, Class<I> identityType, StereotypeProperty.Property stereotypeProperty, Object identifier) { if (token == null || token.getToken() == null) { throw MESSAGES.nullArgument("Token"); } if (identityType == null) { throw MESSAGES.nullArgument("IdentityType"); } if (stereotypeProperty == null) { throw MESSAGES.nullArgument("Identifier value"); } if (identifier == null) { throw MESSAGES.nullArgument("Identifier value"); } return extractIdentityTypeFromToken(token, identityType, stereotypeProperty, identifier); }
@Override public String toString() { return "userName: " + getUsername(); } }
public String getPassword() { if (credential != null && credential instanceof Password) { Password ptp = (Password) credential; return new String(ptp.getValue()); } return null; }