@Override
    @CanIgnoreReturnValue
    public AuthenticationBuilder setWarnings(final List<MessageDescriptor> warning) {
        this.warnings.clear();
        this.warnings.addAll(warning);
        return this;
    }
Factory method.

@param applicationContext  the application context
@param principal           principal.
@param principalFactory    principalFactory.
@param principalAttributes principalAttributes.
@param service             service.
@param registeredService   registeredService.
@param authentication      authentication.
@return AuthenticationBuilder new AuthenticationBuilder instance.
@throws Throwable the throwable
core/cas-server-core-authentication-api/src/main/java/org/apereo/cas/authentication/DefaultAuthenticationBuilder.java