Spring boot CORS issue when redirecting to Sign out URI

Benjamin Fallar III 6 Reputation points
2021-11-19T00:44:51.953+00:00

I have a Spring boot application and Angular in a same project. I have no problem redirecting to Azure SSO Login https://login.microsoftonline.com/ BUT when I trigger the log out link of the application to /common/oauth2/v2.0/logout endpoint, I encountered MissingAllowOriginHeader CORS error in the request in the Status using the Network in the Chrome devtools.

150720-image.png

The SSO logout is invoked from a Restcontroller endpoint using the following code snippet

@GetMapping(value = "auth/logout")  
@CrossOrigin(origins = "*")  
public String logoutUser(HttpServletRequest request, HttpServletResponse response) {  
	invalidateAndUnsubscribe(request);  
	String logoutUrl = response.encodeRedirectURL(azureService.logoutUrl());  
	log.info("---- User log out from DSS web and Azure AD app: {}", logoutUrl);  
  
	return REDIRECT_KEY + logoutUrl;  
}  

The first call to logout endpoint in my controller is shown here

150822-image.png

Then after redirecting to Azure logout

150823-image.png

Azure Spring Apps
Azure Spring Apps
An Azure platform as a service for running Spring Boot applications at cloud scale. Previously known as Azure Spring Cloud.
124 questions
0 comments No comments
{count} vote

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.