【问题标题】:Spring Database backed authentication + Jersey clientSpring Database 支持的身份验证 + Jersey 客户端
【发布时间】:2012-01-23 11:13:25
【问题描述】:

我想为所有 jersey 客户端请求实现 spring 数据库支持的身份验证。 我已将 spring 安全过滤器链添加到我的 web.xml 中,并将其添加到我的 spring 安全上下文 xml 文件中:

    <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 类,我想在其中检索凭据(保存在数据库中)与球衣客户端发送的凭据匹配的用户。这是我的暗示:

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 中发送)

【问题讨论】:

    标签: authentication spring-security jersey


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-04-05
      • 2013-07-20
      • 1970-01-01
      • 2015-12-26
      • 1970-01-01
      • 2015-06-20
      • 1970-01-01
      相关资源
      最近更新 更多