Showing posts with label JAAS. Show all posts
Showing posts with label JAAS. Show all posts

Thursday, September 25, 2008

User Managers in Oracle JAAS

The user manager contains definitions for users,groups or roles. The default user manager is JAZNUserManager. 
You can define user manager for all applications or for specific applications.
  • Global User Manager : The instance user manager defined in application.xml file
  • Specific User Manager: This user manager is defined in orion_application.xml solely for a single application
How to specify a user manager in orion-application.xml?
There are 3 elements that can be used to specify a UserManager.
  • <user-manager> - A user manager implemented by a user-defined class
  • <jazn> - JAZNUserManager
  • <principals> - A user manager defined in a principals.xml file
There may be more than one of the user-manager configuration within a single <orionapplication> element. Which element determines the UserManager is determined by the order the elements appear i.e. <user-manager> takes precedence over <jazn>, which takes precedence over <principals>.

If no user manager is specified, then the UserManager is determined according to the following rules,
  1. For the default application, a JAAS UserManager is created based on jazn-data.xml in the directory containing the application.xml file.If no jazn-data.xml is present in that directory, one is created. The default realm of the created jazn-data.xml file is jazn.com.
  2. At application deployment time, if the UserManager of the parent application is based on principals.xml, then the UserManager of the application will be a principals UserManager.
  3. At deployment time, if the UserManager of the parent application is the JAAS UserManager, then a JAAS UserManager is created based on jazn-data.xml

Wednesday, September 24, 2008

How to Integrate OracleAS JAAS Provider with Basic Authentication?

Basic Authentication in J2EE Environments
In this environment, Oracle AS SSO is not used.A login module such as RealmLoginModule is used. 

An HTTP client attempts to access a Web application hosted by OC4J.Oc4J invokes the RealmLoginModule whenever user credentials are required. For e.g. when a user hits a protected page,OC4J will ask Oracle AS JAAS provider to authenticate the user.The RealmLoginModule will be invoked to authenticate the user, using the credentials sent by the user via browser over HTTP.
Then Oracle JAAS provider retrieves the user. The following sections speak about this in detail.

I.Authentication in the J2EE Environment
Authentication is the process of verifying the identity of a user in a computing system. In Oracle Application Server, authentication in the J2EE environment is performed by the following:
  • OracleAS Single Sign-On (for OracleAS Single Sign-On environments)
  • OracleAS JAAS Provider RealmLoginModule or other login module (for non-OracleAS Single Sign-On environments)
Retrieving Authentication Information
The following javax.servlet.HttpServletRequest APIs retrieve authentication information within the servlet.
  • getRemoteUser() for the authenticated user name
  • getAuthType() for the authentication scheme
  • getUserPrincipal() for the authenticated principal object
II.Authorization in the J2EE Environment
Authorization is the process of granting permission & privileges to an authenticated user. Authorization is achieved through JAZNUserManager. The JAZNUserManager gets the authenticated user information (set by mod_osso) from the HTTP request object & sets the JAAS subject in OC4J.

Retrieving Authorization Information
  • Servlet.service() in the servlet
  • Subject.doAs() and Subject.doAsPrivileged() in the client
  • SecurityManager.checkPermission() in the server
III.Security Role Mapping
Two distinct role types available to application developers creating secure applications in J2EE environment are J2EE roles & JAAS roles.
This section describes these role types and how they are mapped together.
  • J2EE Security Roles
  • Deployment Roles and Users
  • OC4J Group Mapping to J2EE Security Roles
J2EE Security Roles


The J2EE development environment includes a portable security roles feature defined in the web.xml file for servlets and JavaServer Pages (JSP). For example, an application defines a security role called sr_developer:
<security-role> 
<role-name>
sr_developer
</role-name> 
</security-role>


You also define the access permissions for the sr_developer role.
<security-constraint> 
<web-resource-collection> 
<web-resource-name>access to the entire application
</web-resource-name> 
<url-pattern>/*</url-pattern> 
</web-resource-collection> 
<!-- authorization -->
<auth-constraint> 
<role-name>
sr_developer
</role-name> 
</auth-constraint> 
</security-constraint>
Deployment Roles and Users
JAAS roles and users are defined depending on the provider type, LDAP-based or XML-based.
For example, with the XML-based provider type, developer is listed as a role in the jazndata.
xml file:
<role> 
<name>
developer
</name> 
<members> 
<member> 
<type>user<type> 
<name>john<name> 
</member> 
</members> 
</role>
OC4J Group Mapping to J2EE Security Roles
OC4J enables you to map portable J2EE security roles defined in the J2EE web.xml file to groups in an orion-application.xml file. The roles and users defined in your provider environment are mapped to the OC4J developer group role in the orion-application.xml file.
For example, the sr_developer security role is mapped to the group named developer.
<security-role-mapping name="sr_developer">
<group name="developer" />
</security-role-mapping>

What is Oracle JAAS?

What is JAAS?
Java Authentication & Authorization Service is a Java Package that enables applications to authenticate & enforce access controls upon users.

What is Oracle AS JAAS Provider?
The Oracle AS JAAS Provider is an implementation of JAAS interface. The OC4J JAAS implementation supports two types of provider types,
  • XML-based provider
  • LDAP-based provider
The XML-based provider stores user,realm & policy information in an XML file, normally jazn-data.xml.
The LDAP-based provider stores user, realm & policy information in the LDAP-based Oracle Internet Directory (OID).

JAAS Framework Features
Role-Based Access Control (RBAC) enables you to assign permissions to roles. 
Instead of directly assigning permissions to users, the permissions are assigned to role & the users are granted their permissions by being made members of that role. Multiple roles can be granted to a user. A role can also be granted another role, thus forming a role hierarchy.