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

Create an approved site when using device code flow #821

Open
wants to merge 49 commits into
base: develop
Choose a base branch
from

Conversation

federicaagostini
Copy link
Contributor

@federicaagostini federicaagostini commented Jul 31, 2024

The device code flow did not imply the creation of an approved site when the user give the consent to the client, as the authorization code flow does.
This PR adds an approved site using the same logic as the authorization code flow. Moreover, the scope policy filter has been added here for both the authorization code flow and device code flow.

This required to move (and cleanup) MitreID classes related to the device code flow into IAM.

Copy link
Contributor

@rmiccoli rmiccoli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix only test

@@ -257,6 +261,10 @@ public String approveDevice(@RequestParam("user_code") String userCode,

model.put("approved", true);

Date timeout = null;
approvedSiteService.createApprovedSite(client.getClientId(), auth.getName(), timeout,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem here is the case where there is a scope policy. Since it is evaluated after this step, in the approved sites we will see also the filtered scope - and in fact we see it on the consent page and actually approve it, even though it is then removed from the scope policy filter in the access token.
In general, this mitre code needs to be improved later, but as a start I think it might be fine like this!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem here is the case where there is a scope policy. Since it is evaluated after this step, in the approved sites we will see also the filtered scope - and in fact we see it on the consent page and actually approve it, even though it is then removed from the scope policy filter in the access token. In general, this mitre code needs to be improved later, but as a start I think it might be fine like this!

Scope policy filter added before the device consent page!

since it was always prompting to the consent page, even when already approved.
Looks like the check if "authorizationRequest.isApproved()" is necessary
Copy link

@federicaagostini
Copy link
Contributor Author

From Gabriel Zachmann: the client should only be linked to the user account if it currently is not linked to any user or at least not for public clients.

@enricovianello enricovianello self-assigned this Oct 18, 2024
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: On Review
Development

Successfully merging this pull request may close these issues.

3 participants