Closed daniDevKr closed 3 years ago
I have put the header Authorization: Basic <encoded client credentials>
in the request.
Now, the server get me the access token but in the response there isn't the refresh token.
Server response:
{
"access_token": "<the token>",
"expires_in": "3599"
"scope": "message.read message.write"
"token_type": "Bearer"
}
How can I enable it ?
@jhonToni Refresh token support will be merged soon. See #128
I have the same problem despite adding the Authorization Basic header
@Configuration(proxyBeanMethods = false) public class AuthorizationServerConfig { private final KeyManager keyManager;
public AuthorizationServerConfig(KeyManager keyManager) {
this.keyManager = keyManager;
}
@Bean
@Order(Ordered.HIGHEST_PRECEDENCE)
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
OAuth2AuthorizationServerConfiguration.applyDefaultSecurity(http);
http.getConfigurer(OAuth2AuthorizationServerConfigurer.class)
.oidc(Customizer.withDefaults()); // Enable OpenID Connect 1.0
http
// Redirect to the login page when not authenticated from the
// authorization endpoint
.exceptionHandling((exceptions) -> exceptions
.defaultAuthenticationEntryPointFor(
new LoginUrlAuthenticationEntryPoint("/login"),
new MediaTypeRequestMatcher(MediaType.TEXT_HTML)
)
)
// Accept access tokens for User Info and/or Client Registration
.oauth2ResourceServer((resourceServer) -> resourceServer
.jwt(Customizer.withDefaults()));
return http.build();
}
@Bean
public RegisteredClientRepository registeredClientRepository() {
RegisteredClient clientRepository = RegisteredClient.withId(UUID.randomUUID().toString())
.clientId("orbis-station-client")
.clientName("Orbis Mandataire")
.clientSecret("{noop}secret")
.clientAuthenticationMethod(ClientAuthenticationMethod.NONE)
.authorizationGrantType(AuthorizationGrantType.AUTHORIZATION_CODE)
.authorizationGrantType(AuthorizationGrantType.CLIENT_CREDENTIALS)
.scope(OidcScopes.EMAIL)
.clientSettings(ClientSettings.builder().requireAuthorizationConsent(true).build())
.redirectUri("https://127.0.0.1:8000/dashboard")
.build();
return new InMemoryRegisteredClientRepository(clientRepository);
}
@Bean
public AuthorizationServerSettings authorizationServerSettings() {
return AuthorizationServerSettings.builder()
.issuer("https://account.orbis-identity.com:8080")
.build();
}
@Bean
public JWKSource<SecurityContext> jwkSource() {
KeyPair keyPair = keyManager.rsaKey();
RSAPublicKey publicKey = (RSAPublicKey) keyPair.getPublic();
RSAPrivateKey privateKey = (RSAPrivateKey) keyPair.getPrivate();
RSAKey rsaKey = new RSAKey.Builder(publicKey)
.privateKey(privateKey)
.keyID(UUID.randomUUID().toString())
.build();
JWKSet jwkSet = new JWKSet(rsaKey);
return new ImmutableJWKSet<>(jwkSet);
}
@Bean
public JwtDecoder jwtDecoder(JWKSource<SecurityContext> jwkSource) {
return OAuth2AuthorizationServerConfiguration.jwtDecoder(jwkSource);
}
}
Describe the bug The Oauth server return
invalid_client
with valid token request.To Reproduce
/oauth2/authorize
endpoint;The server response is:
{"error":"invalid_client"}
Expected behavior
My oauth server configuration file: