【问题标题】:Spring Oauth authorization code configurationSpring Oauth 授权码配置
【发布时间】:2016-09-11 17:50:54
【问题描述】:

如何正确配置我的 jdbcAuthorizationCodeService?

这是我的配置要点

  @Override
        public void configure(AuthorizationServerEndpointsConfigurer endpoints)
                throws Exception {
            endpoints
                    .tokenStore(this.tokenStore)
                    .authenticationManager(this.authenticationManager)
                    .authorizationCodeServices(this.jdbcAuthorizationCodeServices).userApprovalHandler(new DefaultUserApprovalHandler());
        }

我的桌子是这样构造的

我的问题是。身份验证列的样本值应该是什么?因为它是 bytea,根据 spring oauth2 的要求

【问题讨论】:

    标签: java spring spring-security oauth2 spring-oauth2


    【解决方案1】:

    身份验证列将存储调用中收到的 OAuth2Authentication 对象的序列化版本。

    这是来自 jdbcAuthorizationCodeService 类的代码

    @Override
        protected void store(String code, OAuth2Authentication authentication) {
            jdbcTemplate.update(insertAuthenticationSql,
                    new Object[] { code, new 
    SqlLobValue(SerializationUtils.serialize(authentication)) }, new int[] {
                            Types.VARCHAR, Types.BLOB });
        }
    

    【讨论】:

      猜你喜欢
      • 2019-06-20
      • 2018-11-21
      • 2017-08-31
      • 2016-08-12
      • 2015-09-16
      • 2018-07-04
      • 2017-02-25
      • 2018-11-13
      • 2014-09-15
      相关资源
      最近更新 更多