java - Spring oauth2 添加额外的 fieldp

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

登录后/uaa/oauth/token spring 发送该字段:

{
  "access_token": "eyJhbG",
  "token_type": "bearer",
  "refresh_token": "asfasfda"
  "expires_in": 86399,
  "scope": "events",
  "jti": "a4e4584c-ed38-4a26-b778-1748b27046ae",
  "key" : "my own field"
}

但是我如何添加自己的自定义字段,例如键?

最佳答案

 @Configuration
    @EnableResourceServer
    protected static class ResourceServerConfiguration extends ResourceServerConfigurerAdapter {

        @Override
        public void configure(ResourceServerSecurityConfigurer resources) {
            resources.resourceId(Constants.RESOURCE_ID);
        }

        @Override
        public void configure(HttpSecurity http) throws Exception {
           http
            .addFilter(new AuthTokenRequestFilter())
           .....
        }
}

关于java - Spring oauth2 添加额外的 fieldp,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38622240/

相关文章:

java - 我们可以在Spring Boot中基于​​rest api路径参数实现@Conditional Bean吗?

java - 如何获取CloudFoundry MySQL连接参数?

java - JerseyConfig 在 Spring Boot 应用程序中覆盖 @RestController

grails - Grails 3.0.1 Spring Security Core返回Gradle构建因错误而终止:编译失败

java - 查找返回有状态 session bean 的新实例

详细 View 中的 java 卡小程序部署

spring-boot - Spring Boot Security 导致 java.lang.NoClassDefFoundError : org/springframework/security/web/access/WebInvocationPrivilegeEvaluator

java - 使用 spring security java 限制用户在查看页面之前进行身份验证

Java 网格布局 : south-JPanel covers center-JPanel?

java - 我什么时候应该使用新类而不是添加新字段(作为状态)?