/** * Creates a new builder. * * @return New builder instance */ public static AuthenticationBuilder newInstance() { return new DefaultAuthenticationBuilder(); }
val builder = new DefaultAuthenticationBuilder(NullPrincipal.getInstance()); credentials.forEach(cred -> builder.addCredential(new BasicCredentialMetaData(cred)));
/** * 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) { val 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; }