Skip to content

[Security] AccessDecisionManager refactoring #942

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 3 commits into from

Conversation

hhamon
Copy link
Contributor

@hhamon hhamon commented May 14, 2011

Hi Fabien, hi Johannes,

I've tried to refactor the AccessDecisionManager class in the security component. I split the three access decision strategies (affirmative, consensus and unanimous) into three dedicated classes. Each strategy class implements the AccessStrategyInterface interface to enforce they have the same public API.

With this changeset, it's now easier to add new access decision strategies into the AccessDecisionManager object.

I couldn't manage to check if any regression came up because I have the following exception:

You cannot create a service ("request") of an inactive scope ("request").

I'm not sure this exception is due to my changeset. Could you please test this pull request or help me to find and understand why I have this exception.

Thanks.

Hugo.

@schmittjoh
Copy link
Contributor

There is already one interface AccessDecisionManagerInterface. I don't see the value in adding another one.

We could still split the strategies in different classes using inheritance instead of composition; something like this:

AffirmativeAccessDecisionManager extends VotingBasedAccessDecisionManager
UnanimousAccessDecisionManager extends VotingBasedAccessDecisionManager
etc.

@hhamon
Copy link
Contributor Author

hhamon commented May 14, 2011

That seems a good idea too!

@fabpot
Copy link
Member

fabpot commented May 14, 2011

Closing this PR... and waiting for another one based on Johannes idea.

@fabpot fabpot closed this May 14, 2011
@hhamon
Copy link
Contributor Author

hhamon commented May 16, 2011

I'm working on it ;)

nicolas-grekas added a commit that referenced this pull request Jul 12, 2017
…ss decision manager service (xabbuh)

This PR was merged into the 3.4 branch.

Discussion
----------

[Security] make it possible to configure a custom access decision manager service

| Q | A |
| --- | --- |
| Branch? | 3.4 |
| Bug fix? | no |
| New feature? | yes |
| BC breaks? | no |
| Deprecations? | no |
| Tests pass? | yes |
| Fixed tickets | #942, #14049, #15295, #16828, #16843, |
| License | MIT |
| Doc PR | TODO |

These changes will make it possible to let users define their own voting strategies without the need for custom compiler passes that replace the built-in `AccessDecisionManager` (see linked issues in the PR table for some use cases).

Commits
-------

e0913a2 add option to define the access decision manager
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.

3 participants