Skip to content

OAuth2Error when logged user tries to loggin again without logout #7884

@belomx

Description

@belomx

Summary

When loggin into my web application using oath2 (in this summary I will use google provider as example), it will reach the home page (fine) and then user press back in the browser, the page will be at the google's select user page to login, if the user select an user to "loggin again" and return to home page spring security will return an error.

Actual Behavior

Spring security is returning an error during the second loggin. Error at OAuth2LoginAuthenticationFilter:

OAuth2Error oauth2Error = new
OAuth2Error(AUTHORIZATION_REQUEST_NOT_FOUND_ERROR_CODE);
throw new OAuth2AuthenticationException(oauth2Error, oauth2Error.toString());

Expected Behavior

If the user selected in the second attempt is the same from the previous. And the session remains valid and not expired. The user could log into the system properly.

Configuration

http
// permit access to any resource, access restrictions are handled at the level of Vaadin views
.authorizeRequests()
.antMatchers("/Login","/","/login/**").permitAll().and()

	// disable CSRF (Cross-Site Request Forgery) since Vaadin implements its own mechanism for this
	.csrf().disable()
	.oauth2Login()
	.loginPage("/login")
	.authorizationEndpoint()
	.baseUri("/oauth2/authorize-client")
	.authorizationRequestRepository(authorizationRequestRepository())
	.and()
	.tokenEndpoint()
	.accessTokenResponseClient(accessTokenResponseClient())
	.and()
	.defaultSuccessUrl("/home")
	.failureUrl("/error")
	.and().sessionManagement().sessionFixation().newSession()
	;

Version

5.2.1.RELEASE

Metadata

Metadata

Assignees

Labels

in: oauth2An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose)status: invalidAn issue that we don't feel is valid

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions