Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[DX] Added a logout link in the security panel of the web debug toolbar #14378

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

Closed
wants to merge 6 commits into from

Conversation

javiereguiluz
Copy link
Member

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets -
License MIT
Doc PR -

While developing applications, it's common to login/logout users continuously to test security features. I usually type /logout in the URL, but this is boring and, depending on the application, not always works.

This PR adds a small Logout link in the security panel when you are logged in the application:

logged

Anonymous users won't see anything:

anonymous

@Green-Cat
Copy link

👍

@fabpot
Copy link
Member

fabpot commented Apr 16, 2015

I like this idea as well, especially as the implementation is so easy now :) Can you try to make the link more prominent? I did not see it at first and had to closely look to find it on the screenshot.

@stof
Copy link
Member

stof commented Apr 16, 2015

I like this idea too

@stof
Copy link
Member

stof commented Apr 16, 2015

@fabpot should the 2.8 branch become the default branch of all Symfony repos now that 2.7 is feature-frozen so that people sending PR open them against 2.8 by default ?

@fabpot
Copy link
Member

fabpot commented Apr 16, 2015

@stof I like to way for the stable release to switch the default branch (like for Silex by the way :)).

@javiereguiluz
Copy link
Member Author

Here are some quick proposals to make the link stand out (without adding an icon):

proposal_1

proposal_2

proposal_3

proposal_4

@fabpot
Copy link
Member

fabpot commented Apr 16, 2015

Option 1 or 2 would do for me.

@stof
Copy link
Member

stof commented Apr 16, 2015

@fabpot this would mean that people not being careful will send us all PRs to 2.7, while only bugfixes should go there. It would be better to have them based on the right version IMO (even though we can switch the target with gh, it is better if the Travis builds are running on the right version, and it also means less chance for conflicts when rebasing)

@javiereguiluz I vote for the option 2 (with the button style)

@aitboudad
Copy link
Contributor

👍 for the second option.

@GromNaN
Copy link
Member

GromNaN commented Apr 16, 2015

I'd prefer both 1 + 2 = the button with the cross.

@javiereguiluz
Copy link
Member Author

I've combined the 1 and 2 options. Here it is in action:

logout_button

@Tobion
Copy link
Contributor

Tobion commented Apr 16, 2015

Do we have buttons anywhere else in the panel?

@Green-Cat
Copy link

Looks great 👍

@javiereguiluz
Copy link
Member Author

@Tobion I'd say that we don't have any button in any other panel. And I agree that we should avoid this inconsistency.

@xabbuh
Copy link
Member

xabbuh commented Apr 16, 2015

I like option 1 and 2 as well as the combined one.

@Tobion I'd say that we don't have any button in any other panel. And I agree that we should avoid this inconsistency.

We didn't have something that would justify for a button UI element before, did we? So introducing this now doesn't look wrong to me.

@Tobion
Copy link
Contributor

Tobion commented Apr 16, 2015

Don't care if its a button or a link but IMO it should be next to authenticated: yes as in example 4 as these belong together. Below the other data, it looks misplaced as it does not fit into the "key: value" pair.

@stloyd
Copy link
Contributor

stloyd commented Apr 17, 2015

IMO nice would be to have option if we detect role ROLE_PREVIOUS_ADMIN or something similar to be able to easily log back as "admin".

@timglabisch
Copy link

👍 awesome, i like the link next to the 'Authenticated'. if the user has the role ROLE_PREVIOUS_ADMIN we could replace the logout button with something like "logout(link) to old_user"

@@ -50,6 +50,7 @@ public function collect(Request $request, Response $response, \Exception $except
'enabled' => false,
'authenticated' => false,
'token_class' => null,
'provider_key' => null,
Copy link
Contributor

Choose a reason for hiding this comment

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

why not firewall key? sounds more natural

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. However, the method in the token is called getProviderKey(). That's why I prefer to be consistent here.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok sounds cool then, now i agree 👍

Copy link
Member

Choose a reason for hiding this comment

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

@cordoval multiple firewalls can share the same authentication provider (using the context setting in the config). So the provider key may not be the firewall name.

@ajgarlag
Copy link
Contributor

I think the logout button should be next to Authenticated: Yes, and if the user has the role ROLE_PREVIOUS_ADMIN a new button Exit must appear next to Logged in as: foobar

@raziel057
Copy link
Contributor

Here a proposal with button next to the Authenticated: Yes:

sample_1

And an other one with le link aligned with values:

sample_2

@dosten
Copy link
Contributor

dosten commented Apr 18, 2015

I like @raziel057 proposal. 👍

@hhamon
Copy link
Contributor

hhamon commented Apr 18, 2015

Nice one @javiereguiluz !

@javiereguiluz
Copy link
Member Author

@raziel057 the problem I see with your first proposal is that the button looks like a badge (obviously my own button proposal also suffer this problem, but it's less problematic because it's not displayed next to the badge).

Regarding your second proposal, I like that the link looks like a real link, but most people here don't want the link to stand out that much. Besides, I'm not sure about the result of aligning the link with the values.

@javiereguiluz
Copy link
Member Author

I've committed a new proposal where a new Actions section is created in the security panel:

logout_button

Considering that in #14458 we might add a new feature to switch the user, this Actions section could hold that button too:

actions_button

@dupuchba
Copy link
Contributor

👍 great job :-)

@ajgarlag
Copy link
Contributor

👍 great!
I think that the Switch user button should be renamed to something like Exit when the token has the ROLE_PREVIOUS_ADMIN role.

@dosten
Copy link
Contributor

dosten commented Apr 24, 2015

@javiereguiluz how can i select the user to impersonate?

@dosten
Copy link
Contributor

dosten commented Apr 24, 2015

btw, i like the buttons 👍

@fabpot
Copy link
Member

fabpot commented Aug 1, 2015

@javiereguiluz Can you finish this one? I'd like to merge it ASAP.

@javiereguiluz
Copy link
Member Author

I've finished and rebased this PR. Thanks to the new toolbar style, there is no need to discuss about displaying this feature as a link or as a button. It "must" be a link to match the new style:

logout_link

@Green-Cat
Copy link

👍

1 similar comment
@stof
Copy link
Member

stof commented Aug 1, 2015

👍

@fabpot
Copy link
Member

fabpot commented Sep 14, 2015

Thank you @javiereguiluz.

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

Successfully merging this pull request may close these issues.