Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Security][SecurityBundle] Enhance automatic logout url generation#20516

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 1 commit intosymfony:masterfromogizanagi:security/collector_logout_url
Mar 22, 2017
Merged

[Security][SecurityBundle] Enhance automatic logout url generation#20516

fabpot merged 1 commit intosymfony:masterfromogizanagi:security/collector_logout_url
Mar 22, 2017

Conversation

@ogizanagi
Copy link
Contributor

@ogizanagiogizanagi commentedNov 14, 2016
edited
Loading

QA
Branch?master
Bug fix?no
New feature?yes
BC breaks?no
Deprecations?yes
Tests pass?yes
Fixed ticketsN/A
LicenseMIT
Doc PRN/A

This should help whenever:

Behavior:

When not providing the firewall key:

  • Try to find the key from the token (unless it's an anonymous token)
  • If found, try to get the listener from the key. If the listener is found, stop there.
  • Try from the injected firewall key. If the listener is found, stop there.
  • Try from the injected firewall context. If the listener is found, stop there.

The behavior remains unchanged when providing explicitly the firewall key. No fallback.

chalasr, ro0NL, yceruto, and tjaari reacted with thumbs up emoji
@chalasr
Copy link
Member

What about doing it inLogoutUrlGenerator directly?

@ogizanagi
Copy link
ContributorAuthor

ogizanagi commentedNov 14, 2016
edited
Loading

@chalasr : I'd like to. But theFirewallConfig is available in theSecurityBundle only (whereas as theLogoutUrlGenerator is in theSecurity component). :/

(we can provide an implementation in theSecurityBundle, but is worth it ?)

@ogizanagi
Copy link
ContributorAuthor

ogizanagi commentedNov 14, 2016
edited
Loading

Note that providing an implementation in theSecurityBundle will automatically allow theSymfony\Bridge\Twig\Extension\LogoutUrlExtension andSymfony\Bundle\SecurityBundle\Templating\Helper\LogoutUrlHelper to benefit from this. WDYT?

@ogizanagi
Copy link
ContributorAuthor

ogizanagi commentedNov 14, 2016
edited
Loading

Let's get feedbacks about an implementation in theSecurityBundle thanks toafdc33b.

useSymfony\Component\Security\Http\FirewallMapInterface;
useSymfony\Component\Security\Http\Logout\LogoutUrlGeneratorasBaseLogoutUrlGenerator;

class LogoutUrlGeneratorextends BaseLogoutUrlGenerator
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Should we provide an interface and use decoration instead? IMHO it's not especially better here, but WDYT?

{
parent::__construct($requestStack,$router,$tokenStorage);

$this->requestStack =$requestStack;
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

We could open the visibility instead if preferred, but I doubt it is.


publicfunctiongetLogoutPath($key =null)
{
returnparent::getLogoutPath($key ===null ?$key =$this->extractKeyFromFirewallConfig() :null);
Copy link
Contributor

Choose a reason for hiding this comment

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

Should benull === $key ? $this->extractKeyFromFirewallConfig() : $key right?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Absolutely... Good catch 😅


publicfunctiongetLogoutPath($key =null)
{
returnparent::getLogoutPath($key !==null ?$key :$this->extractKeyFromFirewallConfig());
Copy link
Contributor

Choose a reason for hiding this comment

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

Yoda :p

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Weak my attention is this evening. :)

HeahDude reacted with laugh emoji
@chalasr
Copy link
Member

Imho it is worth it 👍

@ro0NL
Copy link
Contributor

ro0NL commentedNov 14, 2016
edited
Loading

Shouldnt we technically still checkToken::getProviderKey() first, if$key is null?

What aboutsetDefaultProviderKey on the component side? And set it using theFirewallConfig?

@ogizanagi
Copy link
ContributorAuthor

ogizanagi commentedNov 14, 2016
edited
Loading

What about setDefaultProviderKey on the component side? And set it using the FirewallConfig?

That would made theSecurity component'sLogourUrlGenerator stateful (you'll have to set it withsetDefaultProviderKey for every request, and it'll not be a default at all, just the value retrieved from the firewall config for current request).

Shouldnt we technically still check Token::getProviderKey() first, if $key is null?

Why? 😕
Token::getProviderKey() does return the firewall name. Using the firewall config is simply the safest way to get it but cannot replaceToken::getProviderKey() in the component because it's only available in the bundle.

@chalasr
Copy link
Member

chalasr commentedNov 14, 2016
edited
Loading

Shouldnt we technically still check Token::getProviderKey() first, if $key is null?

Since the parent methods are called, the token storagewill be used if$key is null, right?

About thesetProviderKey, Imho it's good to have the bundle as an extension of the component, rather than changing the component.

@ro0NL
Copy link
Contributor

ro0NL commentedNov 14, 2016
edited
Loading

Yeah.. but in case of null we passextractKeyFromFirewallConfig(). Ie.FirewallConfig::getName is preferred overToken::getProviderKey(). Im not sure that's correct.

Opposed to

try {returnparent::getLogoutPath($key);}catch (\InvalidArgumentException$e) {if (null ===$key &&null !==$defaultKey =$this->extractKeyFromFirewallConfig()) {returnparent::getLogoutPath($defaultKey);   }throw$e;}

@ogizanagi
Copy link
ContributorAuthor

FirewallConfig::getName is preferred over Token::getProviderKey(). Im not sure that's correct.

Why?FirewallConfig::getName is strictly equivalent toToken::getProviderKey(). Unless you get a token without the current firewall name as provider key (which mean it has failed to implementgetProviderKey or there is an issue in the application/security listener). Or am I missing something?

@ro0NL
Copy link
Contributor

Again not sure :) just imagining one could actually be authenticated against a different firewall (ie. identified by its current token) other then the current firewall (ie. identified by request?)

@ogizanagi
Copy link
ContributorAuthor

Correction:FirewallConfig::getName andToken::getProviderKey() are not strictly equivalent in case two firewalls share the same context. The firewall which has created the token will be set in the token provider key.

@ogizanagi
Copy link
ContributorAuthor

ogizanagi commentedNov 14, 2016
edited
Loading

Then I'm not confident about this PR anymore.
With the current code, the logout listener might have been defined on only one firewall of many sharing the same context. Thus, the current firewall may not allow to generate the logout url.

Even by changing the code by:

try {returnparent::getLogoutPath($key);}catch (\InvalidArgumentException$e) {if (null ===$key &&null !==$defaultKey =$this->extractKeyFromFirewallConfig()) {returnparent::getLogoutPath($defaultKey);   }throw$e;}

as you've suggested@ro0NL. The issue is that it's probably wrong to suggest to logout using the wrong logout url, even in last resort. 😕 (and you may still not find the logout listener)

@ro0NL
Copy link
Contributor

ro0NL commentedNov 14, 2016
edited
Loading

You should return a key only ifin_array('logout', $firewallConfig->getListeners(), true) :)

@ogizanagi
Copy link
ContributorAuthor

ogizanagi commentedNov 14, 2016
edited
Loading

You should return a key only if in_array('logout', $firewallConfig->getListeners(), true) :)

The originalLogoutUrlGenerator will already throw an exception if the logout listener does not exists for this firewall.

That's not what I meant by:

you may still not find the logout listener

I meant you may still be behind a firewall on which is not defined thelogout listener, so anyyway you won't get the link in the profiler.

Anyway, I think I'm closing this one, because it brings more issues than it solves. It's not even an issue I encountered, but I thought it could be a good usage of the newFirewallConfig (apparently it was not 😄 ). Let's implementsgetProviderKey in your security tokens guys. :)

Thank you for your time. :)

@ogizanagiogizanagi deleted the security/collector_logout_url branchNovember 14, 2016 22:10
@ro0NL
Copy link
Contributor

ro0NL commentedNov 15, 2016
edited
Loading

@ogizanagi im really considering this a DX improvement.. and we were almost there, right?

What's wrong with the exception in case you're passing the key from firewall config and it has no listeners? In user-land if someone calls this, and there is absolutely no available url it already crashes anyway.

The only difference would be (in case of null) we get

No LogoutListener found for firewall key "<key-from-firewall-config>".

Instead of

Unable to find the current firewall LogoutListener, please provide the provider key manually.

If we add aprotected getDefaultProviderKey() to the base logout url generator we can avoid the try/catch approach.

@ogizanagiogizanagi restored the security/collector_logout_url branchNovember 15, 2016 21:42
@ogizanagi
Copy link
ContributorAuthor

