Elcodi\Store\ConnectBundle\Services\OAuthUserProvider::createAuthorization PHP Method

createAuthorization() protected method

Creates an authorization for a given user
protected createAuthorization ( HWI\Bundle\OAuthBundle\OAuth\Response\UserResponseInterface $response, Symfony\Component\Security\Core\User\UserInterface $user ) : Authorization
$response HWI\Bundle\OAuthBundle\OAuth\Response\UserResponseInterface Response of the resource owner
$user Symfony\Component\Security\Core\User\UserInterface User
return Elcodi\Store\ConnectBundle\Entity\Authorization
    protected function createAuthorization(UserResponseInterface $response, UserInterface $user)
    {
        $resourceOwnerName = $response->getResourceOwner()->getName();
        $username = $response->getUsername();
        $authorization = $this->authorizationDirector->create();
        $authorization->setUser($user)->setResourceOwnerName($resourceOwnerName)->setUsername($username);
        return $authorization;
    }