隨筆-12  評論-0  文章-1  trackbacks-0
          JAAS generally has the following two steps:
          1, Authentication: define principals,  implement LoginModule and callback handler, associate designated principals with the subject object in the commit method of LoginModule implementation, configure the module implementation in a login configuration file, i.e
          Sample {
             sample.module.SampleLoginModule required debug=true;
          };

          lc = new LoginContext("Sample", new MyCallbackHandler());
          Subject s = lc.getSubject();
          Subject.doAs(s, new PrivilegedAction(){...}); // the authenticated subject s will be associated with the current access control context.

          2. Authorization: write policy file to grant principals access right to any critical resources. e.g.
          grant
                  Principal sample.principal.SamplePrincipal "testUser" {

             permission java.util.PropertyPermission "java.home", "read";
             permission java.util.PropertyPermission "user.home", "read";
             permission java.io.FilePermission "foo.txt", "read";
          };
          posted on 2011-12-31 14:32 Sam Zheng 閱讀(134) 評論(0)  編輯  收藏

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 深泽县| 前郭尔| 太和县| 新兴县| 吴川市| 团风县| 梨树县| 宣威市| 大理市| 青龙| 伊川县| 且末县| 太湖县| 开平市| 沙坪坝区| 旅游| 珲春市| 崇左市| 娄底市| 福泉市| 司法| 峨眉山市| 师宗县| 县级市| 汉川市| 泰顺县| 漳平市| 准格尔旗| 鲜城| 廉江市| 玉田县| 兴业县| 安吉县| 沙雅县| 翁源县| 乌审旗| 灌南县| 古蔺县| 繁峙县| 瑞金市| 宜阳县|