|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.sgs.impl.auth.NamePasswordAuthenticator
public class NamePasswordAuthenticator
This simple implementation provides authentication based on a name and a password. It is intended only for development use.
The names and cooresponding passwords are provided through a file, which
is read on startup and then never re-read. The file is named using the
property PASSWORD_FILE_PROPERTY. The file is of a simple form
that consists of one entry per line, where each entry has a name, some
whitespace, a SHA-256 hashed password that is encoded via
encodeBytes, and finally a newline.
| Field Summary | |
|---|---|
static String |
DEFAULT_FILE_NAME
The default name for the password file, relative to the app root. |
static String |
PASSWORD_FILE_PROPERTY
The property used to define the password file location. |
| Constructor Summary | |
|---|---|
NamePasswordAuthenticator(Properties properties)
Creates an instance of NamePasswordAuthenticator. |
|
| Method Summary | |
|---|---|
Identity |
authenticateIdentity(IdentityCredentials credentials)
Authenticates the given credentials. |
static byte[] |
decodeBytes(byte[] bytes)
Decodes an array of bytes that has been encoded by a call to encodeBytes. |
static byte[] |
encodeBytes(byte[] bytes)
Encodes an array of bytes in a form suitable for including in a text file. |
String[] |
getSupportedCredentialTypes()
Returns the identifiers for this IdentityAuthenticator's
supported credential types. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String PASSWORD_FILE_PROPERTY
public static final String DEFAULT_FILE_NAME
| Constructor Detail |
|---|
public NamePasswordAuthenticator(Properties properties)
throws IOException,
NoSuchAlgorithmException
NamePasswordAuthenticator.
properties - the application's configuration properties
FileNotFoundException - if the password file cannot be found
IOException - if any error occurs reading the password file
NoSuchAlgorithmException - if SHA-256 is not supported| Method Detail |
|---|
public static byte[] decodeBytes(byte[] bytes)
encodeBytes. This results in the original binary
representation. This is used to decode a hashed password from the
password file.
bytes - an encoded array of bytes as provided by a call
to encodePassword
public static byte[] encodeBytes(byte[] bytes)
decodeBytes. This is used to turn a hashed password
into a form suitable for the password file.
bytes - an array of bytes
public String[] getSupportedCredentialTypes()
IdentityAuthenticator's
supported credential types. This may contain any number of
identifiers, which are matched against the identifier of
IdentityCredentials to determine if this
IdentityAuthenticator can consume those credentials.
getSupportedCredentialTypes in interface IdentityAuthenticator
public Identity authenticateIdentity(IdentityCredentials credentials)
throws AccountNotFoundException,
CredentialException
Identity
is valid, but has not yet been notified as logged in.
The provided IdentityCredentials must be an instance
of NamePasswordCredentials.
authenticateIdentity in interface IdentityAuthenticatorcredentials - the IdentityCredentials to authenticate
Identity
AccountNotFoundException - if the identity is unknown
CredentialException - if the credentials are invalid
|
RedDwarf, Version 0.10.1 2010-03-14 10:56:12 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||