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

[SecurityBundle] Move cache of the firewall context into the request parameters#22943

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
GromNaN wants to merge2 commits intosymfony:3.2fromGromNaN:firewall-context

Conversation

@GromNaN
Copy link
Member

@GromNaNGromNaN commentedMay 29, 2017
edited
Loading

Followingthis proposal. Since the matching context relates to the request, this information should have been cached inside the request parameters.

QA
Branch?3.2
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#22605
LicenseMIT
Doc PRn/a
  • Avoid memory leak when handling multiple requests
  • Adding the new request parameter_firewall_context might be considered as a breaking change. That adds a new "public" property that could be used by end developers.

{
if ($this->contexts->contains($request)) {
return$this->contexts[$request];
if ($request->attributes->has('_firewall_context')) {
Copy link
Member

Choose a reason for hiding this comment

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

you should validate that$request->attributes->get('_firewall_context') is a valid key of$this->map

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Done. And added test assertions on the value of this attribute.

@stof
Copy link
Member

why is it opened against the master branch if you want it for 3.4 ? master is 4.0

@GromNaNGromNaN changed the base branch frommaster to3.4May 29, 2017 17:25
@GromNaNGromNaN changed the base branch from3.4 tomasterMay 29, 2017 17:26
@GromNaNGromNaN changed the base branch frommaster to3.4May 29, 2017 17:26
return$this->contexts[$request];
if ($request->attributes->has('_firewall_context')) {
$contextId =$request->attributes->get('_firewall_context');
if (array_key_exists($contextId,$this->map)) {
Copy link
Member

Choose a reason for hiding this comment

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

$this->map can beTraversable (andit is)

@nicolas-grekasnicolas-grekas added this to the3.4 milestoneMay 30, 2017
Copy link
Member

@chalasrchalasr left a comment

Choose a reason for hiding this comment

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

Build failures unrelated

@GromNaN
Copy link
MemberAuthor

Is it possible that a sub-request get created with all the attributes of its master request? In that case, using the request attributes as a cache would be wrong.

Copy link
Member

@fabpotfabpot left a comment

Choose a reason for hiding this comment

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

Why does it target 3.4. Looks like a bug fix to me, so it should be done in earliest branches as well.

}

/**
* @param Request $request
Copy link
Member

Choose a reason for hiding this comment

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

should be removed

/**
* @param Request $request
*
* @return \Symfony\Bundle\SecurityBundle\Security\FirewallContext
Copy link
Member

Choose a reason for hiding this comment

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

You should add ause statement and useFirewallContext here instead.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

After this change, fabbot reports is as an unused import and removes theuse statement.

@GromNaNGromNaNforce-pushed thefirewall-context branch 2 times, most recently fromf335537 toe306ec0CompareJune 9, 2017 12:19
@GromNaNGromNaN changed the base branch from3.4 to3.2June 9, 2017 12:19
@GromNaN
Copy link
MemberAuthor

@fabpot The cache was introduced in 3.2. I've updated the PR.

namespaceSymfony\Bundle\SecurityBundle\Security;

usePsr\Container\ContainerInterface;
useSymfony\Bundle\SecurityBundle\Security\FirewallContext
Copy link
Member

Choose a reason for hiding this comment

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

missing; at then end

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Sorry, fixed.

Validate that _firewall_context attribute is in the map keys
@fabpot
Copy link
Member

Tests are broken.


$firewallContext =$this->getMockBuilder(FirewallContext::class)->disableOriginalConstructor()->getMock();
$firewallContext->expects($this->once())->method('getConfig')->willReturn('CONFIG');
$firewallContext->expects($this->once())->method('getContext')->willReturn(array('LISTENERS','EXCEPTION LISTENER'));
Copy link
MemberAuthor

@GromNaNGromNaNJun 10, 2017
edited
Loading

Choose a reason for hiding this comment

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

After merging into 3.3,getContext is replaced bygetListeners andgetExceptionListener, update this line to:

$firewallContext->expects($this->once())->method('getListeners')->willReturn('LISTENERS');$firewallContext->expects($this->once())->method('getExceptionListener')->willReturn('EXCEPTION LISTENER');

Copy link
Member

Choose a reason for hiding this comment

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

Done, thanks

@fabpot
Copy link
Member

Thank you@GromNaN.

fabpot added a commit that referenced this pull requestJun 14, 2017
…he request parameters (GromNaN)This PR was squashed before being merged into the 3.2 branch (closes#22943).Discussion----------[SecurityBundle] Move cache of the firewall context into the request parametersFollowing [this proposal](#22605 (comment)). Since the matching context relates to the request, this information should have been cached inside the request parameters.| Q             | A| ------------- | ---| Branch?       | 3.2| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#22605| License       | MIT| Doc PR        | n/a* Avoid memory leak when handling multiple requests* Adding the new request parameter `_firewall_context` might be considered as a breaking change. That adds a new "public" property that could be used by end developers.Commits-------b3203cb [SecurityBundle] Move cache of the firewall context into the request parameters
@chalasr
Copy link
Member

should be closed

@fabpotfabpot closed thisJun 14, 2017
This was referencedJul 4, 2017
nicolas-grekas added a commit that referenced this pull requestDec 13, 2019
…ncyweb)This PR was merged into the 3.4 branch.Discussion----------[SecurityBundle][FirewallMap] Remove unused property| Q             | A| ------------- | ---| Branch?       | 3.4| Bug fix?      | no| New feature?  | no| Deprecations? | no| Tickets       | no| License       | MIT| Doc PR        | -This property is unused. It was removed in#22943. It was likely reintroduced in a merge commit. It is still on master.Commits-------0904e57 [SecurityBundle][FirewallMap] Remove unused property
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fabpotfabpotfabpot approved these changes

@stofstofstof requested changes

@chalasrchalasrchalasr approved these changes

+1 more reviewer

@ogizanagiogizanagiogizanagi approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

3.4

Development

Successfully merging this pull request may close these issues.

7 participants

@GromNaN@stof@fabpot@chalasr@ogizanagi@nicolas-grekas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp