Weblogic Portal Authorization – Get and Check User’s Roles

| Posted by watashii | Filed under Java, Programming, Web

The Authorization class provides runtime methods for security policies and roles checks.  The following code fragment obtains the set of roles the logged-in user belongs to.  Note the user must be authenticated first, see Authentication class.

String entAppName = ApplicationHelper.getNonVersionedAppName();
String webAppName = ApplicationHelper.getWebAppName(request);
EnterpriseRoleResource resource = new EnterpriseRoleResource(entAppName,webAppName,EntitlementConstants.P13N_ROLE_POLICY_POOL,"");
Map userRoles = Authorization.getRoles((P13nResource) resource);
if (Authorization.isUserInRole("Admin", userRoles)) {
	return true;
}

Global and Enterprise Application roles are obtained using EnterpriseRoleResource.  For Global, Enterprise, and Web Application roles, use WebappRoleResource.

com.bea.p13n.security.Authentication

Share:

  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Print
  • email

Related Posts:

  1. Weblogic Portal – Create Streaming Desktop Page Definition Error
  2. Using JSF 1.2 on Oracle Workshop for Weblogic (Portal 10.3)
  3. Reading Portlet Preferences in Weblogic Portal
  4. Start & Stop Weblogic Without Username & Password
  5. Encrypt Passwords With Weblogic Server

Tags: , , , ,

Leave a Reply