Search in sources :

Example 1 with UserManagerCallback

use of org.apache.jackrabbit.oak.spi.security.authentication.callback.UserManagerCallback in project jackrabbit-oak by apache.

the class AbstractLoginModule method getUserManager.

/**
     * Retrieves the {@link UserManager} that should be used to handle
     * this authentication. If no user manager has been configure this
     * method returns {@code null}.
     *
     * @return A instance of {@code UserManager} or {@code null}.
     */
@CheckForNull
protected UserManager getUserManager() {
    UserManager userManager = null;
    SecurityProvider sp = getSecurityProvider();
    Root r = getRoot();
    if (r != null && sp != null) {
        UserConfiguration uc = securityProvider.getConfiguration(UserConfiguration.class);
        userManager = uc.getUserManager(r, NamePathMapper.DEFAULT);
    }
    if (userManager == null && callbackHandler != null) {
        try {
            UserManagerCallback userCallBack = new UserManagerCallback();
            callbackHandler.handle(new Callback[] { userCallBack });
            userManager = userCallBack.getUserManager();
        } catch (IOException | UnsupportedCallbackException e) {
            log.debug(e.getMessage());
        }
    }
    return userManager;
}
Also used : UserManagerCallback(org.apache.jackrabbit.oak.spi.security.authentication.callback.UserManagerCallback) Root(org.apache.jackrabbit.oak.api.Root) UserManager(org.apache.jackrabbit.api.security.user.UserManager) SecurityProvider(org.apache.jackrabbit.oak.spi.security.SecurityProvider) IOException(java.io.IOException) UnsupportedCallbackException(javax.security.auth.callback.UnsupportedCallbackException) UserConfiguration(org.apache.jackrabbit.oak.spi.security.user.UserConfiguration) CheckForNull(javax.annotation.CheckForNull)

Aggregations

IOException (java.io.IOException)1 CheckForNull (javax.annotation.CheckForNull)1 UnsupportedCallbackException (javax.security.auth.callback.UnsupportedCallbackException)1 UserManager (org.apache.jackrabbit.api.security.user.UserManager)1 Root (org.apache.jackrabbit.oak.api.Root)1 SecurityProvider (org.apache.jackrabbit.oak.spi.security.SecurityProvider)1 UserManagerCallback (org.apache.jackrabbit.oak.spi.security.authentication.callback.UserManagerCallback)1 UserConfiguration (org.apache.jackrabbit.oak.spi.security.user.UserConfiguration)1