Skip to content

Commit 6a4425c

Browse files
Fix possible NPE in OidcClientInitiatedLogoutSuccessHandler#endSessionEndpoint
1 parent bf486fc commit 6a4425c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/oidc/web/logout/OidcClientInitiatedLogoutSuccessHandler.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,13 @@ protected String determineTargetUrl(HttpServletRequest request,
6969
private URI endSessionEndpoint(OAuth2AuthenticationToken token) {
7070
String registrationId = token.getAuthorizedClientRegistrationId();
7171
ClientRegistration clientRegistration = this.clientRegistrationRepository.findByRegistrationId(registrationId);
72-
Object endSessionEndpoint = clientRegistration.getProviderDetails().getConfigurationMetadata().get("end_session_endpoint");
7372

7473
URI result = null;
75-
if (endSessionEndpoint != null) {
76-
result = URI.create(endSessionEndpoint.toString());
74+
if (clientRegistration != null) {
75+
Object endSessionEndpoint = clientRegistration.getProviderDetails().getConfigurationMetadata().get("end_session_endpoint");
76+
if (endSessionEndpoint != null) {
77+
result = URI.create(endSessionEndpoint.toString());
78+
}
7779
}
7880

7981
return result;

0 commit comments

Comments
 (0)