You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 5, 2022. It is now read-only.
My UAA service is also an oauth2 client, which needs to relay JWT tokens coming in from Zuul. When configuring the oauth2 client the following way
@Configuration
@EnableOAuth2Client
@RibbonClient(name = "downstream")
public class OAuthClientConfiguration {
@Bean
public OAuth2RestTemplate restTemplate(OAuth2ProtectedResourceDetails resource, OAuth2ClientContext context) {
return new OAuth2RestTemplate(resource, context);
}
}
I do get a 401 response from the downstream service as my access token has a very short validity and the AccessTokenContextRelay#copyToken() which get's executed by the autowired ResourceServerTokenRelayRegistrationAutoConfiguration drops the validity and refresh token information.
This leads to the following behavior:
Zuul does renew expired access tokens by calling OAuth2RestTemplate#getAccessToken
The UAA service also call OAuth2RestTemplate#getAccessToken but, as the access token populated by AccessTokenContextRelay in the OAuth2ClientContext does always return false for accessToken.isExpired(), the token is neither renewed nor does AccessTokenContextRelay refresh updated incoming access tokens. Instead the expired token is used again and again.