Skip to content

Enable forward request (like ForwardSuccessHandler) in OAuth2AuthorizationCodeGrantFilter #11069

Open
@jjfraney-cg

Description

@jjfraney-cg

Expected Behavior

The developer can override the redirect strategy in configuration to for OAuth2AuthorizationCodeGrantFilter to issue request forward into the existing web context (i.e., a relative path) at the end of authentication.

Current Behavior

Current behavior enables only redirects. The redirect strategy in OAuth2AuthorizationCodeGrantFilter cannot be overridden by configuration.

The active request is the authorization server's callback after a successful grant. Within the context of that request, this filter will send a request to the token URI to obtain an access token. After completion, the filter responds with a redirect to the authorization server. The target of the redirect is the original incoming request that triggered the authentication.

Context

How has this issue affected you?
I have a client whose custom authorization server does not respond to this last redirect. My application doesn't get the callback to the business level request.

What are you trying to accomplish?

My client is a SmartOnFhir implementation. I'm implementing a 'launch' use case. To initiate a launch, the SmartOnFhir implementation sends an opaque token as a query parameter to an endpoint in my application. I'm using the oauth2client configuration. In my controller, I call OAuth2AuthorizedClientProvider.authenticate to start the authentication flow. SmartOnFhir will send confidential data within the access token after successful authentication. My business logic has to obtain and decode the access token. This is why I require a callup to my controller. If the redirect worked, things would work.

What other alternatives have you considered?
I'm using the oauth2client configuration. Maybe I should try the oauth2login configuration. Using oauth2login, I believe I can easily use the ForwardAuthenticationSuccessHandler without a problem. I'm not wild about this approach: I'm not that interested in user data in my application, and I have to figure out how to disable the login page (if necessary) because there is really only one authorization provider by the requirement of SmartOnFhir.

Are you aware of any workarounds?
No, only to copy the OAuth2AuthorizationCodeGrantFilter into my project, make a change within it to support forward, and add it to the security filter change before the existing original filter.

Metadata

Metadata

Assignees

Labels

in: oauth2An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose)status: ideal-for-contributionAn issue that we actively are looking for someone to help us withtype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions