2016-05-16 164 views
0

如何正確配置我的jdbcAuthorizationCodeService?Spring Oauth授權碼配置

因此,這裏是我的配置

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

的要點,我的表的構造類似這樣的

enter image description here

我的問題是。認證列的樣本值應該是多少?因爲它是bytea,按照spring的要求oauth2

回答

0

認證列將存儲在調用中接收到的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 }); 
    }