Search in sources :

Example 1 with GPlazmaAuthenticationPlugin

use of org.dcache.gplazma.plugins.GPlazmaAuthenticationPlugin in project dcache by dCache.

the class DefaultAuthenticationStrategy method authenticate.

/**
 * Devegates execution of the {@link GPlazmaAuthenticationPlugin#authenticate(SessionID,
 * Set<Object>,Set<Object>, Set<Principal>) GPlazmaAuthenticationPlugin.authenticate} methods of
 * the plugins supplied by {@link GPlazmaStrategy#setPlugins(List< GPlazmaPluginService <T>>)
 * GPlazmaStrategy.setPlugins} to {@link  PAMStyleStrategy#callPlugins(PluginCaller<T>)
 * PAMStyleStrategy.callPlugins(PluginCaller<T>)} by providing anonymous implementation of the
 * {@link PluginCaller#call(GPlazmaPlugin) PluginCaller} interface.
 *
 * @see PAMStyleStrategy
 * @see PluginCaller
 */
@Override
public void authenticate(final LoginMonitor monitor, final Set<Object> publicCredential, final Set<Object> privateCredential, final Set<Principal> identifiedPrincipals, final Set<Restriction> restrictionStore) throws AuthenticationException {
    pamStyleAuthentiationStrategy.callPlugins(service -> {
        monitor.authPluginBegins(service.getName(), service.getControl(), publicCredential, privateCredential, identifiedPrincipals);
        GPlazmaAuthenticationPlugin plugin = service.getPlugin();
        Result result = Result.FAIL;
        String error = null;
        try {
            plugin.authenticate(publicCredential, privateCredential, identifiedPrincipals, restrictionStore);
            result = Result.SUCCESS;
        } catch (AuthenticationException e) {
            error = e.getMessage();
            throw e;
        } finally {
            monitor.authPluginEnds(service.getName(), service.getControl(), result, error, publicCredential, privateCredential, identifiedPrincipals);
        }
    });
}
Also used : GPlazmaAuthenticationPlugin(org.dcache.gplazma.plugins.GPlazmaAuthenticationPlugin) AuthenticationException(org.dcache.gplazma.AuthenticationException) Result(org.dcache.gplazma.monitor.LoginMonitor.Result)

Aggregations

AuthenticationException (org.dcache.gplazma.AuthenticationException)1 Result (org.dcache.gplazma.monitor.LoginMonitor.Result)1 GPlazmaAuthenticationPlugin (org.dcache.gplazma.plugins.GPlazmaAuthenticationPlugin)1