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

Yet another OAuth integration with identity injected into Resources #26

Closed
wants to merge 5 commits into from
Closed

Yet another OAuth integration with identity injected into Resources #26

wants to merge 5 commits into from

Conversation

hkulekci
Copy link
Member

There are a problem other pull request about manipulated identity. Manipulated identity information did not change on resources get Identity information. Because MvcEvent save their own identity information in its params attributes. And it is not update self identity information when MvcAuthEvent identity information manipulated. Check only following lines

+    public function eventAuthenticationPost(MvcAuthEvent $event)
+    {
+        $identity      = $event->getIdentity();
+        $oauth2Closure = $event->getMvcEvent()
+                               ->getApplication()
+                               ->getServiceManager()
+                               ->get(\ZF\OAuth2\Service\OAuth2Server::class);
+
+        if (!!$identity) {
+            $userData = $oauth2Closure()->getStorage('user_credentials')->getUser($identity->getName());
+            
+            $identity = new \ZF\MvcAuth\Identity\AuthenticatedIdentity($userData);
+            $event->setIdentity($identity);
-             // Added to following lines
+            //MvcEvent did not understand when manipulated MvcAuthEvent identity
+            $event->getMvcEvent()->setParam('ZF\MvcAuth\Identity', $identity);
+        }
+
+        return $event;
+    }

@hkulekci hkulekci closed this Dec 4, 2015
@hkulekci hkulekci deleted the feature/oauth-identity-integration branch December 4, 2015 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant