Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Java Security  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 Re:在web上jaas的声明性授权,出措??? [Re:neweagle]
jsmile

Life is good



发贴: 127
积分: 52
于 2003-08-29 22:30 user profilesend a private message to usersend email to jsmilesearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
Assume you already know how LoginModule, CallbackHandler and Permission works (Authentication). Here's the different code of two authorization types:
Declarative authorization:
class SomelAction implements PrivilegedAction
{
public Object run()
{
AccessController.checkPermission(new SomeDefinedPermission("xxx"));
// Perform tasks
return new Integer(0);
}
}

Programmatic authorization:
class SomeAction implements PrivilegedAction
{
public Object run()
{
AccessControlContext context = AccessController.getContext();
Subject subject = Subject.getSubject( context );

Set principals = subject.getPrincipals();
Iterator iterator = principals.iterator();
while (iterator.hasNext())
{
MyPrincipal principal = (MyPrincipal)iterator.next();
if (principal.getName().equals( "Some Pre-Defined Role"))
{
// Perform tasks
return new Integer(0);
}
}
throw new AccessControlException("Denied");
}
}




话题树型展开
人气 标题 作者 字数 发贴时间
13896 在web上jaas的声明性授权,出措??? neweagle 3615 2003-08-06 11:25
12057 Re:在web上jaas的声明性授权,出措??? menzy 29 2003-08-06 16:02
11760 Re:在web上jaas的声明性授权,出措??? neweagle 198 2003-09-01 21:18
14324 Re:在web上jaas的声明性授权,出措??? jeez 181 2003-09-02 10:44
11748 Re:在web上jaas的声明性授权,出措??? neweagle 1209 2003-08-06 16:12
11830 Re:在web上jaas的声明性授权,出措??? jprobe 110 2003-08-27 18:49
12289 Re:在web上jaas的声明性授权,出措??? jsmile 754 2003-08-27 22:26
12276 Re:在web上jaas的声明性授权,出措??? richardluopeng 34 2003-08-28 19:50
11760 Re:在web上jaas的声明性授权,出措??? floater 75 2003-08-29 11:41
12495 Re:在web上jaas的声明性授权,出措??? jsmile 1023 2003-08-29 22:30
11681 Re:在web上jaas的声明性授权,出措??? jeez 53 2003-09-01 17:36
11874 Re:在web上jaas的声明性授权,出措??? BlurEyes 259 2003-09-01 20:48

flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923