O'Reilly logo

J2EE™ and Beyond: Design, Develop, and Deploy World-Class Java™ Software by Art Taylor

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Code Example

Using JAAS involves the interaction of a number of classes and configuration files. The classes involved in using JAAS are not just the classes in the JAAS package, but include the Java SecurityManager and the AccessController, classes that are part of the Java security framework. In addition to these classes, entries in the security policy file, the Java security configuration file, and the JAAS configuration file may also be required.

The following example demonstrates the use of JAAS for both authentication and authorization. First, the user is authenticated using one of several LoginContext initializations. Following a successful login, authorization is tested by executing several privileged actions using the Subject class.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required