/** * Constructor. * * @param callerName The caller name * @param password The password, as a String */ public UsernamePasswordCredential(String callerName, String password) { this.caller = callerName; this.password = new Password(password); }
/** * Determines the password. * @return The password, as a String. */ public String getPasswordAsString() { return String.valueOf(getPassword().getValue()); }
@Override public void clearCredential() { password.clear(); }
public CredentialValidationResult validate(UsernamePasswordCredential credential) { if (!(credential.getCaller().equals("test") && credential.getPassword().compareTo("pass"))) { return INVALID_RESULT; } return new CredentialValidationResult("test", new HashSet<>(asList("architect", "admin"))); }
public boolean compareTo(String callerName, String password) { return getCaller().equals(callerName) && getPassword().compareTo(password); }
/** * Constructor. * * @param callerName The caller name * @param password The password, as a String */ public UsernamePasswordCredential(String callerName, String password) { this.caller = callerName; this.password = new Password(password); }
public boolean compareTo(String callerName, String password) { return getCaller().equals(callerName) && getPassword().compareTo(password); }
/** * Determines the password. * @return The password, as a String. */ public String getPasswordAsString() { return String.valueOf(getPassword().getValue()); }
@Override public void clearCredential() { password.clear(); }
/** * Constructor. * * @param callerName The caller name * @param password The password, as a String */ public UsernamePasswordCredential(String callerName, String password) { this.caller = callerName; this.password = new Password(password); }
public boolean compareTo(String callerName, String password) { return getCaller().equals(callerName) && getPassword().compareTo(password); }
/** * Determines the password. * @return The password, as a String. */ public String getPasswordAsString() { return String.valueOf(getPassword().getValue()); }
@Override public void clearCredential() { password.clear(); }
/** * Constructor. * * @param callerName The caller name * @param password The password, as a String */ public UsernamePasswordCredential(String callerName, String password) { this.caller = callerName; this.password = new Password(password); }
public boolean compareTo(String callerName, String password) { return getCaller().equals(callerName) && getPassword().compareTo(password); }
/** * Determines the password. * @return The password, as a String. */ public String getPasswordAsString() { return String.valueOf(getPassword().getValue()); }
@Override public void clearCredential() { password.clear(); }
/** * Utility for parsing the HTTP Basic Authentication password. * * @param authorizationHeader The encoded header * @return The password */ private static Password parsePassword(String authorizationHeader) { String decodedAuthorizationHeader = decodeHeader(authorizationHeader); int delimiterIndex = decodedAuthorizationHeader.indexOf(':'); if (delimiterIndex > -1) { return new Password(decodedAuthorizationHeader.substring(delimiterIndex + 1)); } else { return new Password(""); } } }
public CredentialValidationResult validate(UsernamePasswordCredential usernamePasswordCredential) { Credentials credentials = callerToCredentials.get(usernamePasswordCredential.getCaller()); if (credentials != null && usernamePasswordCredential.getPassword().compareTo(credentials.password())) { return new CredentialValidationResult( new CallerPrincipal(credentials.callerName()), new HashSet<>(asList(credentials.groups())) ); } return INVALID_RESULT; }
private CredentialValidationResult validateCallerAndGetGroups(LdapContext searchContext, String callerDn, UsernamePasswordCredential usernamePasswordCredential) { if (callerDn == null) { return INVALID_RESULT; } LdapContext callerContext = createCallerLdapContext(callerDn, new String(usernamePasswordCredential.getPassword().getValue())); if (callerContext == null) { return INVALID_RESULT; // either bindDn or bindPassword was invalid } closeContext(callerContext); Set<String> groups = null; if (validationTypes().contains(ValidationType.PROVIDE_GROUPS)) { groups = retrieveGroupsForCallerDn(searchContext, callerDn); } return new CredentialValidationResult( null, // store id usernamePasswordCredential.getCaller(), callerDn, null, // caller unique id groups); }