質問

I use hwioauthbundle and FosUserBundle and I need check if user Twitter ID is in whitelist. If user ID in whitelist, user authorized, if not, redirect to specific page.

For automatic registration I use custom FOSUserProvider as in that Gist, I try to check ID in this file, but this is not good way, you can onlu return false, and user get 500 error, but I need redirect.

役に立ちましたか?

解決

You should include the white-list check inside the authentication handler throwing an exception if the user is not whitelisted...

... then catch the exception inside an authentication failure handler and perform the redirect in there.

See this answer for more information on how to configure the failure_handler service and implement the onAuthenticationFailure() method in there.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top