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

[DX] Suggest a hint to any auth-check#4304

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

Closed
larsborn wants to merge1 commit intosymfony:2.5fromlarsborn:patch-1
Closed

[DX] Suggest a hint to any auth-check#4304

larsborn wants to merge1 commit intosymfony:2.5fromlarsborn:patch-1

Conversation

larsborn
Copy link
Contributor

Suggest a hint that you need a minimum of auth-check to let the voters vote.

Suggest a hint that you need a minimum of auth-check to let the voters vote.
@stof
Copy link
Member

stof commentedOct 8, 2014

I don't understand what you mean

@wouterj
Copy link
Member

Voters are used when using ->isGranted. When that's called depends on your code if I'm correct.

The security system in general only works when the page is under a firewall, it doesn't depend on the access rules.

@DavidBadura
Copy link

If you have only following security configuration withoutaccess_control and you don't executeisGranted somewhere (controller / twig) then the voters will not execute. To define a firewall is not enough.

security:    providers:        in_memory:            memory: ~    firewalls:        dev:            pattern: ^/(_(profiler|wdt)|css|images|js)/            security: false        default:            pattern: ^/            anonymous: true    access_decision_manager:        strategy: unanimous

@stof
Copy link
Member

stof commentedOct 9, 2014

Of course they won't execute. Defining a firewall allows you to authenticate the user. Voters are not involved in this process at all. They are the authorization system. they are whatisGranted calls to make a decision. If you don't ask any decision, there is no reason to call them (and there is no way to call them, as you would not know which argument to pass them)

@larsborn
Copy link
ContributorAuthor

If you implement the IP Blacklist example in a freshly created Symfony app, it doesn't work, since you don't ask for any permissions (as stof pointed out). This is exactly the reason, I suggested this minimal authorization check for IS_AUTHENTICATED_ANONYMOUSLY. If you think, that it bloats this recipe, I could also suggest a small hint instead. Either way I think, that at least a hint is necessary.

@larsborn
Copy link
ContributorAuthor

push

@wouterj
Copy link
Member

I believe the complete article is wrong. The voter is part of the authorization process, while the article suggests it's part of the authentication process. I think a backlist needs to be implemented by anAuthenticationListener. Security experts, please correct me if I'm wrong ;)

@larsbornlarsborn changed the titleSuggest a hint to any auth-check[DX] Suggest a hint to any auth-checkNov 28, 2014
@larsborn
Copy link
ContributorAuthor

does renaming even help, if I want to get noticed by dx.symfony.com? :)

@stof
Copy link
Member

stof commentedDec 6, 2014

Currently, dx.symfony.com only checks labelled issues. It does not yet check issue titles.

@larsborn
Copy link
ContributorAuthor

then Ryan might have talked about a future version of dx.symfony.com on the SymfonyCon Madrid.

@stof
Copy link
Member

Well, it is planned. There is a TODO in the code saying it is not implemented yet

@larsborn
Copy link
ContributorAuthor

but am I right, when I say, that I cannot add labels? :)

@xabbuh
Copy link
Member

@larsborn Yes, only repository collaborators can add or remove labels.

@@ -197,6 +197,36 @@ application configuration file with the following code.
That's it! Now, when deciding whether or not a user should have access,
the new voter will deny access to any user in the list of blacklisted IPs.

Note that the voters are only called, if any access is actually checked. So
Copy link
Member

Choose a reason for hiding this comment

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

The comma is not needed here.

@xabbuh
Copy link
Member

However, we should first finish the discussion if the change does make sense at all.

@wouterj
Copy link
Member

@weaverryan@stof@iltar can you please share your opinions on my comment:

I believe the complete article is wrong. The voter is part of the authorization process, while the article suggests it's part of the authentication process. I think a backlist needs to be implemented by an AuthenticationListener. Security experts, please correct me if I'm wrong ;)

@linaori
Copy link
Contributor

@wouterjcookbook/security/access_control.html IP Blacklisting is mentioned here, seems to me like this is part of the authorization and not authentication.

  • If you want to give permissions(authorize) based on IP, it should be in access_control or a voter, though the latter I don't really see a proper use-case for.
  • If you want to restrict logins(authentication) from certain IPs, it should be handled in your authentication process, usually done bySimpleAuthenticatorInterface.

Right now I can't check if this is still a valid case; I remember that if you login(authenticate) without setting up properaccess_control and not using anyisGranted(authorization) checks, the toolbar will actually show your "logged in as", but never show you as Authenticated.

As far as I know, theaccess_control internally calls the votersafter authentication using theAccessListener andAccessMap:Symfony/Component/Security/Http/Firewall/AccessListener.php#L64-L67

@weaverryan
Copy link
Member

Hey@larsborn!

So sorry, I got a little busy :). Some points:

  1. I agree with Wouter that this entire article (it's quite old) isn't the best approach. I would implement this in a listener - simply do some logic and throw an AccessDeniedException. And since we have a different article that properly talks about voters, this one should be updated.

  2. Also, technically speaking though, I think@larsborn is right that you'd need your voters to be called at least once for this article to be correct. That highlights that voters is awkward for blacklisting.

  3. @iltar mentioned that withoutaccess_control you may show up as "logged in" but not authenticated on the toolbar. I can confirm that - but it's a separate issue - check out my comment here (click the comments tab to see... because I haven't fixed linking yet :))https://knpuniversity.com/screencast/symfony2-ep2/user-serialization#comment-1899008818

So, I'm going to merge this, but open an issue about this whole article.

Thanks!

weaverryan added a commit that referenced this pull requestMar 15, 2015
This PR was submitted for the 2.5 branch but it was merged into the 2.3 branch instead (closes#4304).Discussion----------[DX] Suggest a hint to any auth-checkSuggest a hint that you need a minimum of auth-check to let the voters vote.Commits-------ccdda87 Suggest a hint to any auth-check
@xabbuhxabbuh closed thisMar 16, 2015
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

7 participants
@larsborn@stof@wouterj@DavidBadura@xabbuh@linaori@weaverryan

[8]ページ先頭

©2009-2025 Movatter.jp