|
SPT Core API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sptci.auth.Authenticator
public final class Authenticator
A JAAS based authenticator to implement login/authentication.
The following shows how to use this class. Note that the appropriate login module to use must be configured via JAAS.
import com.sptci.auth.Authenticator;
import com.sptci.auth.AuthenticationException;
import com.sptci.auth.Group;
import com.sptci.auth.User;
...
String user = "scott";
char[] password = "tiger".toCharArray();
String loginmodule = "databaseauthenticator";
Authenticator authenticator = new Authenticator( loginmodule );
User user = null;
try
{
user = authenticator.authenticate( user, password );
}
catch ( AuthenticationException aex )
{
logger.log( Level.SEVERE, "Authentication failed for user: " +
user, aex );
throw new ApplicationException( aex );
}
for ( Group group : user.groups )
{
}
Copyright 2006, Sans Pareil Technologies, Inc.
| Constructor Summary | |
|---|---|
Authenticator()
Default constructor. |
|
Authenticator(String loginModule)
Create a new authenticator for the specified login module. |
|
| Method Summary | |
|---|---|
User |
authenticate(String userName,
char[] password)
Authenticate the user with the specified credentials. |
User |
authenticate(String userName,
char[] password,
char[] key)
Authenticate the user with the specified credentials. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Authenticator()
loginModule to a system property
with the key com.sptci.auth.Authenticator.module to use as
the JAAS module to use.
public Authenticator(String loginModule)
loginModule - The JAAS login module to use.| Method Detail |
|---|
public User authenticate(String userName,
char[] password)
throws AuthenticationException
userName - The user/login name to authenticate.password - The password to authenticate.
AuthenticationException - If the specified credentials could
not be authenticated.authenticate( String, char[], char[] )
public User authenticate(String userName,
char[] password,
char[] key)
throws AuthenticationException
userName - The user/login name to authenticate.password - The password to authenticate.key - The key to use to decrypt the stored password.
AuthenticationException - If the specified credentials could
not be authenticated.
|
SPT Core API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||