Łukasz Woźniczka
Łukasz Woźniczka

Reputation: 1695

Spring oauth2 add additional fieldp

After login /uaa/oauth/token spring send that fields:

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

But how can i add my own custom fields, for example key?

Upvotes: 0

Views: 365

Answers (1)

Puran
Puran

Reputation: 994

 @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())
           .....
        }
}

Upvotes: 1

Related Questions