public abstract class NamePasswordLoginModule
extends java.lang.Object
implements javax.security.auth.spi.LoginModule
LoginModule
implementations designed for username-password
authentication.
A typical subclass implements only the init()
,
authenticate(UsernameCredential, PasswordCredential)
and getPrincipals()
methods. Advanced LoginModule
classes also implements the
getPublicCredentials()
and getPrivateCredentials()
methods.
Constructor and Description |
---|
NamePasswordLoginModule() |
Modifier and Type | Method and Description |
---|---|
abstract boolean |
authenticate(UsernameCredential username,
PasswordCredential password)
This abstract
authenticate method is responsible for
validating username-password combinations and must be implemented by all
concrete subclasses. |
java.lang.String |
getOption(java.lang.String name)
Returns the value of the named option from the JAAS application
configuration.
|
java.lang.String |
getOption(java.lang.String name,
java.lang.String defaultValue)
Returns the value of the named option from the JAAS application
configuration.
|
PasswordCredential |
getPasswordCredential()
Returns the
PasswordCredential extracted from the input from
the PasswordCallback . |
abstract java.util.Collection |
getPrincipals()
The
getPrincipals method must be implemented by all concrete
subclasses and should return a list of all Principal objects
that should be associated with the logged in Subject . |
java.util.Collection |
getPrivateCredentials()
The
getPrivateCredentials method must be implemented by all
concrete subclasses and should return a list of all private
Credential objects that should be associated with the logged
in Subject . |
java.util.Collection |
getPublicCredentials()
The
getPublicCredentials method must be implemented by all
concrete subclasses and should return a list of all public
Credential objects that should be associated with the logged
in Subject . |
UsernameCredential |
getUsernameCredential()
Returns the
UsernameCredential extracted from the input from
the NameCallback . |
abstract void |
init()
An abstract initialization method.
|
public abstract void init()
NamePasswordLoginModule.getOption(String)
and
NamePasswordLoginModule.getOption(String, String)
methods can be used to retrieve the
login module's configuration parameters.public UsernameCredential getUsernameCredential()
UsernameCredential
extracted from the input from
the NameCallback
. The method can be used by a subclass when it
is populating the Collection
instances returned by the
getPrincipals
, getPublicCredentials
and
getPrivateCredentials
methods.UsernameCredential
public PasswordCredential getPasswordCredential()
PasswordCredential
extracted from the input from
the PasswordCallback
. The method can be used by a subclass
when it is populating the Collection
instances returned by the
getPrincipals
, getPublicCredentials
and
getPrivateCredentials
methods.UsernameCredential
public abstract boolean authenticate(UsernameCredential username, PasswordCredential password) throws javax.security.auth.login.FailedLoginException
authenticate
method is responsible for
validating username-password combinations and must be implemented by all
concrete subclasses. The method should return true
if the
authentication succeeds for the given credentials. If the
LoginModule
should be ignored (e.g., when inappropriately
requested to authenticate the root user), the method should return
false
. If the authentication fails, a
FailedLoginException
should be thrown.username
- the UsernameCredential
password
- the PasswordCredential
true
if
authentication succeeds, or false
if the module should
be ignored.javax.security.auth.login.FailedLoginException
- if the authentication failspublic abstract java.util.Collection getPrincipals()
getPrincipals
method must be implemented by all concrete
subclasses and should return a list of all Principal
objects
that should be associated with the logged in Subject
. If the
method is called multiple times, it should always return the same
Principal
instances. The Collection
instance
holding the Principal
objects need not be the same, however.Collection
containing all Principal
objects associated with the logged in Subject
public java.util.Collection getPublicCredentials()
getPublicCredentials
method must be implemented by all
concrete subclasses and should return a list of all public
Credential
objects that should be associated with the logged
in Subject
. If the method is called multiple times, it should
always return the same Credential
instances. The
Collection
instance holding the Credential
objects need not be the same, however.Collection
containing all public
Credential
objects associated with the logged in
Subject
public java.util.Collection getPrivateCredentials()
getPrivateCredentials
method must be implemented by all
concrete subclasses and should return a list of all private
Credential
objects that should be associated with the logged
in Subject
. If the method is called multiple times, it should
always return the same Credential
instances. The
Collection
instance holding the Credential
objects need not be the same, however.Collection
containing all private
Credential
objects associated with the logged in
Subject
public java.lang.String getOption(java.lang.String name)
name
- the option namepublic java.lang.String getOption(java.lang.String name, java.lang.String defaultValue)
name
- the option namedefaultValue
- a default option valueCopyright © 2000-2020 TIBCO Software Inc. All Rights Reserved.