Skip to content
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

The handling of the remember_me does not work in the LoginManager #747

Closed
stof opened this issue Aug 7, 2012 · 24 comments
Closed

The handling of the remember_me does not work in the LoginManager #747

stof opened this issue Aug 7, 2012 · 24 comments
Labels
Milestone

Comments

@stof
Copy link
Member

stof commented Aug 7, 2012

The remember me services are private so they are removed from the container when optimizing it. This means that the has checks in the LoginManager will return false even when the remember me is activated for the firewall.

/cc @schmittjoh

@wiistriker
Copy link

How should i fix it?

@kwizzn
Copy link

kwizzn commented Nov 27, 2012

Good question by @wiistriker.
I think this is an issue and should be fixed to allow for persistent login after the user registers and/or a combined registration/login form.

I would gladly help if anyone has an idea on how to fix this now that the remember me services are private.

What is the best practice to set the remember me cookie manually?

@stof
Copy link
Member Author

stof commented Nov 27, 2012

@wiistriker I don't know how to fix it, otherwise it would already be in the bundle.

@schmittjoh do you have an idea ?

@wiistriker
Copy link

@wiistriker
Copy link

In http://symfony.com/doc/master/components/dependency_injection/advanced.html#aliasing part of docs:

You may sometimes want to use shortcuts to access some services. You can do so by aliasing them and, furthermore, you can even alias non-public services.

so in services.yml:

my.authentication.rememberme.services.simplehash:
        alias: security.authentication.rememberme.services.simplehash.main

and i can get this service and use it. Only problem that we should hardcode .main from our firewall.

Another thing that $rememberMeServices->loginSuccess method inside LoginManager check _remember_me parameter in request, so we need manually set it or use always_remember_me: true

@wiistriker
Copy link

ping @stof @schmittjoh ^^^ what do you think? maybe there is some way to create alias for services inside bundle's extension?

@runcom
Copy link

runcom commented Jan 12, 2013

Any update about this?

@ghost
Copy link

ghost commented Jan 29, 2013

@wiistriker: no it's not possible. it doesn't have access to the full container. It would have to be done in a compiler pass.

@wiistriker
Copy link

@jrobeson but it's work

@ghost
Copy link

ghost commented Jan 29, 2013

which file? your services.yml? yes it would work there. I was referring to the extension.

@ghost
Copy link

ghost commented Jan 29, 2013

@wiistriker: see this: http://symfony.com/doc/master/components/dependency_injection/compilation.html#managing-configuration-with-extensions

If you need to manipulate the configuration loaded by an extension then you cannot do it from another extension as it uses a fresh container. You should instead use a compiler pass which works with the full container after the extensions have been processed.

@noetix
Copy link

noetix commented Jun 2, 2013

+1

2 similar comments
@adurieux
Copy link

adurieux commented Jun 8, 2013

+1

@devgogo
Copy link

devgogo commented Jun 25, 2013

+1

@sstok
Copy link

sstok commented Jun 25, 2013

The firewall name is already configured so using a CompilerPass to set the the correct Remember-me service would work right?

The only problem is that the service is always initialized (even when not needed), this can alternatively be solved with lazy loading. But I'm not sure if injecting really results in overhead, how many times is this service initialized?

From what I know the Service is only loaded when its dispatched, and that only happens on resetting and registering.

As a last possibility we can determine the remember-me service and change the public=false to true in a CompilerPass at least until or when lazy-loading is not possible.

Any thoughts on this??

@afiocre
Copy link

afiocre commented Aug 6, 2013

up, because it's important to fix the problem :(

@azatyan
Copy link

azatyan commented Aug 8, 2013

but if not possible. how it working in SonataAdminBundle login?

@noetix
Copy link

noetix commented Aug 8, 2013

This issue relates to the LoginManager class used to log a user in manually.

SonataAdminBundle doesn't do anything in regards to authentication, it relies on a properly configured firewall to handle that.

@afiocre
Copy link

afiocre commented Sep 25, 2013

No fix found ?

@stof
Copy link
Member Author

stof commented Sep 25, 2013

To be fair, I haven't spent time to find a fix yet (and nobody has found it annoying enough to contribute a fix)

@afiocre
Copy link

afiocre commented Dec 2, 2013

At date always the bug ?

@ftoledo
Copy link

ftoledo commented Dec 30, 2013

any workaround for this?

@gondo
Copy link

gondo commented Jun 9, 2014

@stof what about sirian's fix ?

@XWB
Copy link
Member

XWB commented Oct 12, 2016

#2257

@XWB XWB closed this as completed Nov 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests