http://www.diybl.com/course/1_web/javascript/jsjs/2008915/143069_3.html
http://blog.csdn.net/jingmin/archive/2009/03/31/4039336.aspx
- Object obj = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<sec:authorize ifAllGranted="ROLE_SUPERVISOR">Role_super</sec:authorize>
如果登陆的用户的角色是ROLE_SUPERVISOR 那么就显示Role_super,否则不显示
<sec:authentication property="name"/>
<sec:authentication property="principal.username"/>
<sec:authentication property="principal.enabled"/>
<sec:authentication property="principal.accountNonLocked"/>
struts2 spring2 acegi 它们整合时,登陆是找不到/j_spring_security_check??
HTTP Status 404 - There is no Action mapped for namespace / and action name j_spring_security_check.??
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.jsp</url-pattern>
org.springframework.security.AuthenticationCredentialsNotFoundException: An Authentication object was not found in the SecurityContext
??
java.lang.NoSuchMethodException: $Proxy0.view()
java.lang.Class.getMethod(Class.java:1605)??
java.lang.Error: Unresolved compilation problem:
The method Role(int) in the type TestAcegi is not applicable for the arguments ()
带参数的方法不能拦截.???
<bean id="methodSecurityInterceptor" class="org.springframework.security.intercept.method.aopalliance.MethodSecurityInterceptor">
<property name="authenticationManager">
<ref bean="authenticationManager2"/>
</property>
<property name="accessDecisionManager">
<ref bean="accessDecisionManager"/>
</property>
<property name="objectDefinitionSource"> 对代理的类的方法开始配置权限 ,ROLE_SUPERVISOR
<value>com.method.TestAcegi.Role=ROLE_USER
com.service.DAOService.test=ROLE_USER
</value>
</property>
</bean>
<bean id="testAcegi" class="com.method.TestAcegi"/>
<bean id="autoProxyCreator" class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
<property name="beanNames">
<list>
<value>testAcegi</value> 要代理的Bean的id
</list>
</property>
<property name="interceptorNames">
<list>
<value>methodSecurityInterceptor</value> 代理为...
</list>
</property>
</bean>
上面的不推荐使用