<s>
Java	B-Language
Authentication	I-Language
and	I-Language
Authorization	I-Language
Service	I-Language
,	O
or	O
JAAS	O
,	O
pronounced	O
"	O
Jazz	O
"	O
,	O
is	O
the	O
Java	B-Language
implementation	O
of	O
the	O
standard	O
Pluggable	B-Application
Authentication	I-Application
Module	I-Application
(	O
PAM	O
)	O
information	O
security	O
framework	O
.	O
</s>
<s>
JAAS	O
was	O
introduced	O
as	O
an	O
extension	O
library	O
to	O
the	O
Java	B-Language
Platform	I-Language
,	I-Language
Standard	I-Language
Edition	I-Language
1.3	O
and	O
was	O
integrated	O
in	O
version	O
1.4	O
.	O
</s>
<s>
By	O
extending	O
the	O
verification	O
vectors	O
JAAS	O
extends	O
the	O
security	O
architecture	O
for	O
Java	B-Language
applications	O
that	O
require	O
authentication	O
and	O
authorization	O
modules	O
.	O
</s>
<s>
For	O
the	O
system	B-Application
administrator	I-Application
,	O
JAAS	O
consists	O
of	O
two	O
kinds	O
of	O
configuration	B-Protocol
file	I-Protocol
:	O
</s>
<s>
a	O
login	B-General_Concept
service	O
that	O
will	O
invoke	O
your	O
application	O
callbacks	O
to	O
ask	O
the	O
user	O
things	O
like	O
username	O
and	O
password	O
.	O
</s>
<s>
for	O
developing	O
login	B-General_Concept
modules	O
.	O
</s>
<s>
Login	B-General_Concept
modules	O
are	O
primarily	O
concerned	O
with	O
authentication	O
rather	O
than	O
authorization	O
and	O
form	O
a	O
widely	O
used	O
component	O
of	O
JAAS	O
.	O
</s>
<s>
A	O
login	B-General_Concept
module	O
is	O
required	O
to	O
implement	O
the	O
javax.security.auth.spi.LoginModule	O
interface	O
,	O
which	O
specifies	O
the	O
following	O
methods	O
:	O
</s>
<s>
initialize	O
:	O
Code	O
to	O
initialize	O
the	O
login	B-General_Concept
module	O
,	O
usually	O
by	O
storing	O
the	O
parameters	O
passed	O
into	O
appropriate	O
fields	O
of	O
the	O
Class	O
.	O
</s>
<s>
login	B-General_Concept
:	O
Actually	O
check	O
the	O
credentials	O
provided	O
via	O
an	O
Object	O
that	O
implements	O
the	O
javax.security.auth.Callback	O
interface	O
(	O
e.g.	O
</s>
<s>
This	O
method	O
could	O
prompt	O
the	O
user	O
for	O
their	O
login	B-General_Concept
and	O
password	O
or	O
it	O
could	O
use	O
details	O
previously	O
obtained	O
.	O
</s>
<s>
It	O
is	O
important	O
to	O
note	O
here	O
that	O
,	O
if	O
invalid	O
credentials	O
are	O
supplied	O
then	O
a	O
javax.security.auth.login.FailedLoginException	O
should	O
be	O
thrown	O
(	O
rather	O
than	O
returning	O
false	O
,	O
which	O
indicates	O
that	O
this	O
login	B-General_Concept
module	O
should	O
be	O
ignored	O
,	O
which	O
potentially	O
allows	O
authentication	O
to	O
succeed	O
)	O
.	O
</s>
<s>
commit	O
:	O
The	O
identity	O
of	O
the	O
subject	O
has	O
been	O
verified	O
,	O
so	O
code	O
in	O
this	O
method	O
sets	O
up	O
the	O
Principal	B-General_Concept
and	O
Groups	O
(	O
roles	O
)	O
for	O
the	O
successfully	O
authenticated	O
subject	O
.	O
</s>
<s>
This	O
method	O
has	O
to	O
be	O
written	O
carefully	O
in	O
enterprise	O
applications	O
as	O
Java	B-Language
EE	O
application	O
servers	O
often	O
expect	O
the	O
relationships	O
between	O
the	O
Principal	B-General_Concept
and	O
Group	O
objects	O
to	O
be	O
set	O
up	O
in	O
a	O
certain	O
way	O
.	O
</s>
<s>
This	O
method	O
should	O
throw	O
a	O
javax.security.auth.login.FailedLoginException	O
if	O
authentication	O
fails	O
(	O
e.g.	O
</s>
<s>
a	O
user	O
has	O
specified	O
an	O
incorrect	O
login	B-General_Concept
or	O
password	O
)	O
.	O
</s>
<s>
If	O
this	O
method	O
returns	O
false	O
,	O
then	O
this	O
Login	B-General_Concept
Module	O
is	O
ignored	O
.	O
</s>
<s>
could	O
remove	O
the	O
Principal	B-General_Concept
from	O
the	O
Subject	O
or	O
could	O
invalidate	O
a	O
web	O
session	O
)	O
.	O
</s>
<s>
Login	B-General_Concept
modules	O
can	O
provide	O
single	O
sign	O
on	O
(	O
SSO	O
)	O
via	O
a	O
particular	O
SSO	O
protocol/framework	O
(	O
e.g.	O
</s>
<s>
SAML	O
,	O
OpenID	O
,	O
and	O
SPNEGO	B-Protocol
)	O
,	O
can	O
check	O
for	O
the	O
presence	O
of	O
hardware	O
security	O
tokens	O
(	O
e.g.	O
</s>
<s>
Login	B-General_Concept
modules	O
are	O
written	O
by	O
implementing	O
this	O
interface	O
;	O
they	O
contain	O
the	O
actual	O
code	O
for	O
authentication	O
.	O
</s>
<s>
The	O
login	B-General_Concept
context	O
is	O
the	O
core	O
of	O
the	O
JAAS	O
framework	O
which	O
kicks	O
off	O
the	O
authentication	O
process	O
by	O
creating	O
a	O
Subject	O
.	O
</s>
<s>
A	O
principal	B-General_Concept
represents	O
the	O
face	O
of	O
a	O
subject	O
.	O
</s>
<s>
As	O
the	O
credential	O
represents	O
some	O
important	O
information	O
,	O
the	O
further	O
interfaces	O
might	O
be	O
useful	O
for	O
creating	O
a	O
proper	O
and	O
secure	O
credential	O
–	O
javax.security.auth.Destroyable	O
and	O
javax.security.auth.Refreshable	O
.	O
</s>
