-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add single sign on to sulu admin #3
Add single sign on to sulu admin #3
Conversation
5f740e3
to
7a330fe
Compare
7a330fe
to
627346e
Compare
config/routes/sulu_admin.yaml
Outdated
sulu_admin_single_sign_on: | ||
path: /openid | ||
controller: Symfony\Bundle\FrameworkBundle\Controller\RedirectController::redirectAction | ||
defaults: | ||
route: sulu_admin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be in the security bundle as sulu_security.single_sign_on
https://github.com/sulu/sulu/blob/2.5/src/Sulu/Bundle/SecurityBundle/Resources/config/routing.yml
declare(strict_types=1); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
currently we do not add strict types to the sulu code base as it is a backwards compatibility break:
declare(strict_types=1); |
@@ -159,6 +161,7 @@ export default class Input<T: ?string | ?number> extends React.PureComponent<Inp | |||
ref={inputRef ? this.setInputRef : undefined} | |||
step={step} | |||
type={type} | |||
autoFocus={autoFocus} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add a test for this new property? It looks like it currently not catched by the snapshot tests?
hasSingleSignOn={userStore.hasSingleSignOn()} | ||
hasOnlyPassword={userStore.hasJsonLogin} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This two parameters conflicting to each other I may would go more with a single parameter enum based which maybe look something like this:
mode={userStore.hasSingleSignOn ? (userStore.hasJsonLogin ? 'password_only' : 'username_only') : 'username_password'}
with suggestion from above:
mode={userStore.hasSingleSignOn ? (userStore.loginMethod === 'json_login' ? 'password_only' : 'username_only') : 'username_password'}
@@ -30,6 +31,7 @@ class UserStore { | |||
this.user = undefined; | |||
this.contact = undefined; | |||
this.loginError = false; | |||
this.hasJsonLogin = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hasJsonLogin
is here a little bit confusing. I would go more with loginMethod
🤔
src/Sulu/Bundle/SecurityBundle/Tests/Unit/SingleSignOn/SingleSignOnTokeExtractorTest.php
Outdated
Show resolved
Hide resolved
@@ -163,6 +163,6 @@ public function testAllMetadata(): void | |||
$this->assertCount(2, $metadatas); | |||
$this->assertContainsOnlyInstancesOf(Metadata::class, $metadatas); | |||
$metadata = \reset($metadatas); | |||
$this->assertEquals('Class\Page', $metadata->getClass()); | |||
$this->assertEquals('Class\Page', $metadata ? $metadata->getClass() : null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tis looks unexpected change 🤔
@@ -163,6 +163,6 @@ public function testAllMetadata(): void | |||
$this->assertCount(2, $metadatas); | |||
$this->assertContainsOnlyInstancesOf(Metadata::class, $metadatas); | |||
$metadata = \reset($metadatas); | |||
$this->assertEquals('Class\Page', $metadata->getClass()); | |||
$this->assertEquals('Class\Page', $metadata ? $metadata->getClass() : null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$this->assertEquals('Class\Page', $metadata ? $metadata->getClass() : null); | |
$this->assertEquals('Class\Page', $metadata->getClass()); |
if (userStore.hasJsonLogin) { | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would like to check more for userStore.loginMethod == ''
@@ -106,6 +112,19 @@ class UserStore { | |||
handleLogin = (data: Object) => { | |||
this.setTwoFactorMethods([]); | |||
|
|||
if (data.method === 'redirect' && data.url) { | |||
window.location.href = data.url; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure about doing a redirect here 🤔
ab28ad2
to
e0be626
Compare
e0be626
to
095b60a
Compare
…ignOnTokeExtractorTest.php
ab0d22b
to
7869645
Compare
…equestSubscriber.php
7869645
to
3d48921
Compare
b67b8ac
into
alexander-schranz:feature/signle-sign-on
What's in this PR?
Explain the contents of the PR.
Why?
Which problem does the PR fix? (remove this section if you linked an issue above)
Example Usage
BC Breaks/Deprecations
Describe BC breaks/deprecations here. (remove this section if not needed)
To Do