use of org.dcache.gplazma.monitor.LoginMonitor.Result in project dcache by dCache.
the class LoginResultPrinter method printPluginHeader.
private void printPluginHeader(PAMPluginResult plugin) {
ConfigurationItemControl control = plugin.getControl();
Result result = plugin.getResult();
String resultLabel = stringFor(result);
String name = plugin.getName();
String error;
if (result == SUCCESS) {
error = "";
} else {
error = " (" + plugin.getError() + ")";
}
_sb.append(String.format(" | +--%s %s:%s%s => %s", name, plugin.getControl().name(), resultLabel, error, ALWAYS_OK.contains(control) ? "OK" : resultLabel));
if ((result == SUCCESS && control == SUFFICIENT) || (result == FAIL && control == REQUISITE)) {
_sb.append(" (ends the phase)");
}
_sb.append('\n');
}
use of org.dcache.gplazma.monitor.LoginMonitor.Result in project dcache by dCache.
the class DefaultMappingStrategy method map.
/**
* Delegates execution of the {@link GPlazmaMappingPlugin#map(Set<Principal>)
* GPlazmaMappingPlugin.map} 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 monitor
* @param principals
* @throws AuthenticationException
* @see PAMStyleStrategy
* @see PluginCaller
*/
@Override
public void map(final LoginMonitor monitor, final Set<Principal> principals) throws AuthenticationException {
pamStyleMappingStrategy.callPlugins(service -> {
monitor.mapPluginBegins(service.getName(), service.getControl(), principals);
GPlazmaMappingPlugin plugin = service.getPlugin();
Result result = Result.FAIL;
String error = null;
try {
plugin.map(principals);
result = Result.SUCCESS;
} catch (AuthenticationException e) {
error = e.getMessage();
throw e;
} finally {
monitor.mapPluginEnds(service.getName(), service.getControl(), result, error, principals);
}
});
}
use of org.dcache.gplazma.monitor.LoginMonitor.Result in project dcache by dCache.
the class LoginResultPrinter method printValidation.
private void printValidation() {
if (_result.hasValidationHappened()) {
Result result = _result.getValidationResult();
String label = stringFor(_result.getValidationResult());
_sb.append(" +--VALIDATION ").append(label);
if (result == Result.FAIL) {
_sb.append(" (").append(_result.getValidationError()).append(")");
}
_sb.append('\n');
} else {
_sb.append(" +--(VALIDATION) skipped\n");
}
}
use of org.dcache.gplazma.monitor.LoginMonitor.Result in project dcache by dCache.
the class LoginResultPrinter method printInitialPart.
private void printInitialPart() {
Result result = getOverallResult();
_sb.append("LOGIN ").append(stringFor(result)).append("\n");
printLines(" in", buildInLines());
printLines("out", buildOutItems());
_sb.append(" |\n");
}
use of org.dcache.gplazma.monitor.LoginMonitor.Result in project dcache by dCache.
the class DefaultAccountStrategy method account.
/**
* Devegates execution of the {@link GPlazmaAccountPlugin#account(SessionID, Set<Principal>)
* GPlazmaAccountPlugin.account} 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
* @throws AuthenticationException
* @see PAMStyleStrategy
* @see PluginCaller
*/
@Override
public void account(final LoginMonitor monitor, final Set<Principal> authorizedPrincipals) throws AuthenticationException {
pamStyleAccountStrategy.callPlugins(service -> {
monitor.accountPluginBegins(service.getName(), service.getControl(), authorizedPrincipals);
GPlazmaAccountPlugin plugin = service.getPlugin();
Result result = Result.FAIL;
String error = null;
try {
plugin.account(authorizedPrincipals);
result = Result.SUCCESS;
} catch (AuthenticationException e) {
error = e.getMessage();
throw e;
} finally {
monitor.accountPluginEnds(service.getName(), service.getControl(), result, error, authorizedPrincipals);
}
});
}
Aggregations