Search in sources :

Example 1 with TokenProviderCallback

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

the class TokenLoginModule method getTokenProvider.

// ------------------------------------------------------------< private >---
/**
 * Retrieve the token provider
 * @return the token provider or {@code null}.
 */
@CheckForNull
private TokenProvider getTokenProvider() {
    TokenProvider provider = null;
    SecurityProvider securityProvider = getSecurityProvider();
    Root root = getRoot();
    if (root != null && securityProvider != null) {
        TokenConfiguration tokenConfig = securityProvider.getConfiguration(TokenConfiguration.class);
        provider = tokenConfig.getTokenProvider(root);
    }
    if (provider == null && callbackHandler != null) {
        try {
            TokenProviderCallback tcCallback = new TokenProviderCallback();
            callbackHandler.handle(new Callback[] { tcCallback });
            provider = tcCallback.getTokenProvider();
        } catch (IOException e) {
            log.warn(e.getMessage());
        } catch (UnsupportedCallbackException e) {
            log.warn(e.getMessage());
        }
    }
    return provider;
}
Also used : TokenConfiguration(org.apache.jackrabbit.oak.spi.security.authentication.token.TokenConfiguration) TokenProvider(org.apache.jackrabbit.oak.spi.security.authentication.token.TokenProvider) Root(org.apache.jackrabbit.oak.api.Root) SecurityProvider(org.apache.jackrabbit.oak.spi.security.SecurityProvider) TokenProviderCallback(org.apache.jackrabbit.oak.spi.security.authentication.callback.TokenProviderCallback) IOException(java.io.IOException) UnsupportedCallbackException(javax.security.auth.callback.UnsupportedCallbackException) CheckForNull(javax.annotation.CheckForNull)

Aggregations

IOException (java.io.IOException)1 CheckForNull (javax.annotation.CheckForNull)1 UnsupportedCallbackException (javax.security.auth.callback.UnsupportedCallbackException)1 Root (org.apache.jackrabbit.oak.api.Root)1 SecurityProvider (org.apache.jackrabbit.oak.spi.security.SecurityProvider)1 TokenProviderCallback (org.apache.jackrabbit.oak.spi.security.authentication.callback.TokenProviderCallback)1 TokenConfiguration (org.apache.jackrabbit.oak.spi.security.authentication.token.TokenConfiguration)1 TokenProvider (org.apache.jackrabbit.oak.spi.security.authentication.token.TokenProvider)1