Oracle Entitlements Server with Java SM

本文档详细介绍了使用 Oracle Entitlements Server (OES) 进行授权管理的步骤,包括创建应用、安全模块、资源类型等,并提供了一个验证授权请求的应用示例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.  Create New Application (go to Authorization management > Application > click new Application)
2.   Create New Security Module (go to System Configuration > Security Module > click New)
3.  Create New Resource Type (go to Newly Created Application > Resource Types > Click new)
4.  Create New Resource (go to Newly Created Application > Default Policy Domain > Resources Catalog > Resources > Create New)
5.  Create New Permit Authorization Policy (go to Newly Created Application > Default Policy Domain > Application Policies > Create New)
6.  Create New Deny Authorization Policy (go to Newly Created Application > Default Policy Domain > Application Policies > Create New)
7.  Edit the following file
$OES_CLIENT_HOME/oessm/SMConfigTool/smconfig.java.controlled.prp
8.  Run the config.sh
9.  This will create a directory in $OES_CLIENT_HOME/oes_sm_instances/< SM_NAME_AS _IN_PRP_FILE >
10.   Create a sample application to validate the authorization request. Code  Snippet is as follows-
11.   Run the program to check that it is authorizing the user initiating the resource request.

Sample source:
******************************************************************
public class HelloWBworld2 {

    /**
     * @param args
     */
    public static void main(String[] args) {
        // TODO Auto-generated method stub
         WLSUserImpl p = new WLSUserImpl("weblogic_wc");
          System.out.println("HelloWBworld :: principal :: "+p);
          Subject user = new Subject();
          System.out.println("HelloWBworld :: Subject :: "+user);
//           user.getPrincipals().add(p);
          System.out.println("HelloWBworld :: Subject after add :: "+user);
          // Resource being accessed AppName/ResourceType/ResouceName
          String resourceString = "HelloWBWorld/MyWBResourceType/MyWBResource";
          System.out.println("HelloWBworld :: resourceString :: " +resourceString);
          // Action initiated by the user
          String action = "write";
          System.out.println("HelloWBworld :: action :: "+action);
          // Environmental/Context attributes
          while (true)
          {
              System.out.println("HelloWBworld :: while start ");
              try {
                 // get Authorization response from OES
                 PrepareResponse response = PepRequestFactoryImpl.getPepRequestFactory()
                             .newPepRequest(
                                     user,
                                    action,
                                    resourceString,
                                    null).decide();
                System.out.println( "Request: {" + user + " " + action + " " + resourceString +  "} \nResult: " + response.allowed());
              } catch (PepException e) {
                 System.out.println( "***** Caught exception:  " + e.getMessage());
                 e.printStackTrace();
                 System.exit(1);
              }
        }
    }
}****************************************************************
http://docs.oracle.com/cd/E37115_01/dev.1112/e27154/handle_auth_calls.htm

转载于:https://www.cnblogs.com/lzhairs/p/3503683.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值