2011-12-19 74 views
0

我想为所有球衣客户端请求实现Spring数据库支持的验证。 我已经添加了春季安全过滤器链到我的web.xml中,这对我的春季安全上下文XML文件:Spring支持数据库验证+ Jersey客户端

<authentication-manager> 
      <authentication-provider user-service-ref="myDetailsService"> 
        <jdbc-user-service data-source-ref="dataSource" /> 
      </authentication-provider> 
    </authentication-manager> 
    <beans:bean id="myDetailsService" class="myPackage.MyDetailsService"/> 

我的问题是关于MyUserDetailsS​​ervice类,我想检索用户其凭据(保存在一个数据库)匹配球衣客户发送的数据。这是我的impl:

class MyUserDetailsService implements UserDetailsService{ 
     public MyUserDetailsService(String username,String password){} 

    // i get the connexion from datasource 
    // and request user with corresponding username/password 
    // and return that user. 
} 

我该如何传递我从球衣客户端请求中获得的用户名/密码来创建用户? (在标题或查询URL中发送)

回答

0

您是否尝试过AuthenticationUserDetailsS​​ervice类?传递给loadUserDetails的Authentication对象具有用户的主体标识和凭证。