Search in sources :

Example 1 with BuiltinAuthenticationProviderFactory

use of edu.harvard.iq.dataverse.authorization.providers.builtin.BuiltinAuthenticationProviderFactory in project dataverse by IQSS.

the class AuthenticationServiceBean method startup.

@PostConstruct
public void startup() {
    // First, set up the factories
    try {
        registerProviderFactory(new BuiltinAuthenticationProviderFactory(builtinUserServiceBean, passwordValidatorService));
        registerProviderFactory(new ShibAuthenticationProviderFactory());
        registerProviderFactory(new OAuth2AuthenticationProviderFactory());
    } catch (AuthorizationSetupException ex) {
        logger.log(Level.SEVERE, "Exception setting up the authentication provider factories: " + ex.getMessage(), ex);
    }
    // Now, load the providers.
    em.createNamedQuery("AuthenticationProviderRow.findAllEnabled", AuthenticationProviderRow.class).getResultList().forEach((row) -> {
        try {
            registerProvider(loadProvider(row));
        } catch (AuthenticationProviderFactoryNotFoundException e) {
            logger.log(Level.SEVERE, "Cannot find authentication provider factory with alias '" + e.getFactoryAlias() + "'", e);
        } catch (AuthorizationSetupException ex) {
            logger.log(Level.SEVERE, "Exception setting up the authentication provider '" + row.getId() + "': " + ex.getMessage(), ex);
        }
    });
}
Also used : AuthenticationProviderFactoryNotFoundException(edu.harvard.iq.dataverse.authorization.exceptions.AuthenticationProviderFactoryNotFoundException) BuiltinAuthenticationProviderFactory(edu.harvard.iq.dataverse.authorization.providers.builtin.BuiltinAuthenticationProviderFactory) OAuth2AuthenticationProviderFactory(edu.harvard.iq.dataverse.authorization.providers.oauth2.OAuth2AuthenticationProviderFactory) ShibAuthenticationProviderFactory(edu.harvard.iq.dataverse.authorization.providers.shib.ShibAuthenticationProviderFactory) AuthorizationSetupException(edu.harvard.iq.dataverse.authorization.exceptions.AuthorizationSetupException) PostConstruct(javax.annotation.PostConstruct)

Aggregations

AuthenticationProviderFactoryNotFoundException (edu.harvard.iq.dataverse.authorization.exceptions.AuthenticationProviderFactoryNotFoundException)1 AuthorizationSetupException (edu.harvard.iq.dataverse.authorization.exceptions.AuthorizationSetupException)1 BuiltinAuthenticationProviderFactory (edu.harvard.iq.dataverse.authorization.providers.builtin.BuiltinAuthenticationProviderFactory)1 OAuth2AuthenticationProviderFactory (edu.harvard.iq.dataverse.authorization.providers.oauth2.OAuth2AuthenticationProviderFactory)1 ShibAuthenticationProviderFactory (edu.harvard.iq.dataverse.authorization.providers.shib.ShibAuthenticationProviderFactory)1 PostConstruct (javax.annotation.PostConstruct)1