@Override public boolean isSatisfiedBy(final Authentication authn) { return authn.getSuccesses().size() == authn.getCredentials().size(); } }
@Override public boolean isSatisfiedBy(final Authentication authn) { boolean credsOk = true; if (this.tryAll) { credsOk = authn.getCredentials().size() == authn.getSuccesses().size() + authn.getFailures().size(); } return credsOk && StringUtils.isNotBlank(this.requiredHandlerName) && authn.getSuccesses().containsKey(this.requiredHandlerName); } }
@Override public boolean isSatisfiedBy(final Authentication authn) { if (this.tryAll) { return authn.getCredentials().size() == authn.getSuccesses().size() + authn.getFailures().size(); } return !authn.getSuccesses().isEmpty(); } }
@Override public boolean equals(final Object obj) { if (!(obj instanceof Authentication)) { return false; } if (obj == this) { return true; } final Authentication other = (Authentication) obj; final EqualsBuilder builder = new EqualsBuilder(); builder.append(this.principal, other.getPrincipal()); builder.append(this.credentials, other.getCredentials()); builder.append(this.successes, other.getSuccesses()); builder.append(this.authenticationDate, other.getAuthenticationDate()); builder.append(wrap(this.attributes), other.getAttributes()); builder.append(wrap(this.failures), other.getFailures()); return builder.isEquals(); }
.addCredentials(authn.getCredentials());
principalAttributes.putAll(authenticatedPrincipal.getAttributes()); credentials.addAll(authn.getCredentials()); successes.putAll(authn.getSuccesses()); failures.putAll(authn.getFailures());
/** * Creates a new builder initialized with data from the given authentication source. * * @param source Authentication source. * * @return New builder instance initialized with all fields in the given authentication source. */ public static AuthenticationBuilder newInstance(final Authentication source) { final DefaultAuthenticationBuilder builder = new DefaultAuthenticationBuilder(source.getPrincipal()); builder.setAuthenticationDate(source.getAuthenticationDate()); builder.setCredentials(source.getCredentials()); builder.setSuccesses(source.getSuccesses()); builder.setFailures(source.getFailures()); builder.setAttributes(source.getAttributes()); return builder; }