コード例 #1
0
 public function testRedirectUriPostmessageIsAllowed()
 {
     $o = new OAuth2(['authorizationUri' => 'https://accounts.test.org/insecure/url', 'redirectUri' => 'postmessage', 'clientId' => 'aClientID']);
     $this->assertEquals('postmessage', $o->getRedirectUri());
     $url = $o->buildFullAuthorizationUri();
     $parts = parse_url((string) $url);
     parse_str($parts['query'], $query);
     $this->assertArrayHasKey('redirect_uri', $query);
     $this->assertEquals('postmessage', $query['redirect_uri']);
 }
コード例 #2
0
 public function testIncludesTheScope()
 {
     $with_strings = array_merge($this->minimal, ['scope' => 'scope1 scope2']);
     $o = new OAuth2($with_strings);
     $q = $o->buildFullAuthorizationUri()->getQuery();
     $this->assertEquals('scope1 scope2', $q->get('scope'));
     $with_array = array_merge($this->minimal, ['scope' => ['scope1', 'scope2']]);
     $o = new OAuth2($with_array);
     $q = $o->buildFullAuthorizationUri()->getQuery();
     $this->assertEquals('scope1 scope2', $q->get('scope'));
 }