Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions docs/modules/ROOT/pages/reactive/oauth2/login/advanced.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -361,17 +361,15 @@ public class OAuth2LoginSecurityConfig {
Set<GrantedAuthority> mappedAuthorities = new HashSet<>();

authorities.forEach(authority -> {
if (OidcUserAuthority.class.isInstance(authority)) {
OidcUserAuthority oidcUserAuthority = (OidcUserAuthority)authority;
if (authority instanceof OidcUserAuthority oidcUserAuthority) {

OidcIdToken idToken = oidcUserAuthority.getIdToken();
OidcUserInfo userInfo = oidcUserAuthority.getUserInfo();

// Map the claims found in idToken and/or userInfo
// to one or more GrantedAuthority's and add it to mappedAuthorities

} else if (OAuth2UserAuthority.class.isInstance(authority)) {
OAuth2UserAuthority oauth2UserAuthority = (OAuth2UserAuthority)authority;
} else if (authority instanceof OAuth2UserAuthority oauth2UserAuthority) {

Map<String, Object> userAttributes = oauth2UserAuthority.getAttributes();

Expand Down Expand Up @@ -675,7 +673,7 @@ The ID Token is represented as a https://tools.ietf.org/html/rfc7519[JSON Web To
The `ReactiveOidcIdTokenDecoderFactory` provides a `ReactiveJwtDecoder` used for `OidcIdToken` signature verification. The default algorithm is `RS256` but may be different when assigned during client registration.
For these cases, a resolver may be configured to return the expected JWS algorithm assigned for a specific client.

The JWS algorithm resolver is a `Function` that accepts a `ClientRegistration` and returns the expected `JwsAlgorithm` for the client, eg. `SignatureAlgorithm.RS256` or `MacAlgorithm.HS256`
The JWS algorithm resolver is a `Function` that accepts a `ClientRegistration` and returns the expected `JwsAlgorithm` for the client, e.g. `SignatureAlgorithm.RS256` or `MacAlgorithm.HS256`

The following code shows how to configure the `OidcIdTokenDecoderFactory` `@Bean` to default to `MacAlgorithm.HS256` for all `ClientRegistration`:

Expand Down
6 changes: 2 additions & 4 deletions docs/modules/ROOT/pages/servlet/oauth2/login/advanced.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -483,17 +483,15 @@ public class OAuth2LoginSecurityConfig {
Set<GrantedAuthority> mappedAuthorities = new HashSet<>();

authorities.forEach(authority -> {
if (OidcUserAuthority.class.isInstance(authority)) {
OidcUserAuthority oidcUserAuthority = (OidcUserAuthority)authority;
if (authority instanceof OidcUserAuthority oidcUserAuthority) {

OidcIdToken idToken = oidcUserAuthority.getIdToken();
OidcUserInfo userInfo = oidcUserAuthority.getUserInfo();

// Map the claims found in idToken and/or userInfo
// to one or more GrantedAuthority's and add it to mappedAuthorities

} else if (OAuth2UserAuthority.class.isInstance(authority)) {
OAuth2UserAuthority oauth2UserAuthority = (OAuth2UserAuthority)authority;
} else if (authority instanceof OAuth2UserAuthority oauth2UserAuthority) {

Map<String, Object> userAttributes = oauth2UserAuthority.getAttributes();

Expand Down
Loading