Java Reference
In-Depth Information
table 7.1
Key Constructors and Methods of the Subject Class
Task
Method/Constructor
Remarks
Creation
public Subject();
public Subject(boolean
readOnly, Set principals, Set
pubCredentials, Set
privCredentials)
Constructor for creating
different types of object
of subject class
Principal-related
operations
public Set getPrincipals();
public Set getPrincipals(Class
c)
Returns a set of principals
associated with the
subject
Credential-related
operations
public Set
getPublicCredentials()
public Set
getPublicCredentials(Class c)
public Set);
Returns a set of public
credentials
Returns a set of private
credentials
getPrivateCredentials()
public Set
getPrivateCredentials(Class c
Read/write
operations on
subject
public void setReadOnly()
This operation renders a
subject to be a read-only
object
Returns a true/false
whether a given subject is
read-only.
public boolean isReadOnly()
Subject can be created using a suitable constructor, including a class provides a number of
methods for handling the attributes. he getter methods help in fetching attribute related infor-
mation such as principal, public credentials, and private credentials.
Table 7.1 indicates some of the key constructors and methods associated with the subject class.
7.4.3.2 Authentication Classes and Interfaces
here are two classes and two interfaces that help in creating authentication module of any appli-
cation. hey are LoginContext class, LoginModule interface, CallbackHandler inter-
face, and Callback interface.
LoginContext —he javax.security.auth.login.LoginContext class is the most
important class of JAAS that provides the basic methods used to authenticate subjects and
paves a way to develop an application that is independent of the underlying authentication
technology. he LoginContext object accesses a coniguration object to glean information
about the authentication services, or LoginModule(s), to be conigured for a speciic appli-
cation. Diferent LoginModules, therefore, can be plugged in for an application without
requiring any modiications to the application program.
Search WWH ::




Custom Search