ogizanagi commentedNov 15, 2016
edited
Loading

I'm really considering this a DX improvement.. and we were almost there, right?
What's wrong with the exception in case you're passing the key from firewall config and it has no listeners?

Nothing wrong with the exception. What would appear to be "wrong" to me is to generate the logout url with the wrong firewall and logout listener (not the one which generated the token). I mean...it's not fundamentally wrong: AFAIK, given two firewalls sharing a same context, with only one defining the logout listener, the logout url is actually available for both firewalls and will invalidate the token, doesn't matter which firewall created it.

But is this PR really worth it, considering it won't give you 100% chances to get the logout url (as the logout listener might be on another firewall than the current one)? (you don't have 100% chances currently neither of course, but the implementation is sufficient to me)

I'm reopening this in order to get more feedbacks about it, but I don't expect much actually 😕

If we add a protected getDefaultProviderKey() to the base logout url generator we can avoid the try/catch approach.

Still not convinced about this because it'll make theLogoutUrlGenerator state tied to the request (theTranslator for instance is also tied to the request, though. So a request listener setting the current firewall key in the originalLogoutUrlGenerator could be considered actually).

@ogizanagiogizanagi reopened thisNov 15, 2016
@chalasr
Copy link
Member

is this PR really worth it, considering it won't give you 100% chances to get the logout url

Sure, but still more chances than if kept as is so, for what it costs, I would still say yes.

Since the token's provider key would be the better alternative if provided (right?), shouldn't it be indeed checked at first?

/**
* @author Maxime Steinhausser <maxime.steinhausser@gmail.com>
*/
class LogoutUrlGeneratorextends BaseLogoutUrlGenerator
Copy link
Member

Choose a reason for hiding this comment

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

Couldn't this be final?

Copy link
ContributorAuthor

@ogizanagiogizanagiNov 15, 2016
edited
Loading

Choose a reason for hiding this comment

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

Could be. Or could be removed entirely in favor of a request listener injecting the current firewall key in the originalUrlLogoutListener as suggested by@ro0NL with theLogoutUrlGenerator::setDefaultProviderKey method.

Copy link
Member

Choose a reason for hiding this comment

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

Imho decorating it is fine.

@ogizanagi
Copy link
ContributorAuthor

ogizanagi commentedNov 15, 2016
edited
Loading

Since the token's provider key would be the better alternative if provided (right?), shouldn't it be indeed checked at first?

It won't give more chances, but is still more accurate yes. I agree with that and@ro0NL's suggestion about checking it first, and then fallback to the current firewall key if no logout listener is found.

@chalasr
Copy link
Member

Status: needs work

:)

@ogizanagi
Copy link
ContributorAuthor

ogizanagi commentedNov 19, 2016
edited
Loading

I've updated the PR by adding a new commit as a POC for using firewall contexts and a listener setting the current firewall name + context per request (no moreFirewallConfig usage, so no moreLogoutUrlGenerator implementation in the bundle).

When not providing the firewall key:

  1. Try to find the key from the token (unless it's an anonymous token)
  2. If found, try to get the listener from the key. If the listener is found, stop there.
  3. Try from the injected firewall key. If the listener is found, stop there.
  4. Try from the injected firewall context. If the listener is found, stop there.

The behavior remains unchanged when providing explicitly the firewall key. No fallback.

This can be tested with the following changes in the demo app and by commenting/decommenting the logout listener on the admin firewall.

diff --git a/app/Resources/views/base.html.twig b/app/Resources/views/base.html.twigindex c20f749..2e0c5a8 100644--- a/app/Resources/views/base.html.twig+++ b/app/Resources/views/base.html.twig@@ -61,7 +61,7 @@                                 {% if app.user %}                                     <li>-                                        <a href="{{ path('security_logout') }}">+                                        <a href="{{ logout_url() }}">                                             <i aria-hidden="true"></i> {{ 'menu.logout'|trans }}                                         </a>                                     </li>diff --git a/app/config/security.yml b/app/config/security.ymlindex cc31cfb..cfda7ee 100644--- a/app/config/security.yml+++ b/app/config/security.yml@@ -13,33 +13,27 @@ security:     # http://symfony.com/doc/current/book/security.html#firewalls-authentication     firewalls:-        secured_area:-            # this firewall applies to all URLs-            pattern: ^/--            # but the firewall does not require login on every page-            # denying access is done in access_control or in your controllers+        admin:+            pattern: ^/(%app_locales%)/admin             anonymous: true--            # This allows the user to login by submitting a username and password-            # Reference: http://symfony.com/doc/current/cookbook/security/form_login_setup.html             form_login:-                # The route name that the login form submits to                 check_path: security_login-                # The name of the route where the login form lives-                # When the user tries to access a protected page, they are redirected here                 login_path: security_login-                # Secure the login form against CSRF-                # Reference: http://symfony.com/doc/current/cookbook/security/csrf_in_login_form.html                 csrf_token_generator: security.csrf.token_manager-             logout:-                # The route name the user can go to in order to logout+                path: security_logout_admin+                target: security_login+            context: foo+        secured_area:+            pattern: ^/+            anonymous: true+            logout:                 path: security_logout-                # The name of the route to redirect to after logging out                 target: homepage+            context: foo     access_control:         # this is a catch-all for the admin area         # additional security lives in the controllers+        - { path: '^/(%app_locales%)/admin/login', roles: IS_AUTHENTICATED_ANONYMOUSLY }         - { path: '^/(%app_locales%)/admin', roles: ROLE_ADMIN }diff --git a/src/AppBundle/Controller/SecurityController.php b/src/AppBundle/Controller/SecurityController.phpindex fa99392..3b79931 100644--- a/src/AppBundle/Controller/SecurityController.php+++ b/src/AppBundle/Controller/SecurityController.php@@ -24,7 +24,7 @@ use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; class SecurityController extends Controller {     /**-     * @Route("/login", name="security_login")+     * @Route("/admin/login", name="security_login")      */     public function loginAction()     {@@ -45,6 +45,7 @@ class SecurityController extends Controller      * and handle the logout automatically. See logout in app/config/security.yml      *      * @Route("/logout", name="security_logout")+     * @Route("/admin_logout", name="security_logout_admin")      */     public function logoutAction()     {

Status: Needs Review

If you still think it makes sense, let me know what could possibly be improved and what should be reconsidered regarding our previous suggested solutions.

@ogizanagiogizanagi changed the title[SecurityBundle] Use FirewallConfig for logout url generation[Security][SecurityBundle] Enhance automatic logout url generationNov 19, 2016
Copy link
Contributor

@ro0NLro0NL left a comment

Choose a reason for hiding this comment

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

👍 for this approach.

}

