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

Fix login redirection if only one 2FA provider is active #10588

Merged
merged 2 commits into from
Aug 9, 2018

Conversation

ChristophWurst
Copy link
Member

Fixes #10500.

get3rdPartyProviders isn't a particularly beautiful method name, but getProvidersButNotTheBackupCodesProviderPlease was a bit too long. Suggestions welcome 😉

Fixes #10500.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
@ChristophWurst ChristophWurst added this to the Nextcloud 14 milestone Aug 8, 2018
@ChristophWurst ChristophWurst self-assigned this Aug 8, 2018
@ChristophWurst ChristophWurst added this to SELECTED in Christoph's Tasks via automation Aug 8, 2018
@ChristophWurst ChristophWurst moved this from SELECTED to TO REVIEW (max 4 PRs) in Christoph's Tasks Aug 8, 2018
@rullzer rullzer mentioned this pull request Aug 8, 2018
58 tasks
@ChristophWurst ChristophWurst requested review from rullzer, nickvergessen and blizzz and removed request for rullzer August 8, 2018 13:43
@@ -25,6 +25,8 @@

namespace OC\Authentication\TwoFactorAuth;

use function array_filter;
use OCA\TwoFactorBackupCodes\Provider\BackupCodesProvider;
Copy link
Member

Choose a reason for hiding this comment

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

🤔 mixing in App space into core space?

Copy link
Member

Choose a reason for hiding this comment

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

its a force enabled shipped app, so should be fine

Copy link
Member

Choose a reason for hiding this comment

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

True, it's not a clean approach though. I could be moved to public space, if it makes sense, or private space otherwise. Missing private class in app namespace is also not nice, but better than vice versa. It's tech debt we stack. There already 2, 3 corners like that.

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree that it's not the cleanest approach.

A possible solution would be adding something like a IProvidesBackupCodes extends IProvider (tagging interface) to OCP. But we'd then have to support that for x years and it would mean someone could be tempted to use that interface as well.
There's also the possibility to have this interface in OC, but then the app isn't clean anymore because it uses core private API …

A agree with @nickvergessen here, having the app namespace of an always-enabled app here is fine IMO.

Copy link
Member

Choose a reason for hiding this comment

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

This anyways is something we won't change so close before a release. I vote to just get it in and discuss in a new issue for 15. 😉

Copy link
Member Author

Choose a reason for hiding this comment

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

Another approach (but def. no solution) would be to just check the ID of the provider. But then you still kind of depend on this specific implementation, it just gets a bit blurred.

I vote for keeping it as it is now. We can always improve later on 👍

Copy link
Member

Choose a reason for hiding this comment

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

🚢

@blizzz
Copy link
Member

blizzz commented Aug 8, 2018

😛

  • getButBackupCodeProviders
  • attribute something else to others, getPrimaryProviders/getEssentialProvider, but it sucks as well since the namings are made out of thin air, too.

I like the Please though, we should add it to all method names. It is much more polite!

@ChristophWurst
Copy link
Member Author

getPrimaryProviders

I like that!

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* @return IProvider[]
*/
public function getPrimaryProviders(): array {
return array_filter($this->providers, function(IProvider $provider) {
Copy link
Member

Choose a reason for hiding this comment

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

Can we be 100% sure that providers is always properly set at this point? Extra check?

Copy link
Member Author

Choose a reason for hiding this comment

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

What do you mean?

Copy link
Member

Choose a reason for hiding this comment

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

Aaah never mind. Wrong file in mind.

@blizzz blizzz added 4. to release Ready to be released and/or waiting for tests to finish and removed 3. to review Waiting for reviews labels Aug 9, 2018
@rullzer rullzer mentioned this pull request Aug 9, 2018
45 tasks
@rullzer rullzer merged commit 0757c52 into master Aug 9, 2018
Christoph's Tasks automation moved this from TO REVIEW (max 4 PRs) to DONE Aug 9, 2018
@rullzer rullzer deleted the fix/single-2fa-provider-login-redirect branch August 9, 2018 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4. to release Ready to be released and/or waiting for tests to finish bug regression
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

4 participants