Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider adding support for requesting refresh_token with offline_access scope #1422

Open
nverbos-godaddy opened this issue Oct 23, 2023 · 4 comments
Labels
type: enhancement A general enhancement

Comments

@nverbos-godaddy
Copy link

nverbos-godaddy commented Oct 23, 2023

Expected Behavior
I want to add support for the offline_access scope as described in the openid-connect rfc. When the offline_access scope is requested, then a refresh token is issued.

Current Behavior
Currently the spring-authorization-server project issues a refresh token when a RegisteredClient contains AuthorizationGrantType.REFRESH_TOKEN. I would like to change this behavior so that the the client must request the offline_access scope in order for a refresh token to be issued.

Context
What is the best way to add support for this? Initially, I tried copying all of the code from OAuth2AuthorizationCodeAuthenticationProvider into my own custom implementation and edited the conditional statement that determines whether or not refresh token should be issued. However, I would like to avoid copying and overriding this for maintainability reasons. Is there a way to customize this for our implementation? Is this a feature that we could add to directly to the spring-authorization-server project?

Related gh-501 gh-1430

@nverbos-godaddy nverbos-godaddy added the type: enhancement A general enhancement label Oct 23, 2023
@nverbos-godaddy nverbos-godaddy changed the title How support requesting refresh_token with the offline_access scope How to support requesting refresh_token with the offline_access scope Oct 26, 2023
@jgrandja
Copy link
Collaborator

@nverbos-godaddy

I would like to change this behavior so that the the client must request the offline_access scope in order for a refresh token to be issued

Can you provide more details on your use case? Why do you need to change this behaviour?

I tried copying all of the code from OAuth2AuthorizationCodeAuthenticationProvider into my own custom implementation and edited the conditional statement that determines whether or not refresh token should be issued

In order to support the offline_access scope within the framework, there are a few other requirements that need to be considered, for example:

MUST ensure that the prompt parameter contains consent

FYI, the prompt parameter is currently not supported either gh-501

@jgrandja jgrandja added the status: waiting-for-feedback We need additional information before we can continue label Oct 27, 2023
@jgrandja jgrandja changed the title How to support requesting refresh_token with the offline_access scope Consider adding support for requesting refresh_token with offline_access scope Oct 27, 2023
@nverbos-godaddy
Copy link
Author

Can you provide more details on your use case? Why do you need to change this behaviour?

We want clients to explicitly request a refresh token, only when it is needed. We also want to display special text to users on the consent page when offline_access is requested. The special text on the consent page will let our users know that this client application will maintain access to their account, even when they are offline and not using the app. When the app does not need a refresh token, then it does not include the offline_access and we do not need to display this special text on the consent page.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Oct 27, 2023
@jgrandja jgrandja removed the status: feedback-provided Feedback has been provided label Oct 31, 2023
@jgrandja
Copy link
Collaborator

@nverbos-godaddy Thanks for the extra details. We will consider adding this enhancement depending on demand, which we assess based on upvotes on this issue.

Is there a way to customize this for our implementation?

Please keep track of gh-1430 as it will likely provide a hook that will allow you to customize and implement offline_access in your application.

@jgrandja
Copy link
Collaborator

jgrandja commented Nov 2, 2023

@nverbos-godaddy Please take a look at gh-1432, specifically this commit as it provides 2 tests that demonstrate how you can customize and implement partial support for offline_access in your application.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

3 participants