Search in sources :

Example 1 with GPlazmaSessionPlugin

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

the class DefaultSessionStrategy method session.

/**
 * Devegates execution of the {@link GPlazmaSessionPlugin#session(SessionID,
 * Set<Principal>,Set<Object>) GPlazmaSessionPlugin.session} 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.
 *
 * @param sessionID
 * @param authorizedPrincipals
 * @param attrib
 * @throws AuthenticationException
 * @see PAMStyleStrategy
 * @see PluginCaller
 */
@Override
public void session(final LoginMonitor monitor, final Set<Principal> authorizedPrincipals, final Set<Object> attrib) throws AuthenticationException {
    pamStyleSessionStrategy.callPlugins(service -> {
        monitor.sessionPluginBegins(service.getName(), service.getControl(), authorizedPrincipals, attrib);
        GPlazmaSessionPlugin plugin = service.getPlugin();
        String error = null;
        Result result = Result.FAIL;
        try {
            plugin.session(authorizedPrincipals, attrib);
            result = Result.SUCCESS;
        } catch (AuthenticationException e) {
            error = e.getMessage();
            throw e;
        } finally {
            monitor.sessionPluginEnds(service.getName(), service.getControl(), result, error, authorizedPrincipals, attrib);
        }
    });
}
Also used : GPlazmaSessionPlugin(org.dcache.gplazma.plugins.GPlazmaSessionPlugin) 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 GPlazmaSessionPlugin (org.dcache.gplazma.plugins.GPlazmaSessionPlugin)1