Methods Summary |
---|
protected java.security.Principal | getIdentity()
log.trace("getIdentity called");
Principal principal = new SimplePrincipal(principalName);
return principal;
|
protected java.security.acl.Group[] | getRoleSets()This method simply returns an empty array of Groups which means that
no role based permissions are assigned.
log.trace("getRoleSets called");
return new Group[] {};
|
public void | initialize(javax.security.auth.Subject subject, javax.security.auth.callback.CallbackHandler handler, java.util.Map sharedState, java.util.Map options)
super.initialize(subject, handler, sharedState, options);
principalName = (String) options.get("principal");
if( principalName == null )
{
throw new IllegalArgumentException("Must supply a principal name!");
}
userName = (String) options.get("userName");
if( userName == null )
{
throw new IllegalArgumentException("Must supply a user name!");
}
password = (String) options.get("password");
if( password == null )
{
log.warn("Creating LoginModule with no configured password!");
password = "";
}
log.trace("got principal: " + principalName + ", username: " + userName + ", password: " + password);
|
public boolean | login()
log.trace("login called");
if( super.login() == true )
return true;
Principal principal = new SimplePrincipal(principalName);
SubjectActions.addPrincipals(subject, principal);
// Put the principal name into the sharedState map
sharedState.put("javax.security.auth.login.name", principalName);
PasswordCredential cred = new PasswordCredential(userName, password.toCharArray());
cred.setManagedConnectionFactory(getMcf());
SubjectActions.addCredentials(subject, cred);
super.loginOk = true;
return true;
|