简体   繁体   中英

Having trouble with custom login flow in Symfony 2

First I'll explain what I'm trying to accomplish:

  • users navigate to "/login" in my application
  • a nonce is generated, and used to created a URL to redirect users to an external service
  • users authenticate with the external service, and are redirected back to my application with a GET parameter
  • the GET parameter is validated using the nonce , and user info is retrieved from the external service
  • the user is loaded from my application's database (or created if they don't exist) and logged in
  • after logging in, user roles dictate what this user has access to

I had originally implemented this via controller actions where a loginAction does the redirecting to the external service, and the external service redirects back to an authAction. In the authAction, the user is loaded (or created) and programatically logged in.

I thought the previous approach might be hack-ish, and attempted to try the SimplePreAuth tutorial , but I'm having no luck.

What would be my best approach?

基本上,我只是采用了我认为可能有点骇人听闻的解决方案。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM