Skip to content

Make RedirectStrategy customizable in OAuth2AuthorizationEndpointFilter #1557

@dawidkaluza

Description

@dawidkaluza

Expected Behavior
Make it possible to inject custom implementation of RedirectStrategy (via constructor or setter) in OAuth2AuthorizationEndpointFilter, so that a developer can adjust its behavior and create login and consent pages in SPA manner.

Current Behavior
RedirectStrategy is hard-coded in OAuth2AuthorizationEndpointFilter which prevents from overriding its implementation.

Context
Currently, RedirectStrategy when used in mentioned filter sends HTTP 302 response which is automatically handled by browsers and therefore can't be controlled by web apps when requests comes from them, not from user's actions (like form submit, click on link, etc.).
This behavior becomes problematic when we want to make our login and consent page SPA pages, where one of its main advantage is no need to reload the whole page when going to another page, and where the web app should control how it's going to present the information provided by the server.
Even though we can override AuthenticationSuccessHandler and AuthenticationFailureHandler, we can not override redirect to consent page once a resource owner needs to consent access to given client. Besides that, I believe that it often would be more convenient to provide custom implementation just for redirection instead of overriding the whole handlers just to change a small piece that can be achieved much easier via DI.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions