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

Allow using an app token to login with v2 flow auth #29531

Merged
merged 2 commits into from
Dec 30, 2021

Conversation

juliushaertl
Copy link
Member

@juliushaertl juliushaertl commented Nov 3, 2021

The possibility to authenticate using an existing app token was only present in v1 flow auth, however there are use cases for it with v2 as well, e.g. when SAML is setup as primary login method but there are some local users that might need to login with the desktop client.

This is the button that this is adding for v2:

image

@juliushaertl juliushaertl force-pushed the bugfix/noid/flow-auth-v2-apptoken branch from f12a745 to 558f6e0 Compare November 3, 2021 10:25
@juliushaertl juliushaertl added 3. to review Waiting for reviews bug labels Nov 3, 2021
@juliushaertl juliushaertl requested review from tobiasKaminsky, skjnldsv, a team, ArtificialOwl, CarlSchwan and blizzz and removed request for a team November 3, 2021 10:28
@juliushaertl juliushaertl added this to the Nextcloud 23 milestone Nov 3, 2021
/**
* @PublicPage
*/
public function apptokenRedirect(string $stateToken, string $user, string $password) {
Copy link
Member

Choose a reason for hiding this comment

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

this is identical to the same method of ClientFlowLoginController.php, innit? Maybe moving this into a trait to avoid duplication?

Copy link
Member Author

Choose a reason for hiding this comment

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

The only difference there is the method call to validate the sate token which is isValidStateToken vs isValidToken, but we can adjust those of course. Moving that into a trait makes sense 👍

Copy link
Member Author

Choose a reason for hiding this comment

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

OK, so it requires some more restructuring and actually going for a base controller class seems more suitable, though in order to keep this a smaller backportable change I'd rather do this in a follow up for master only. What do you think? I'd push the refactoring then to a separate PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

OK, so it requires some more restructuring and actually going for a base controller class seems more suitable, though in order to keep this a smaller backportable change I'd rather do this in a follow up for master only. What do you think? I'd push the refactoring then to a separate PR.

Sane assessment, I agree with you.

Copy link
Member

@blizzz blizzz left a comment

Choose a reason for hiding this comment

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

code looks good, didn't test

@skjnldsv skjnldsv mentioned this pull request Nov 3, 2021
19 tasks
@blizzz blizzz mentioned this pull request Nov 3, 2021
18 tasks
@juliushaertl
Copy link
Member Author

Needs some further work since when using it in the client we'll need to update the poll result on v2 instead of performing the redirect

@juliushaertl juliushaertl added 2. developing Work in progress and removed 3. to review Waiting for reviews labels Nov 5, 2021
@juliushaertl juliushaertl force-pushed the bugfix/noid/flow-auth-v2-apptoken branch from 558f6e0 to ced51d7 Compare November 5, 2021 08:18
@skjnldsv skjnldsv mentioned this pull request Nov 8, 2021
23 tasks
@jancborchardt
Copy link
Member

Design-wise, instead of that separate section, what would be a bit more obvious is the text/link "Alternative login using app token" in the same big container, below the big "Log in" button, centered, and underlined.

@blizzz blizzz modified the milestones: Nextcloud 23, Nextcloud 24 Nov 30, 2021
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
@juliushaertl juliushaertl force-pushed the bugfix/noid/flow-auth-v2-apptoken branch from ced51d7 to cdda25a Compare December 3, 2021 07:44
@juliushaertl
Copy link
Member Author

@jancborchardt Updated:

image

@juliushaertl juliushaertl added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Dec 3, 2021
@skjnldsv skjnldsv merged commit bfaeb6a into master Dec 30, 2021
@skjnldsv skjnldsv deleted the bugfix/noid/flow-auth-v2-apptoken branch December 30, 2021 07:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants