Skip to content

Commit

Permalink
Remove OAUTH2 from ResourceServerType and update logic.
Browse files Browse the repository at this point in the history
#deploy-idporten-frontend

The OAUTH2 enum entry has been removed from ResourceServerType, and related logic was updated to use TOKEN_X for OAuth2AuthenticationToken cases. This ensures consistency in attribute handling and streamlines authentication token processing.
  • Loading branch information
krharum committed Dec 18, 2024
1 parent 63290a1 commit 97a7508
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 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.OAUTH2);
return Mono.just(ResourceServerType.TOKEN_X);
}
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, OAUTH2 -> getTokenAttribute("pid");
case TOKEN_X -> getTokenAttribute("pid");
case AZURE_AD -> getTokenAttribute("oid");
});
}
Expand All @@ -38,7 +38,7 @@ private Mono<String> getTokenAttribute(String attribute) {
jwtAuthenticationToken.getTokenAttributes().get(attribute).toString();

case OAuth2AuthenticationToken oauth2AuthenticationToken ->
oauth2AuthenticationToken.getPrincipal().getAttributes().get(attribute).toString();
oauth2AuthenticationToken.getPrincipal().getAttribute("pid");

default -> "";
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@

public enum ResourceServerType {
TOKEN_X,
AZURE_AD,
OAUTH2
AZURE_AD
}

0 comments on commit 97a7508

Please sign in to comment.