use of org.apache.jackrabbit.oak.spi.security.authentication.callback.PrincipalProviderCallback in project jackrabbit-oak by apache.
the class AbstractLoginModule method getPrincipalProvider.
/**
* Retrieves the {@link PrincipalProvider} that should be used to handle
* this authentication. If no principal provider has been configure this
* method returns {@code null}.
*
* @return A instance of {@code PrincipalProvider} or {@code null}.
*/
@CheckForNull
protected PrincipalProvider getPrincipalProvider() {
PrincipalProvider principalProvider = null;
SecurityProvider sp = getSecurityProvider();
Root r = getRoot();
if (r != null && sp != null) {
PrincipalConfiguration pc = sp.getConfiguration(PrincipalConfiguration.class);
principalProvider = pc.getPrincipalProvider(r, NamePathMapper.DEFAULT);
}
if (principalProvider == null && callbackHandler != null) {
try {
PrincipalProviderCallback principalCallBack = new PrincipalProviderCallback();
callbackHandler.handle(new Callback[] { principalCallBack });
principalProvider = principalCallBack.getPrincipalProvider();
} catch (IOException | UnsupportedCallbackException e) {
log.debug(e.getMessage());
}
}
return principalProvider;
}
Aggregations