- 浏览: 289714 次
- 性别:
- 来自: 上海
文章分类
- 全部博客 (158)
- 默认类别 (22)
- tomcat study (5)
- spring study (2)
- hibernate study (2)
- jms study (8)
- acegi study (7)
- linux study (3)
- database study (19)
- appserver study (3)
- cvs study (10)
- mysql study (2)
- ajax study (5)
- uttest study (5)
- uml study (2)
- subversion study (3)
- xml study (6)
- japanese study (7)
- english study (2)
- loadrunner study (2)
- annotation study (0)
- security study (10)
- perl study (0)
- it lecture (14)
- view study (5)
- unicode study (1)
- net study (6)
- rule study (5)
- sdo study (1)
- jbpm study (1)
最新评论
-
xieruilin:
问题解决 。。。3Q
经常在安装ORACLE数据库时,出现一个ORA-12638 凭证检索失败 -
xiebiao110:
嗯不错,我也在看tomcat6,tomcat4,分模块来分析, ...
3、tomcat中的设计模式。 -
alloyer:
非常牛叉,再有个实例就完美了!
学习acegi-security -
bulain:
少了ehcache的jar包。
acegi的MethodSecurityInterceptor -
yuen:
你好,我才开始看acegi,把你的这个例子运行了一下,出错了, ...
acegi的MethodSecurityInterceptor
2006-06-10
学习acegi-security
这几天对acegi研究了一下,现对这几天的研究做个总结。
网上资料对于acegi在web上的应用非常多,所以特意不从web入手,而从一般的java方法入手。
acegi的基本原理就是利用拦截器,对请求进行拦截,在拦截前和拦截后做些安全验证,以达到安全目的。所谓安全,一般包括两个部分,一为认证(authentication),二为授权(authorization)。
1,拦截器体系
acegi中拦截器为分为三类:
(1)filter拦截器(FilterSecurityInterceptor),主要对web应用进行拦截,即利用servlet的filter进行拦截。
(2)method拦截器,分为spring的method拦截器(MethodSecurityInterceptor)和aspectj的method拦截器(AspectJSecurityInterceptor)。
上面的代码片断已经显示,所有的真正参与验证的代码都在父类AbstractSecurityInterceptor.beforeInvocation()之中进行,而对于拦截器都只是做些委托罢了。这样可以把具体的验证代码同拦截器分开,也有利于扩展,用其他的aop技术或拦截器进行扩展,可以很轻松。
认证体系由AuthenticationManager负责,授权体系由AccessDecisionManager负责,RunAsManager 是作为用户身份转换的手段。AfterInvocationManager留下了一个接口,可以扩展默认的授权体系,可以做一些其他额外的工作。
在AbstractSecurityInterceptor.beforeInvocation()中,
首先进行认证,authenticated = this.authenticationManager.authenticate(SecurityContextHolder.getContext().getAuthentication());
其次进行授权,this.accessDecisionManager.decide(authenticated, object, attr);
AbstractSecurityInterceptor.afterInvocation()中,
做其他扩展,returnedObject = afterInvocationManager.decide(token.getAuthentication(), token.getSecureObject(),token.getAttr(), returnedObject);
2,认证体系
2.1认证管理器
认证体系的核心为AuthenticationManager,他的方法authenticate(Authentication authentication)负责所有的认证。在acegi中,由具体类ProviderManager来进行认证过程。
从上面代码片断可以看出,真正的认证过程是在ProviderManager.doAuthentication()中进行的。而ProviderManager并不是具体的认证者,他只是个管理器,它要将具体的认证过程委托给具体的认证器提供者AuthenticationProvider去做。
2.2认证提供者
认证提供者就有很多了,可以提供各种各样的认证。如dao,ldap,anonymous,authbyadapter,cas,jaas,remeberme,remote,runnasimpl,testing,x509等。
具体的认证提供者类就不详细分析了,只提个名字:DaoAuthenticationProvider,LdapAuthenticationProvider,AnonymousAuthenticationProvider,AuthByAdapterProvider,CasAuthenticationProvider,JaasAuthenticationProvider,RememberMeAuthenticationProvider,RemoteAuthenticationProvider,RunAsImplAuthenticationProvider,TestingAuthenticationProvider,X509AuthenticationProvider。
3,授权体系
3.1授权管理器
授权体系的核心为授权管理器(AccessDecisionManager),它的方法decide(Authentication authentication, Object object, ConfigAttributeDefinition config)进行具体的授权动作。
授权管理器AccessDecisionManager默认有三个实现,具体为AffirmativeBased,ConsensusBased,UnanimousBased。三个具体实现都大同小异,主要在具有角色是否应该授权上。
而具体能否单个角色是否授权,是委派给AccessDecisionVoter去做的。
3.2授权投票者
授权投票责的核心是接口AccessDecisionVoter。他有几个具体实现类:BasicAclEntryVoter,AuthenticatedVoter,RoleVoter。
这三个授权投票实现类中 acl 又最复杂。他会委托给acl管理器(AclManager)来做具体的授权工作。
3.3acl授权体系
AclManager只有一个实现类AclProviderManager ,负责提供acl授权实体。
学习acegi-security
这几天对acegi研究了一下,现对这几天的研究做个总结。
网上资料对于acegi在web上的应用非常多,所以特意不从web入手,而从一般的java方法入手。
acegi的基本原理就是利用拦截器,对请求进行拦截,在拦截前和拦截后做些安全验证,以达到安全目的。所谓安全,一般包括两个部分,一为认证(authentication),二为授权(authorization)。
1,拦截器体系
acegi中拦截器为分为三类:
(1)filter拦截器(FilterSecurityInterceptor),主要对web应用进行拦截,即利用servlet的filter进行拦截。
(2)method拦截器,分为spring的method拦截器(MethodSecurityInterceptor)和aspectj的method拦截器(AspectJSecurityInterceptor)。
public abstract class AbstractSecurityInterceptor implements InitializingBean, ApplicationEventPublisherAware, MessageSourceAware { private AccessDecisionManager accessDecisionManager; private AfterInvocationManager afterInvocationManager; private ApplicationEventPublisher eventPublisher; private AuthenticationManager authenticationManager; protected MessageSourceAccessor messages = AcegiMessageSource.getAccessor(); private RunAsManager runAsManager = new NullRunAsManager(); private boolean alwaysReauthenticate = false; private boolean rejectPublicInvocations = false; private boolean validateConfigAttributes = true; ......... protected Object afterInvocation(InterceptorStatusToken token, Object returnedObject) { ............ SecurityContextHolder.getContext().setAuthentication(token.getAuthentication()); ............ if (afterInvocationManager != null) { returnedObject = afterInvocationManager.decide(token.getAuthentication(), token.getSecureObject(),token.getAttr(), returnedObject); } ............ } protected InterceptorStatusToken beforeInvocation(Object object) { ............ authenticated = this.authenticationManager.authenticate(SecurityContextHolder.getContext().getAuthentication()); ............ this.accessDecisionManager.decide(authenticated, object, attr); ............ Authentication runAs = this.runAsManager.buildRunAs(authenticated, object, attr); if (runAs == null) { ............ return new InterceptorStatusToken(authenticated, false, attr, object); } else { ............ SecurityContextHolder.getContext().setAuthentication(runAs); return new InterceptorStatusToken(authenticated, true, attr, object); } ............ } } public class FilterSecurityInterceptor extends AbstractSecurityInterceptor implements Filter { public void invoke(FilterInvocation fi) throws IOException, ServletException { if ((fi.getRequest() != null) && (fi.getRequest().getAttribute(FILTER_APPLIED) != null) && observeOncePerRequest) { fi.getChain().doFilter(fi.getRequest(), fi.getResponse()); } else { if (fi.getRequest() != null) { fi.getRequest().setAttribute(FILTER_APPLIED, Boolean.TRUE); } InterceptorStatusToken token = super.beforeInvocation(fi); try { fi.getChain().doFilter(fi.getRequest(), fi.getResponse()); } finally { super.afterInvocation(token, null); } } } ............ } public class MethodSecurityInterceptor extends AbstractSecurityInterceptor implements MethodInterceptor { public Object invoke(MethodInvocation mi) throws Throwable { Object result = null; InterceptorStatusToken token = super.beforeInvocation(mi); try { result = mi.proceed(); } finally { result = super.afterInvocation(token, result); } return result; } ............ } public class AspectJSecurityInterceptor extends AbstractSecurityInterceptor { public Object invoke(JoinPoint jp, AspectJCallback advisorProceed) { Object result = null; InterceptorStatusToken token = super.beforeInvocation(jp); try { result = advisorProceed.proceedWithObject(); } finally { result = super.afterInvocation(token, result); } return result; } ............ }
上面的代码片断已经显示,所有的真正参与验证的代码都在父类AbstractSecurityInterceptor.beforeInvocation()之中进行,而对于拦截器都只是做些委托罢了。这样可以把具体的验证代码同拦截器分开,也有利于扩展,用其他的aop技术或拦截器进行扩展,可以很轻松。
认证体系由AuthenticationManager负责,授权体系由AccessDecisionManager负责,RunAsManager 是作为用户身份转换的手段。AfterInvocationManager留下了一个接口,可以扩展默认的授权体系,可以做一些其他额外的工作。
在AbstractSecurityInterceptor.beforeInvocation()中,
首先进行认证,authenticated = this.authenticationManager.authenticate(SecurityContextHolder.getContext().getAuthentication());
其次进行授权,this.accessDecisionManager.decide(authenticated, object, attr);
AbstractSecurityInterceptor.afterInvocation()中,
做其他扩展,returnedObject = afterInvocationManager.decide(token.getAuthentication(), token.getSecureObject(),token.getAttr(), returnedObject);
2,认证体系
2.1认证管理器
认证体系的核心为AuthenticationManager,他的方法authenticate(Authentication authentication)负责所有的认证。在acegi中,由具体类ProviderManager来进行认证过程。
public interface AuthenticationManager { public Authentication authenticate(Authentication authentication) throws AuthenticationException; } public abstract class AbstractAuthenticationManager implements AuthenticationManager{ public final Authentication authenticate(Authentication authRequest) throws AuthenticationException { try { Authentication authResult = doAuthentication(authRequest); copyDetails(authRequest, authResult); return authResult; } catch (AuthenticationException e) { e.setAuthentication(authRequest); throw e; } } private void copyDetails(Authentication source, Authentication dest) { if ((dest instanceof AbstractAuthenticationToken) && (dest.getDetails() == null)) { AbstractAuthenticationToken token = (AbstractAuthenticationToken) dest; token.setDetails(source.getDetails()); } } protected abstract Authentication doAuthentication(Authentication authentication) throws AuthenticationException; ......... } public class ProviderManager extends AbstractAuthenticationManager implements InitializingBean, ApplicationEventPublisherAware, MessageSourceAware { private List providers; ............ public Authentication doAuthentication(Authentication authentication) throws AuthenticationException { ......... Iterator iter = providers.iterator(); ............ while (iter.hasNext()) { ............. AuthenticationProvider provider = (AuthenticationProvider) iter.next(); ......... result = provider.authenticate(authentication); ............ } ............ } ......... }
从上面代码片断可以看出,真正的认证过程是在ProviderManager.doAuthentication()中进行的。而ProviderManager并不是具体的认证者,他只是个管理器,它要将具体的认证过程委托给具体的认证器提供者AuthenticationProvider去做。
2.2认证提供者
认证提供者就有很多了,可以提供各种各样的认证。如dao,ldap,anonymous,authbyadapter,cas,jaas,remeberme,remote,runnasimpl,testing,x509等。
public interface AuthenticationProvider { public Authentication authenticate(Authentication authentication) throws AuthenticationException; public boolean supports(Class authentication); }
具体的认证提供者类就不详细分析了,只提个名字:DaoAuthenticationProvider,LdapAuthenticationProvider,AnonymousAuthenticationProvider,AuthByAdapterProvider,CasAuthenticationProvider,JaasAuthenticationProvider,RememberMeAuthenticationProvider,RemoteAuthenticationProvider,RunAsImplAuthenticationProvider,TestingAuthenticationProvider,X509AuthenticationProvider。
3,授权体系
3.1授权管理器
授权体系的核心为授权管理器(AccessDecisionManager),它的方法decide(Authentication authentication, Object object, ConfigAttributeDefinition config)进行具体的授权动作。
public interface AccessDecisionManager { public void decide(Authentication authentication, Object object, ConfigAttributeDefinition config) throws AccessDeniedException, InsufficientAuthenticationException; public boolean supports(ConfigAttribute attribute); public boolean supports(Class clazz); } public abstract class AbstractAccessDecisionManager implements AccessDecisionManager, InitializingBean, MessageSourceAware { private List decisionVoters; protected MessageSourceAccessor messages = AcegiMessageSource.getAccessor(); private boolean allowIfAllAbstainDecisions = false; public boolean supports(ConfigAttribute attribute) { Iterator iter = this.decisionVoters.iterator(); while (iter.hasNext()) { AccessDecisionVoter voter = (AccessDecisionVoter) iter.next(); if (voter.supports(attribute)) { return true; } } return false; } public boolean supports(Class clazz) { Iterator iter = this.decisionVoters.iterator(); while (iter.hasNext()) { AccessDecisionVoter voter = (AccessDecisionVoter) iter.next(); if (!voter.supports(clazz)) { return false; } } return true; } .............. } public class AffirmativeBased extends AbstractAccessDecisionManager { public void decide(Authentication authentication, Object object, ConfigAttributeDefinition config) throws AccessDeniedException { Iterator iter = this.getDecisionVoters().iterator(); int deny = 0; while (iter.hasNext()) { AccessDecisionVoter voter = (AccessDecisionVoter) iter.next(); int result = voter.vote(authentication, object, config); switch (result) { case AccessDecisionVoter.ACCESS_GRANTED: return; case AccessDecisionVoter.ACCESS_DENIED: deny++; break; default: break; } } if (deny > 0) { throw new AccessDeniedException(messages.getMessage("AbstractAccessDecisionManager.accessDenied", "Access is denied")); } // To get this far, every AccessDecisionVoter abstained checkAllowIfAllAbstainDecisions(); } .............. } public class ConsensusBased extends AbstractAccessDecisionManager { public void decide(Authentication authentication, Object object, ConfigAttributeDefinition config) throws AccessDeniedException { Iterator iter = this.getDecisionVoters().iterator(); int grant = 0; int deny = 0; int abstain = 0; while (iter.hasNext()) { AccessDecisionVoter voter = (AccessDecisionVoter) iter.next(); int result = voter.vote(authentication, object, config); switch (result) { case AccessDecisionVoter.ACCESS_GRANTED: grant++; break; case AccessDecisionVoter.ACCESS_DENIED: deny++; break; default: abstain++; break; } } if (grant > deny) { return; } if (deny > grant) { throw new AccessDeniedException(messages.getMessage("AbstractAccessDecisionManager.accessDenied", "Access is denied")); } if ((grant == deny) && (grant != 0)) { if (this.allowIfEqualGrantedDeniedDecisions) { return; } else { throw new AccessDeniedException(messages.getMessage("AbstractAccessDecisionManager.accessDenied", "Access is denied")); } } // To get this far, every AccessDecisionVoter abstained checkAllowIfAllAbstainDecisions(); } .............. } public class UnanimousBased extends AbstractAccessDecisionManager { public void decide(Authentication authentication, Object object, ConfigAttributeDefinition config) throws AccessDeniedException { int grant = 0; int abstain = 0; Iterator configIter = config.getConfigAttributes(); while (configIter.hasNext()) { ConfigAttributeDefinition thisDef = new ConfigAttributeDefinition(); thisDef.addConfigAttribute((ConfigAttribute) configIter.next()); Iterator voters = this.getDecisionVoters().iterator(); while (voters.hasNext()) { AccessDecisionVoter voter = (AccessDecisionVoter) voters.next(); int result = voter.vote(authentication, object, thisDef); switch (result) { case AccessDecisionVoter.ACCESS_GRANTED: grant++; break; case AccessDecisionVoter.ACCESS_DENIED: throw new AccessDeniedException(messages.getMessage("AbstractAccessDecisionManager.accessDenied", "Access is denied")); default: abstain++; break; } } } // To get this far, there were no deny votes if (grant > 0) { return; } // To get this far, every AccessDecisionVoter abstained checkAllowIfAllAbstainDecisions(); } .............. }
授权管理器AccessDecisionManager默认有三个实现,具体为AffirmativeBased,ConsensusBased,UnanimousBased。三个具体实现都大同小异,主要在具有角色是否应该授权上。
而具体能否单个角色是否授权,是委派给AccessDecisionVoter去做的。
3.2授权投票者
授权投票责的核心是接口AccessDecisionVoter。他有几个具体实现类:BasicAclEntryVoter,AuthenticatedVoter,RoleVoter。
public interface AccessDecisionVoter { public static final int ACCESS_GRANTED = 1; public static final int ACCESS_ABSTAIN = 0; public static final int ACCESS_DENIED = -1; public boolean supports(ConfigAttribute attribute); public boolean supports(Class clazz); public int vote(Authentication authentication, Object object, ConfigAttributeDefinition config); } public abstract class AbstractAclVoter implements AccessDecisionVoter { public boolean supports(Class clazz) { if (MethodInvocation.class.isAssignableFrom(clazz)) { return true; } else if (JoinPoint.class.isAssignableFrom(clazz)) { return true; } else { return false; } } ............ } public class BasicAclEntryVoter extends AbstractAclVoter implements InitializingBean { private AclManager aclManager; private String internalMethod; private String processConfigAttribute; private int[] requirePermission; public boolean supports(ConfigAttribute attribute) { if ((attribute.getAttribute() != null) && attribute.getAttribute().startsWith(getProcessConfigAttribute())) { return true; } else { return false; } } public int vote(Authentication authentication, Object object, ConfigAttributeDefinition config) { Iterator iter = config.getConfigAttributes(); while (iter.hasNext()) { ConfigAttribute attr = (ConfigAttribute) iter.next(); if (this.supports(attr)) { // Need to make an access decision on this invocation // Attempt to locate the domain object instance to process Object domainObject = getDomainObjectInstance(object); // If domain object is null, vote to abstain if (domainObject == null) { if (logger.isDebugEnabled()) { logger.debug("Voting to abstain - domainObject is null"); } return AccessDecisionVoter.ACCESS_ABSTAIN; } // Evaluate if we are required to use an inner domain object if ((internalMethod != null) && !"".equals(internalMethod)) { try { Class clazz = domainObject.getClass(); Method method = clazz.getMethod(internalMethod, new Class[] {}); domainObject = method.invoke(domainObject, new Object[] {}); } catch (NoSuchMethodException nsme) { throw new AuthorizationServiceException("Object of class '" + domainObject.getClass() + "' does not provide the requested internalMethod: " + internalMethod); } catch (IllegalAccessException iae) { if (logger.isDebugEnabled()) { logger.debug("IllegalAccessException", iae); if (iae.getCause() != null) { logger.debug("Cause: " + iae.getCause().getMessage(), iae.getCause()); } } throw new AuthorizationServiceException("Problem invoking internalMethod: " + internalMethod + " for object: " + domainObject); } catch (InvocationTargetException ite) { if (logger.isDebugEnabled()) { logger.debug("InvocationTargetException", ite); if (ite.getCause() != null) { logger.debug("Cause: " + ite.getCause().getMessage(), ite.getCause()); } } throw new AuthorizationServiceException("Problem invoking internalMethod: " + internalMethod + " for object: " + domainObject); } } // Obtain the ACLs applicable to the domain object AclEntry[] acls = aclManager.getAcls(domainObject, authentication); // If principal has no permissions for domain object, deny if ((acls == null) || (acls.length == 0)) { if (logger.isDebugEnabled()) { logger.debug("Voting to deny access - no ACLs returned for this principal"); } return AccessDecisionVoter.ACCESS_DENIED; } // Principal has some permissions for domain object, check them for (int i = 0; i < acls.length; i++) { // Locate processable AclEntrys if (acls[i] instanceof BasicAclEntry) { BasicAclEntry processableAcl = (BasicAclEntry) acls[i]; // See if principal has any of the required permissions for (int y = 0; y < requirePermission.length; y++) { if (processableAcl.isPermitted(requirePermission[y])) { if (logger.isDebugEnabled()) { logger.debug("Voting to grant access"); } return AccessDecisionVoter.ACCESS_GRANTED; } } } } // No permissions match if (logger.isDebugEnabled()) { logger.debug( "Voting to deny access - ACLs returned, but insufficient permissions for this principal"); } return AccessDecisionVoter.ACCESS_DENIED; } } return AccessDecisionVoter.ACCESS_ABSTAIN; } ............... } public class AuthenticatedVoter implements AccessDecisionVoter { public static final String IS_AUTHENTICATED_FULLY = "IS_AUTHENTICATED_FULLY"; public static final String IS_AUTHENTICATED_REMEMBERED = "IS_AUTHENTICATED_REMEMBERED"; public static final String IS_AUTHENTICATED_ANONYMOUSLY = "IS_AUTHENTICATED_ANONYMOUSLY"; private AuthenticationTrustResolver authenticationTrustResolver = new AuthenticationTrustResolverImpl(); private boolean isFullyAuthenticated(Authentication authentication) { return (!authenticationTrustResolver.isAnonymous(authentication) && !authenticationTrustResolver.isRememberMe(authentication)); } public void setAuthenticationTrustResolver(AuthenticationTrustResolver authenticationTrustResolver) { Assert.notNull(authenticationTrustResolver, "AuthenticationTrustResolver cannot be set to null"); this.authenticationTrustResolver = authenticationTrustResolver; } public boolean supports(ConfigAttribute attribute) { if ((attribute.getAttribute() != null) && (IS_AUTHENTICATED_FULLY.equals(attribute.getAttribute()) || IS_AUTHENTICATED_REMEMBERED.equals(attribute.getAttribute()) || IS_AUTHENTICATED_ANONYMOUSLY.equals(attribute.getAttribute()))) { return true; } else { return false; } } public boolean supports(Class clazz) { return true; } public int vote(Authentication authentication, Object object, ConfigAttributeDefinition config) { int result = ACCESS_ABSTAIN; Iterator iter = config.getConfigAttributes(); while (iter.hasNext()) { ConfigAttribute attribute = (ConfigAttribute) iter.next(); if (this.supports(attribute)) { result = ACCESS_DENIED; if (IS_AUTHENTICATED_FULLY.equals(attribute.getAttribute())) { if (isFullyAuthenticated(authentication)) { return ACCESS_GRANTED; } } if (IS_AUTHENTICATED_REMEMBERED.equals(attribute.getAttribute())) { if (authenticationTrustResolver.isRememberMe(authentication) || isFullyAuthenticated(authentication)) { return ACCESS_GRANTED; } } if (IS_AUTHENTICATED_ANONYMOUSLY.equals(attribute.getAttribute())) { if (authenticationTrustResolver.isAnonymous(authentication) || isFullyAuthenticated(authentication) || authenticationTrustResolver.isRememberMe(authentication)) { return ACCESS_GRANTED; } } } } return result; } } public class RoleVoter implements AccessDecisionVoter { private String rolePrefix = "ROLE_"; public boolean supports(ConfigAttribute attribute) { if ((attribute.getAttribute() != null) && attribute.getAttribute().startsWith(getRolePrefix())) { return true; } else { return false; } } public boolean supports(Class clazz) { return true; } public int vote(Authentication authentication, Object object, ConfigAttributeDefinition config) { int result = ACCESS_ABSTAIN; Iterator iter = config.getConfigAttributes(); while (iter.hasNext()) { ConfigAttribute attribute = (ConfigAttribute) iter.next(); if (this.supports(attribute)) { result = ACCESS_DENIED; for (int i = 0; i < authentication.getAuthorities().length; i++) { if (attribute.getAttribute().equals(authentication.getAuthorities()[i].getAuthority())) { return ACCESS_GRANTED; } } } } return result; } }
这三个授权投票实现类中 acl 又最复杂。他会委托给acl管理器(AclManager)来做具体的授权工作。
3.3acl授权体系
AclManager只有一个实现类AclProviderManager ,负责提供acl授权实体。
public interface AclManager { public AclEntry[] getAcls(Object domainInstance); public AclEntry[] getAcls(Object domainInstance, Authentication authentication); } public class AclProviderManager implements AclManager, InitializingBean { public AclEntry[] getAcls(Object domainInstance) { Assert.notNull(domainInstance, "domainInstance is null - violating interface contract"); Iterator iter = providers.iterator(); while (iter.hasNext()) { AclProvider provider = (AclProvider) iter.next(); if (provider.supports(domainInstance)) { if (logger.isDebugEnabled()) { logger.debug("ACL lookup using " + provider.getClass().getName()); } return provider.getAcls(domainInstance); } } if (logger.isDebugEnabled()) { logger.debug("No AclProvider found for " + domainInstance.toString()); } return null; } public AclEntry[] getAcls(Object domainInstance, Authentication authentication) { Assert.notNull(domainInstance, "domainInstance is null - violating interface contract"); Assert.notNull(authentication, "authentication is null - violating interface contract"); Iterator iter = providers.iterator(); while (iter.hasNext()) { AclProvider provider = (AclProvider) iter.next(); if (provider.supports(domainInstance)) { if (logger.isDebugEnabled()) { logger.debug("ACL lookup using " + provider.getClass().getName()); } return provider.getAcls(domainInstance, authentication); } else { if (logger.isDebugEnabled()) { logger.debug("Provider " + provider.toString() + " does not support " + domainInstance); } } } if (logger.isDebugEnabled()) { logger.debug("No AclProvider found for " + domainInstance.toString()); } return null; } ......... }
评论
6 楼
alloyer
2008-11-19
非常牛叉,再有个实例就完美了!
5 楼
cljspn
2007-03-27
好,就是没有结合配置说明,
4 楼
wrong1111
2007-02-25
不错!!清晰
3 楼
liuyxit
2006-12-27
好文!!
在我见到Acegi最清淅的一个,如果结合配置再说明一下。肯定是很清源很明了的。
在我见到Acegi最清淅的一个,如果结合配置再说明一下。肯定是很清源很明了的。
2 楼
chengshwu
2006-11-16
AccessDeniedException 这个异常应该怎么处理啊?我是说怎么样让它在页面上显示出来啊?
1 楼
kimfly
2006-10-23
BasicAclEntry类到底代表了什么啊?
发表评论
-
acegi的MethodSecurityInterceptor实例
2006-06-06 17:46 20972006-06-06 acegi的MethodSecurit ... -
acegi的MethodSecurityInterceptor
2006-06-06 17:42 55612006-06-06 acegi的MethodSecurit ... -
acegi 参考的部分翻译
2006-06-01 17:29 11452006-06-01 acegi 参考的部分翻译 htt ... -
Feiing以前写的一篇介绍 Acegi 的文档
2006-01-12 21:47 1438http://forum.iteye.com/viewtopi ... -
实战Acegi:使用Acegi作为基于Spring框架的WEB应用的安全框架
2006-01-12 21:46 1363http://www.blogjava.net/youlq/a ... -
ajax的经典集萃
2005-11-07 21:24 1223ajax的经典集萃 一个ajax的经典测试用例(时时都在为新 ...
相关推荐
这个"acegi-security-0.6.1.jar.zip"文件包含的是Acegi Security 0.6.1版本的库,以及相关的许可证信息。 Acegi Security的核心功能在于提供了一套全面的身份验证和授权机制,它允许开发者为Web应用程序添加细粒度...
这个"acegi-security-0.8.1.1.jar.zip"文件是Acegi Security 0.8.1.1版本的归档包,包含了该版本的核心库文件——"acegi-security-0.8.1.1.jar",以及相关的许可证文件——"springframework-license.txt"。...
总的来说,`acegi-security-0.8.3.jar.zip` 提供了一个早期的Java安全解决方案,对于学习和理解基于Spring的安全架构历史及其发展具有重要意义。在当前的开发环境中,虽然我们更多地转向Spring Security,但理解...
"acegi-security-jetty-0.8.3.jar.zip"文件是Acegi Security与Jetty服务器特定版本(0.8.3)的集成包,它包含了Acegi Security的jar文件以及相关的许可证信息。 Acegi Security的主要功能包括: 1. **身份验证**:...
总的来说," Acegi-security-samples-tutorial-1.0.7.zip "是一个宝贵的教育资源,它通过实际的代码示例帮助我们学习和掌握Acegi Security这一强大的安全框架。通过深入研究和实践,开发者可以有效地提升其在Java ...
这个“acegi-security-0.8.2.jar.zip”文件包含的是Acegi Security 0.8.2版本的JAR包以及相关的许可证信息。 Acegi Security的核心功能是为Java应用程序提供身份验证(Authentication)和授权(Authorization)服务...
总的来说,Acegi Security的源码包为学习和定制安全组件提供了一个宝贵的资源。通过对源码的分析,开发者可以更深入地了解安全设计模式,提高应用的安全性和可靠性。同时,这也是一个提升Java和Spring框架技能的好...
Acegi Security是一款已退役的安全框架,它为Java应用程序提供了全面的身份验证、授权和服务层安全...通过深入学习Acegi Security,开发者可以更好地理解现代Web应用安全的基础,并为向更新的安全框架迁移做好准备。
在分析`acegi-security-1.0.4.jar`的源码之前,我们需要了解Acegi Security的基本概念和架构。 Acegi Security的核心目标是提供一个灵活、可扩展的安全框架,允许开发者对用户认证、授权进行细粒度控制。它基于...
这个"acegi-security-resin-0.9.0.jar.zip"文件包含的是Acegi Security与Resin应用服务器集成的一个特定版本,即0.9.0版。Resin是一款高性能的Java应用服务器,常用于部署和管理Java Web应用程序。 Acegi Security...
在"acegi-security-1.0.7"这个版本中,包含了完整的ACEGI安全框架的所有包文件,使得开发者能够方便地集成和使用这一强大的安全工具。 ### 1. 框架概述 ACEGI Security(后被Spring Security替代)主要目的是解决...
此压缩包"acegi-security-cas-0.9.0.jar.zip"包含了Acegi Security与CAS(Central Authentication Service)集成的0.9.0版本的组件。CAS是一个开源的身份验证框架,常用于实现单点登录(Single Sign-On, SSO)功能。...
这个"acegi-security-0.5.jar.zip"文件包含的是Acegi Security 0.5版本的库,它是一个压缩包,其中包含了"acegi-security-0.5.jar"文件和"springframework-license.txt"文件。 Acegi Security是专门为Spring框架...
Acegi Security是一款已退役的安全框架,它为Java平台上的Spring框架提供了全面的身份验证和授权服务。...学习Acegi Security可以帮助我们更好地理解和利用Spring Security,以及更广泛的安全最佳实践。
总的来说,`acegi-security-jetty-0.8.0.jar.zip` 文件组合提供了在Jetty服务器上运行的Acegi Security安全框架,这对于理解早期Spring生态的安全实践以及Jetty服务器的定制化配置具有一定的学习价值。然而,由于...
`acegi-security-catalina-0.8.0.jar` 文件是该安全框架的核心组件,它包含了运行在Tomcat环境下的所有必要类和资源。将这个JAR文件部署到Tomcat服务器的类路径中,可以使得服务器具备Acegi Security的功能,如用户...
在`org`目录下,源代码按照包结构组织,展示了Acegi Security的模块划分,如`org.acegisecurity`包包含了所有核心的类和接口,如`Authentication`、`Authorization`相关的类。 通过分析这些源代码,开发者可以了解...
对于学习Acegi Security的开发者,理解源代码中的关键类和接口,如`AbstractSecurityInterceptor`、`Authentication`、`GrantedAuthority`等,是至关重要的。同时,熟悉Spring AOP的概念和实践也有助于更好地利用...
<bean id="authenticationManager" class="org.acegisecurity.providers.UsernamePasswordAuthenticationProvider"> <!-- 用户详细信息服务 --> <!-- 密码编码器 --> ...
Acegi Security,现已被Spring Security所取代,是Java EE应用程序中的一个强大且灵活的安全框架,主要用于...虽然现在Spring Security已经替代了Acegi,但Acegi的历史地位和它提供的安全实践依然值得我们学习和借鉴。