if (null ===$key) {
if (null ===$key &&null ===$this->currentFirewall) {
Copy link
Contributor

Choose a reason for hiding this comment

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

What about moving this check togetListener?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

I prefer not: I'd rather keep the$key argument mandatory for callinggetListener()

Copy link
Contributor

Choose a reason for hiding this comment

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

But it's not :) we still passnull if a current firewall is present.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

@ro0NL : Yup. Just saw that and was doing the change 😅

}

/**
* @param string $key The firewall key
Copy link
Contributor

Choose a reason for hiding this comment

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

string|null, we can infer$tryFromCurrent by doingnull === $key here as well.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

No we can't in case the$key was extracted from the token. It'll not be null, but we still like to guess if the listener is not found.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

I've refactored everything in order to hide the whole listener extraction logic insidegetListener so this argument isn't necessary anymore.

*/
privatefunctiongetListener($key,$tryFromCurrent =false)
{
if (array_key_exists($key,$this->listeners)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can beisset

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Could be. That's only legacy code unchanged.

// Fetch from injected current firewall information, if possible
list($key,$context) =$this->currentFirewall;

if (array_key_exists($key,$this->listeners)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same,isset.

return$this->doGenerateLogoutUrl($referenceType,$logoutPath,$csrfTokenId,$csrfParameter,$csrfTokenManager);
}

privatefunctiondoGenerateLogoutUrl($referenceType,$logoutPath,$csrfTokenId,$csrfParameter,CsrfTokenManagerInterface$csrfTokenManager =null)
Copy link
Contributor

Choose a reason for hiding this comment

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

Really needed?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Not really needed, but helps to unclutter up previous method.

ro0NL reacted with thumbs up emoji
}

if (null !==$context) {
return$this->getListenerForContext($context);
Copy link
Contributor

Choose a reason for hiding this comment

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

Imo. we can write outgetListenerForContext here.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

👍

{
$guess =$key ===null;

// Fetch the current provider key from token, if possible
Copy link
Contributor

@ro0NLro0NLNov 20, 2016
edited
Loading

Choose a reason for hiding this comment

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

Lets try to avoid$guess.

null === $key && ..

$key =$token->getProviderKey();
}
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Can (then) be removed.

if (null ===$key &&null ===$this->currentFirewall) {
thrownew \InvalidArgumentException('Unable to find the current firewall LogoutListener, please provide the provider key manually.');
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Can (then) be removed.

if (isset($this->listeners[$key])) {
return$this->listeners[$key];
}

Copy link
Contributor

Choose a reason for hiding this comment

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

if (null === $key && null !== $this->currentFirewall) {

*
* @return string The logout URL
*
* @throws \InvalidArgumentException if no LogoutListener is registered for the key or the key could not be found automatically.
Copy link
Contributor

Choose a reason for hiding this comment

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

string

}

/**
* @param string $key The current firewall key
Copy link
Contributor

Choose a reason for hiding this comment

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

string|null

* @param string $csrfTokenId The ID of the CSRF token
* @param string $csrfParameter The CSRF token parameter name
* @param CsrfTokenManagerInterface $csrfTokenManager A CsrfTokenManagerInterface instance
* @param string $context The listener context
Copy link
Contributor

Choose a reason for hiding this comment

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

string|null

}
}
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Should (then) be

if (null ===$key) {// throw Unable to find the current firewall LogoutListener, please provide the provider key manually.}else {// throw No LogoutListener found for firewall key "%s".}

@ogizanagi
Copy link
ContributorAuthor

ogizanagi commentedNov 20, 2016
edited
Loading

@ro0NL : I thinkb29b004?w=1 should cover your expectations for your last review (However it's hard to follow small comments for such changes while ensuring it does not change any behavior (tests will of course be required if we want to merge this). Could you provide a full diff next time instead?).

Anyway, thank you for your review. ;)

ro0NL reacted with thumbs up emoji

@ro0NL
Copy link
Contributor

Ship it.

publicfunctiononKernelFinishRequest(FinishRequestEvent$event)
{
if ($event->isMasterRequest()) {
$this->logoutUrlGenerator->setCurrentFirewall(null);
Copy link
Contributor

@ro0NLro0NLNov 20, 2016
edited
Loading

Choose a reason for hiding this comment

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

This setsarray(null, null) though, letsallow it and unset$currentFirewall in that case (yes, ignoring$context if so.. perhaps throw ).

ogizanagi reacted with thumbs up emoji
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Simplified by0c5628c?w=1

Copy link
Contributor

Choose a reason for hiding this comment

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

0bb5dd7 was good? Now$currentFirewall can be null, an array, an array with nulls. Which isnt checked for accordingly (seelist and the upcomingisset (where$key can be null again ^^).

Copy link
ContributorAuthor

@ogizanagiogizanagiNov 20, 2016
edited
Loading

Choose a reason for hiding this comment

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

IMHO, it doesn't matter much how the current firewall informations are stored internally (in this case, it aims to simplify the code. The multiple possible values aren't an issue, as we're expecting to use it withlist), andisset($this->listeners[$key]) wouldn't be an issue even with$key as null.

Copy link
Contributor

@ro0NLro0NLNov 20, 2016
edited
Loading

Choose a reason for hiding this comment

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

Ok,list($a, $b) = null doesnt crashes :) Fair enough. I'd prefer the previous commit as it was explicit.

Just saying we run code that's not actually needed. And we implicitly allowsetCurrentFirewall(null, 'context') which im not sure is intended / should be allowed.

@fabpot
Copy link
Member

@ogizanagi What's the status of this PR?

@ogizanagi
Copy link
ContributorAuthor

ogizanagi commentedMar 1, 2017
edited
Loading

@fabpot: Squashed, rebased on master and tested back on the symfony demo using the patch mentioned in#20516 (comment). Tests are green on my side.Waiting for Travis. Failures unrelated.

No more changes planned on my side. It actually enhances the situation for cases mentioned in the PR description and should always find and use the proper logout listener across contexts (as soon as there is one of course).

So I think it's ready for the final review and validating the strategy used. :)

if (__CLASS__ !==get_class($this)) {
$r =new \ReflectionMethod($this,__FUNCTION__);
if (__CLASS__ !==$r->getDeclaringClass()->getName()) {
@trigger_error(sprintf('Method %s() will have a sixth `$context = null` argument in version 4.0. Not defining it is deprecated since 3.3.',get_class($this),__FUNCTION__),E_USER_DEPRECATED);
Copy link
Contributor

Choose a reason for hiding this comment

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

Method %s::%s() ...

ogizanagi reacted with thumbs up emoji
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Should even use__METHOD__ instead. (671694d#diff-98543741515f0201292fdfa41ea3c412R97)


// Fetch from injected current firewall information, if possible
list($key,$context) =$this->currentFirewall;

Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps addnull !== $key to be explicit.

@fabpot
Copy link
Member

Thank you@ogizanagi.

@fabpotfabpot merged commit5b7fe85 intosymfony:masterMar 22, 2017
fabpot added a commit that referenced this pull requestMar 22, 2017
…l generation (ogizanagi)This PR was merged into the 3.3-dev branch.Discussion----------[Security][SecurityBundle] Enhance automatic logout url generation| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| BC breaks?    | no| Deprecations? | yes| Tests pass?   | yes| Fixed tickets | N/A| License       | MIT| Doc PR        | N/AThis should help whenever:- [the token does not implement the `getProviderKey` method](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Security/Http/Logout/LogoutUrlGenerator.php#L89-L99)- you've got multiple firewalls sharing a same context but a logout listener only define on one of them.##### Behavior:> When not providing the firewall key:>>- Try to find the key from the token (unless it's an anonymous token)>- If found, try to get the listener from the key. If the listener is found, stop there.>- Try from the injected firewall key. If the listener is found, stop there.>- Try from the injected firewall context. If the listener is found, stop there.>>The behavior remains unchanged when providing explicitly the firewall key. No fallback.Commits-------5b7fe85 [Security][SecurityBundle] Enhance automatic logout url generation
@ogizanagiogizanagi deleted the security/collector_logout_url branchMarch 22, 2017 21:53
@ogizanagiogizanagi mentioned this pull requestMar 22, 2017
fabpot added a commit that referenced this pull requestMar 22, 2017
This PR was merged into the 3.3-dev branch.Discussion----------Fix deprecation message| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#20516 (comment)| License       | MIT| Doc PR        | N/AMy bad, it seems I've never pushed the fix for#20516 (comment) :/Commits-------57427cc Fix deprecation message
@nicolas-grekasnicolas-grekas modified the milestones:3.x,3.3Mar 24, 2017
@fabpotfabpot mentioned this pull requestMay 1, 2017
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@chalasrchalasrchalasr left review comments

+1 more reviewer

@ro0NLro0NLro0NL left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

3.3

Development

Successfully merging this pull request may close these issues.

6 participants

@ogizanagi@chalasr@ro0NL@fabpot@nicolas-grekas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp