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] CMSSecurity doesn't have Authenticators assigned. #7007

Merged

Conversation

Firesphere
Copy link
Contributor

Switching to Security::singleton()->getApplicableAuthenticators() and Security::singleton()->getAuthenticators() fixes this and makes it more robust.

Copy link
Contributor

@tractorcow tractorcow left a comment

Choose a reason for hiding this comment

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

You need to fix this by correctly injecting CMSSecurity with it's own YML config. Doing it this way is going to be disastrous.

@Firesphere
Copy link
Contributor Author

Agreed, good point, didn't think of it that way, gimme a few :)

@Firesphere Firesphere force-pushed the pulls/getApplicableAuthenticators branch from 831620a to 3fe837d Compare June 10, 2017 02:48
@Firesphere
Copy link
Contributor Author

Travis is green again, so, here ya go. This should be more robust, more logical with each Controller having it's own Authenticator(s) assigned where possible.

@@ -31,5 +31,8 @@ SilverStripe\Core\Injector\Injector:
properties:
Authenticators:
default: %$SilverStripe\Security\MemberAuthenticator\MemberAuthenticator
SilverStripe\Security\CMSSecurity:
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to go ahead and just have one-authenticator per Security class?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For the defaults, I think so. Because we don't want the standard Security to have the CMS login option, as it is unneeded in this case.

We can have multiple per Security-class easily, I can confirm this works (though my tests are failing because it's actual two step now, instead of "try in a single step")

{
// Disable shortcut
if (!static::config()->get('reauth_enabled')) {
return false;
}

return count(Security::singleton()->getApplicableAuthenticators(Authenticator::CMS_LOGIN)) > 0;
return count($this->getApplicableAuthenticators(Authenticator::CMS_LOGIN)) > 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

Might need to talk about this on Monday, but I think the CMS_LOGIN key is probably redundant. We probably over-engineered the authenticator assignment system in the initial implementation.

@tractorcow tractorcow merged commit 0dcfa5f into silverstripe:master Jun 11, 2017
@tractorcow
Copy link
Contributor

Will merge for now since it fixes the bug. We can discuss API later. :)

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

Successfully merging this pull request may close these issues.

None yet

2 participants