0
votes

I'm trying to manage the classic FOSUserBundle authentification with HWIOauthBundle authentification.

Each work 'ok' alone. I authenticate and see the user in my user table, without a problem.

Though when I try to validate the user with something like this:

 if( $this->container->get('security.context')->isGranted('IS_AUTHENTICATED_FULLY') )
    {
       $user = $this->get('security.context')->getToken()->getUser();
        ...
    }

$user fails with HWIOauthbundle (but NOT FOSUserbundle):

if($user){....}

I see that the token under HWIOauthbundle is created with:

HWI\Bundle\OAuthBundle\Security\Core\Authentication\Token\OAuthToken

and FOSUserbundle with:

Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken

But I don't see why this would have any impact...

I'm simply trying to get the $user to create a local 'profile' which I can do without problem when I'm authenticated with FOSUserBundle.

Any insight would be greatly appreciated. Thanks.

1

1 Answers

0
votes

This was my error and relatively basic.

My controller was returning 'null' for my if($user){} forcing it to throw another exception further on.

It looks like the securitycontext handles the tokens fine.

Thanks.