Skip to content

[Cookbook, Security] Added user_checkers.rst#5530

Closed
linaori wants to merge 2 commits intosymfony:2.8from
linaori:feature/user-checkers
Closed

[Cookbook, Security] Added user_checkers.rst#5530
linaori wants to merge 2 commits intosymfony:2.8from
linaori:feature/user-checkers

Conversation

@linaori
Copy link
Copy Markdown
Contributor

@linaori linaori commented Jul 16, 2015

Q A
Doc fix? no
New docs? yes
Applies to ^2.8
Fixed tickets symfony/symfony/pull/14721

This PR should provide sufficient docs to get started with custom user checkers as a new feature.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The namespace and the classname looks too long to me. Instead of App\Security\User\AppUserChecker, what about using App\Security\UserChecker?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sounds fine, the User in UserChecker already implies it's user related

@javiereguiluz
Copy link
Copy Markdown
Member

@iltar thanks for documenting this new security feature. I like your article and I just added some minor comments.

@linaori linaori force-pushed the feature/user-checkers branch 2 times, most recently from 6230f5b to c9e46cf Compare July 16, 2015 13:25
@xabbuh xabbuh added the On hold label Jul 16, 2015
@linaori linaori force-pushed the feature/user-checkers branch 2 times, most recently from 9d2d604 to 924fa2e Compare October 1, 2015 05:33
Instead of multiple User Checkers, only 1 is configured
@linaori linaori force-pushed the feature/user-checkers branch from 924fa2e to d070f5b Compare October 1, 2015 06:15
fabpot added a commit to symfony/symfony that referenced this pull request Oct 2, 2015
…tar)

This PR was squashed before being merged into the 2.8 branch (closes #14721).

Discussion
----------

[Security] Configuring a user checker per firewall

_Changed my base branch to avoid issues, closed old PR_

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed ticket | #11090 and helps #14673
| License       | MIT
| Doc PR        | symfony/symfony-docs/pull/5530

This pull request adds support for a configurable user checker per firewall. An example could be:

```yml
services:
    app.user_checker:
        class: App\Security\UserChecker
        arguments:
            - "@request_stack"

security:
    firewalls:
        secured_area:
            pattern: ^/
            anonymous: ~
            basic_auth: ~
            user_checker: app.user_checker

```
The above example will use the `UserChecker` defined as `app.user_checker`. If the `user_checker` option is left empty, `security.user_checker` will  be used. If the `user_checkers` option is not defined, it will fall back to the original behavior to not break backwards compatibility and will validate using the existing `UserChecker`: `security.user_checker`.

I left the default argument in the service definitions to be `security.user_checker` to include backwards compatibility for people who for some reason don't have the extension executed. You can obtain the checker for a specific firewall by appending the firewall name to it. For the firewall `secured_area`, this would be `security.user_checker.secured_area`.

Commits
-------

76bc662 [Security] Configuring a user checker per firewall
@linaori
Copy link
Copy Markdown
Contributor Author

linaori commented Oct 2, 2015

ping @xabbuh the PR got merged. I've slightly updated the text as the original feature is changed so it needs a new checkup.

fabpot added a commit to symfony/security-bundle that referenced this pull request Oct 2, 2015
…tar)

This PR was squashed before being merged into the 2.8 branch (closes #14721).

Discussion
----------

[Security] Configuring a user checker per firewall

_Changed my base branch to avoid issues, closed old PR_

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed ticket | #11090 and helps #14673
| License       | MIT
| Doc PR        | symfony/symfony-docs/pull/5530

This pull request adds support for a configurable user checker per firewall. An example could be:

```yml
services:
    app.user_checker:
        class: App\Security\UserChecker
        arguments:
            - "@request_stack"

security:
    firewalls:
        secured_area:
            pattern: ^/
            anonymous: ~
            basic_auth: ~
            user_checker: app.user_checker

```
The above example will use the `UserChecker` defined as `app.user_checker`. If the `user_checker` option is left empty, `security.user_checker` will  be used. If the `user_checkers` option is not defined, it will fall back to the original behavior to not break backwards compatibility and will validate using the existing `UserChecker`: `security.user_checker`.

I left the default argument in the service definitions to be `security.user_checker` to include backwards compatibility for people who for some reason don't have the extension executed. You can obtain the checker for a specific firewall by appending the firewall name to it. For the firewall `secured_area`, this would be `security.user_checker.secured_area`.

Commits
-------

76bc662 [Security] Configuring a user checker per firewall
fabpot added a commit to symfony/security that referenced this pull request Oct 2, 2015
…tar)

This PR was squashed before being merged into the 2.8 branch (closes #14721).

Discussion
----------

[Security] Configuring a user checker per firewall

_Changed my base branch to avoid issues, closed old PR_

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed ticket | #11090 and helps #14673
| License       | MIT
| Doc PR        | symfony/symfony-docs/pull/5530

This pull request adds support for a configurable user checker per firewall. An example could be:

```yml
services:
    app.user_checker:
        class: App\Security\UserChecker
        arguments:
            - "@request_stack"

security:
    firewalls:
        secured_area:
            pattern: ^/
            anonymous: ~
            basic_auth: ~
            user_checker: app.user_checker

```
The above example will use the `UserChecker` defined as `app.user_checker`. If the `user_checker` option is left empty, `security.user_checker` will  be used. If the `user_checkers` option is not defined, it will fall back to the original behavior to not break backwards compatibility and will validate using the existing `UserChecker`: `security.user_checker`.

I left the default argument in the service definitions to be `security.user_checker` to include backwards compatibility for people who for some reason don't have the extension executed. You can obtain the checker for a specific firewall by appending the firewall name to it. For the firewall `secured_area`, this would be `security.user_checker.secured_area`.

Commits
-------

76bc662 [Security] Configuring a user checker per firewall
.. versionadded:: 2.8
Defining a custom user checker was introduced in Symfony 2.8.


Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

double empty line here

@wouterj
Copy link
Copy Markdown
Member

wouterj commented Feb 6, 2016

👍

xabbuh added a commit that referenced this pull request Feb 7, 2016
This PR was squashed before being merged into the 2.8 branch (closes #5530).

Discussion
----------

[Cookbook, Security] Added user_checkers.rst

| Q             | A
| ------------- | ---
| Doc fix?      | no
| New docs?     | yes
| Applies to    | ^2.8
| Fixed tickets | symfony/symfony/pull/14721

This PR should provide sufficient docs to get started with custom user checkers as a new feature.

Commits
-------

89b20a8 [Cookbook, Security] Added user_checkers.rst
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.

4 participants