Subject: The Beauty of JAAS
Author: authen
In response to: JAAS in Simple
Posted on: 10/20/2012 12:42:24 AM
The beauty of JAAS is attributed to its simplest layout architecture. No matter how complicated the underlying implementation is, the interface remains essentially the same. Once the JAAS interface is integrated into your business layer, it's a done deal -- regardless of the change and upgrade at the actual authentication layer.
Here is a minimal example to integrate JAAS:
/* JAAS Part I -- Authentication */
LoginContext lc = new LoginContext("myLoginEntity");
try {
lc.login();
} catch (LoginException e) {
throw e;
}
/* JAAS Part II -- Authorization */
Subject sub = lc.getSubject();
Subject.doAs(sub, new MyPrivilegedAction());
That's it. Just that simple!
>
> On 10/20/2012 12:40:24 AM
authen wrote:
What is JAAS?
JAAS stands for Java Authentication and Authorization Service (JAAS).
References: