X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=Workspace%2FSiman-Common%2Fsrc%2Forg%2Fsplat%2Fkernel%2FRealmLoginModule.java;h=e9b3ed0b19df3df4cb2991bc6a3fa36941776a32;hb=c466a2e1212921b03787c765854f440fc5187483;hp=0a8eeb7f1b97787303577eab4e541fa3c5ee8df7;hpb=d322fbe7cd10ebd0a6e698b1c0e5402582e5d98c;p=tools%2Fsiman.git diff --git a/Workspace/Siman-Common/src/org/splat/kernel/RealmLoginModule.java b/Workspace/Siman-Common/src/org/splat/kernel/RealmLoginModule.java index 0a8eeb7..e9b3ed0 100644 --- a/Workspace/Siman-Common/src/org/splat/kernel/RealmLoginModule.java +++ b/Workspace/Siman-Common/src/org/splat/kernel/RealmLoginModule.java @@ -24,42 +24,64 @@ import org.apache.log4j.Logger; import org.splat.dal.bo.kernel.User; import org.splat.service.ServiceLocatorImpl; +/** + * Implementation of login module for SIMAN. + */ public class RealmLoginModule implements LoginModule { - // Initial state + /** + * The logger. + */ + private static final Logger LOG = Logger.getLogger(RealmLoginModule.class); + + /** + * Initial state. + */ private transient Subject _subject; private transient CallbackHandler _callbackHandler; // private Map sharedState; // private Map options; - // Authentication status + /** + * Authentication status. + */ private transient boolean _succeeded = false; private transient boolean _commit = false; - // Principal + /** + * Principal. + */ private transient User _identity = null; - private static final Logger LOG = Logger.getLogger(RealmLoginModule.class); - // ============================================================================================================================== // Constructor // ============================================================================================================================== + /** + * {@inheritDoc} + * + * @see javax.security.auth.spi.LoginModule#initialize(javax.security.auth.Subject, javax.security.auth.callback.CallbackHandler, + * java.util.Map, java.util.Map) + */ public void initialize(final Subject user, final CallbackHandler handler, final Map state, final Map opts) { - // -------------------------------------------------------------------------------------------------------- _subject = user; _callbackHandler = handler; // sharedState = state; // options = opts; // debug = "true".equalsIgnoreCase((String)options.get("debug")); - //_logger = Logger.getLogger(RealmLoginModule.class); + // _logger = Logger.getLogger(RealmLoginModule.class); } // ============================================================================================================================== // Public services // ============================================================================================================================== + /** + * {@inheritDoc} + * + * @see javax.security.auth.spi.LoginModule#login() + */ public boolean login() throws LoginException { boolean res = false; try { @@ -102,13 +124,19 @@ public class RealmLoginModule implements LoginModule { } catch (java.io.IOException ioe) { throw new LoginException(ioe.getMessage()); // RKV: NOPMD: The message is sent into the constructor } catch (UnsupportedCallbackException uce) { - throw new LoginException("Error: " + uce.getCallback().toString() // RKV: NOPMD: Stacktrace is printed + throw new LoginException("Error: " // RKV: NOPMD: Stacktrace is printed + + uce.getCallback().toString() + " not available to garner authentication information" + " from the user"); } return res; } + /** + * {@inheritDoc} + * + * @see javax.security.auth.spi.LoginModule#commit() + */ public boolean commit() throws LoginException { boolean res = _succeeded; if (res) { @@ -121,19 +149,29 @@ public class RealmLoginModule implements LoginModule { return res; } + /** + * {@inheritDoc} + * + * @see javax.security.auth.spi.LoginModule#abort() + */ public boolean abort() throws LoginException { boolean res = _succeeded; if (res) { - if (_succeeded && !_commit) { + if (_commit) { + logout(); + } else { _identity = null; _succeeded = false; - } else { - logout(); } } return res; } + /** + * {@inheritDoc} + * + * @see javax.security.auth.spi.LoginModule#logout() + */ public boolean logout() throws LoginException { _subject.getPrincipals().remove(_identity); _identity = null;