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

Added a short cookbook about avoiding the automatic start of the sessions#4661

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
weaverryan merged 4 commits intosymfony:2.3fromjaviereguiluz:avoid_session_start
Feb 5, 2015

Conversation

@javiereguiluz
Copy link
Member

QA
Doc fix?no
New docs?yes
Applies toall
Fixed tickets#2607

Besides all the usual review, I'd like to ask doc reviewers to tell me if there is some way to avoid starting the session in the last case about defining a firewall that covers all URLs. Thanks in advance!

@timglabisch
Copy link
Contributor

good one 👍

@xabbuh
Copy link
Member

You also have to add a reference to/cookbook/map.rst.inc.

Copy link
Member

Choose a reason for hiding this comment

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

xml and php are missing

Copy link
Contributor

Choose a reason for hiding this comment

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

is there any way to avoid this behaviour? or what is the recommended approach for this problem? using a different domainname for logged in users?

Copy link
Member

Choose a reason for hiding this comment

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

This is a killer, but I'm not sure it's true (yay!). I just tested locally on a 2.6 project, and once I protected against the flash messages (usingapp.request.hasPreviousSession) and removed some session checks from my user-land code, there was no session cookie.

The security-related session stuff is handled in ContextListener. Onkernel.request, it correctly doesn't start the session unless there was a previous session (https://github.com/symfony/symfony/blob/2.7/src/Symfony/Component/Security/Http/Firewall/ContextListener.php#L76). Then, onkernel.response, it correctly doesn't save the token to the session if we're dealing with an AnonymousToken:https://github.com/symfony/symfony/blob/2.7/src/Symfony/Component/Security/Http/Firewall/ContextListener.php#L125

So for me, this note is not valid - but I wonder where you got this idea from@javiereguiluz? Is there something else?

@dbu
Copy link
Contributor

dbu commentedDec 25, 2014

great initiative, we really need this sorted out for proper caching. hacking around on varnish to remove session cookies most of the time has the tendency to break things in unexpected ways...

could you add a section how toend the session again when there are no more flash messages / csrf tokens etc? that way, a user could get a session when he is on the form, but get rid of the session after success...

Copy link
Member

Choose a reason for hiding this comment

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

Sessions are automatically started whenever you read, write or even check for the existenceof data in the session. This means that if you need to avoid creating a session cookie for someusers, it can be difficult: you must *completely* avoid accessing the session.For example, one common problem in this situation involves checking for flash messages, whichare stored in the session. The following code would guarantee that a session is *always* started:

... then the code block

@javiereguiluz
Copy link
MemberAuthor

Thank you all for your reviews and comments. I've just updated this pull request.

@weaverryan
Copy link
Member

I like it! I think it's the best we can do in the docs - I'd like to see the code be more forgiving, but at least this is accurate and shows the hasPreviousSession() method. Thanks!

@weaverryanweaverryan merged commitbbba47a intosymfony:2.3Feb 5, 2015
weaverryan added a commit that referenced this pull requestFeb 5, 2015
…rt of the sessions (javiereguiluz)This PR was merged into the 2.3 branch.Discussion----------Added a short cookbook about avoiding the automatic start of the sessions| Q             | A| ------------- | ---| Doc fix?      | no| New docs?     | yes| Applies to    | all| Fixed tickets |#2607Besides all the usual review, I'd like to ask doc reviewers to tell me if there is some way to avoid starting the session in the last case about defining a firewall that covers all URLs. Thanks in advance!Commits-------bbba47a Added all sugestions made by reviewers7dd3945 Added the new cookbook article to the global map0212779 Tweaks and rewordings to improve the article99781f8 Added a short cookbook about avoiding the automatic start of the sessions
weaverryan added a commit that referenced this pull requestFeb 5, 2015
wouterj added a commit that referenced this pull requestFeb 14, 2015
…on (dbu)This PR was merged into the 2.3 branch.Discussion----------link to the cookbook article on avoiding to start a sessionresolve the todo now that#4661 is mergedCommits-------e66aac7 link to the cookbook article on avoiding to start a session
@javiereguiluzjaviereguiluz deleted the avoid_session_start branchFebruary 18, 2015 16:22
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.

6 participants

@javiereguiluz@timglabisch@xabbuh@dbu@weaverryan@wouterj

[8]ページ先頭

©2009-2025 Movatter.jp