Skip to content

Commit

Permalink
Update handling of OAuth2 authentication in resource server types #de…
Browse files Browse the repository at this point in the history
…ploy-idporten-frontend

Replaced TOKEN_X with OAUTH2 for OAuth2AuthenticationToken and added OAUTH2 to ResourceServerType enum. Updated user ID resolution logic to support OAUTH2 by mapping its "pid" attribute, ensuring compatibility with OAuth2 flows.
  • Loading branch information
krharum committed Dec 18, 2024
1 parent 90f9bfe commit 63290a1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public Mono<ResourceServerType> call() {
.map(Mono::just)
.orElseGet(Mono::empty);
} else if (authentication instanceof OAuth2AuthenticationToken) {
return Mono.just(ResourceServerType.TOKEN_X);
return Mono.just(ResourceServerType.OAUTH2);
}
return Mono.empty();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public Mono<String> call() {
return getAuthenticatedResourceServerType
.call()
.flatMap(serverType -> switch (serverType) {
case TOKEN_X -> getTokenAttribute("pid");
case TOKEN_X, OAUTH2 -> getTokenAttribute("pid");
case AZURE_AD -> getTokenAttribute("oid");
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@

public enum ResourceServerType {
TOKEN_X,
AZURE_AD
AZURE_AD,
OAUTH2
}

0 comments on commit 63290a1

Please sign in to comment.