English 中文(简体)
方法@Secured 假定在用户没有认证的情况下会犯错误
原标题:
  • 时间:2009-05-29 15:51:25
  •  标签:

我的服务守则如下......

@Controller
@GwtRpcEndPoint
public class ServerServiceImpl implements ServerService {

  @org.springframework.security.annotation.Secured("ROLE_ADMIN")
  public String runGwtSprMvcHibJpaDemo(String s) {


        System.out.println("SecurityContextHolder.getContext()="+SecurityContextHolder.getContext());
        System.out.println("SecurityContextHolder.getContext().getAuthentication()="+SecurityContextHolder.getContext().getAuthentication());
  }

}

我的申请

<security:global-method-security secured-annotations="enabled" jsr250-annotations="disabled" />

但是,当有人要求服务时。 采用gwt-rpc, 是t t prGwtSprMvcHibJpaDemo的,因为用户尚未认证,因此应当打印出安全错误? 相反,使用GwtSprMvcHibJpaDemo的方法是用产出执行的。

 SecurityContextHolder.getContext()=org.springframework.security.context.SecurityContextImpl@ffffffff: Null authentication  SecurityContextHolder.getContext().getAuthentication()=null
问题回答

增 编

<security:http auto-config="true">
        <security:intercept-url pattern="/**" access="ROLE_ADMIN" />
</security:http>

参看您的xml config,看看它是否固定。

您的春季背景中的定义如下:

bean id="userDetailsService" class="packagename.MyUserService">.

注 春天在内部利用这个灯塔开始这项服务。

我的User Service是用户服务的一种实施。





相关问题
热门标签