struts2 spring2 hibernate3 acegi

http://www.diybl.com/course/1_web/javascript/jsjs/2008915/143069_3.html

 

http://blog.csdn.net/jingmin/archive/2009/03/31/4039336.aspx

 

  1. 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> 

上面的不推荐使用

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值