Add Token Exchange grant to demo-client sample

Issue gh-60
This commit is contained in:
Steve Riesenberg
2024-02-12 15:34:54 -06:00
parent 25a785de49
commit 2ec9329b86
15 changed files with 693 additions and 2 deletions

View File

@@ -145,6 +145,7 @@ public class AuthorizationServerConfig {
.scope(OidcScopes.PROFILE)
.scope("message.read")
.scope("message.write")
.scope("user.read")
.clientSettings(ClientSettings.builder().requireAuthorizationConsent(true).build())
.build();
@@ -157,10 +158,19 @@ public class AuthorizationServerConfig {
.scope("message.write")
.build();
RegisteredClient tokenExchangeClient = RegisteredClient.withId(UUID.randomUUID().toString())
.clientId("token-client")
.clientSecret("{noop}token")
.clientAuthenticationMethod(ClientAuthenticationMethod.CLIENT_SECRET_BASIC)
.authorizationGrantType(new AuthorizationGrantType("urn:ietf:params:oauth:grant-type:token-exchange"))
.scope("message.read")
.build();
// Save registered client's in db as if in-memory
JdbcRegisteredClientRepository registeredClientRepository = new JdbcRegisteredClientRepository(jdbcTemplate);
registeredClientRepository.save(registeredClient);
registeredClientRepository.save(deviceClient);
registeredClientRepository.save(tokenExchangeClient);
return registeredClientRepository;
}

View File

@@ -118,6 +118,10 @@ public class AuthorizationConsentController {
"message.write",
"This application will be able to add new messages. It will also be able to edit and delete existing messages."
);
scopeDescriptions.put(
"user.read",
"This application will be able to read your user information."
);
scopeDescriptions.put(
"other.scope",
"This is another scope example of a scope description."