7
7
use League \OAuth2 \Client \Grant \AbstractGrant ;
8
8
use League \OAuth2 \Client \Provider \AbstractProvider ;
9
9
use League \OAuth2 \Client \Provider \Exception \IdentityProviderException ;
10
+ use League \OAuth2 \Client \Provider \ResourceOwnerInterface ;
11
+ use League \OAuth2 \Client \Token \AccessTokenInterface ;
10
12
use League \OAuth2 \Client \Tool \BearerAuthorizationTrait ;
11
13
use Psr \Http \Message \ResponseInterface ;
12
14
use TheNetworg \OAuth2 \Client \Grant \JwtBearer ;
@@ -81,19 +83,28 @@ protected function getOpenIdConfiguration($tenant, $version) {
81
83
return $ this ->openIdConfiguration [$ tenant ][$ version ];
82
84
}
83
85
84
- public function getBaseAuthorizationUrl ()
86
+ /**
87
+ * @inheritdoc
88
+ */
89
+ public function getBaseAuthorizationUrl (): string
85
90
{
86
91
$ openIdConfiguration = $ this ->getOpenIdConfiguration ($ this ->tenant , $ this ->defaultEndPointVersion );
87
92
return $ openIdConfiguration ['authorization_endpoint ' ];
88
93
}
89
94
90
- public function getBaseAccessTokenUrl (array $ params )
95
+ /**
96
+ * @inheritdoc
97
+ */
98
+ public function getBaseAccessTokenUrl (array $ params ): string
91
99
{
92
100
$ openIdConfiguration = $ this ->getOpenIdConfiguration ($ this ->tenant , $ this ->defaultEndPointVersion );
93
101
return $ openIdConfiguration ['token_endpoint ' ];
94
102
}
95
103
96
- public function getAccessToken ($ grant , array $ options = [])
104
+ /**
105
+ * @inheritdoc
106
+ */
107
+ public function getAccessToken ($ grant , array $ options = []): AccessTokenInterface
97
108
{
98
109
if ($ this ->defaultEndPointVersion != self ::ENDPOINT_VERSION_2_0 ) {
99
110
// Version 2.0 does not support the resources parameter
@@ -107,14 +118,21 @@ public function getAccessToken($grant, array $options = [])
107
118
return parent ::getAccessToken ($ grant , $ options );
108
119
}
109
120
110
- public function getResourceOwner (\League \OAuth2 \Client \Token \AccessToken $ token )
121
+ /**
122
+ * @inheritdoc
123
+ */
124
+ public function getResourceOwner (\League \OAuth2 \Client \Token \AccessToken $ token ): ResourceOwnerInterface
111
125
{
112
126
$ data = $ token ->getIdTokenClaims ();
113
127
return $ this ->createResourceOwner ($ data , $ token );
114
128
}
115
129
116
- public function getResourceOwnerDetailsUrl (\League \OAuth2 \Client \Token \AccessToken $ token )
130
+ /**
131
+ * @inheritdoc
132
+ */
133
+ public function getResourceOwnerDetailsUrl (\League \OAuth2 \Client \Token \AccessToken $ token ): string
117
134
{
135
+ return '' ; // shouldn't that return such a URL?
118
136
}
119
137
120
138
public function getObjects ($ tenant , $ ref , &$ accessToken , $ headers = [])
@@ -399,7 +417,10 @@ public function getTenantDetails($tenant, $version)
399
417
return $ this ->getOpenIdConfiguration ($ this ->tenant , $ this ->defaultEndPointVersion );
400
418
}
401
419
402
- protected function checkResponse (ResponseInterface $ response , $ data )
420
+ /**
421
+ * @inheritdoc
422
+ */
423
+ protected function checkResponse (ResponseInterface $ response , $ data ): void
403
424
{
404
425
if (isset ($ data ['odata.error ' ]) || isset ($ data ['error ' ])) {
405
426
if (isset ($ data ['odata.error ' ]['message ' ]['value ' ])) {
@@ -419,27 +440,39 @@ protected function checkResponse(ResponseInterface $response, $data)
419
440
throw new IdentityProviderException (
420
441
$ message ,
421
442
$ response ->getStatusCode (),
422
- $ response
443
+ $ response-> getBody ()
423
444
);
424
445
}
425
446
}
426
447
427
- protected function getDefaultScopes ()
448
+ /**
449
+ * @inheritdoc
450
+ */
451
+ protected function getDefaultScopes (): array
428
452
{
429
453
return $ this ->scope ;
430
454
}
431
455
432
- protected function getScopeSeparator ()
456
+ /**
457
+ * @inheritdoc
458
+ */
459
+ protected function getScopeSeparator (): string
433
460
{
434
461
return $ this ->scopeSeparator ;
435
462
}
436
463
437
- protected function createAccessToken (array $ response , AbstractGrant $ grant )
464
+ /**
465
+ * @inheritdoc
466
+ */
467
+ protected function createAccessToken (array $ response , AbstractGrant $ grant ): AccessToken
438
468
{
439
469
return new AccessToken ($ response , $ this );
440
470
}
441
471
442
- protected function createResourceOwner (array $ response , \League \OAuth2 \Client \Token \AccessToken $ token )
472
+ /**
473
+ * @inheritdoc
474
+ */
475
+ protected function createResourceOwner (array $ response , \League \OAuth2 \Client \Token \AccessToken $ token ): AzureResourceOwner
443
476
{
444
477
return new AzureResourceOwner ($ response );
445
478
}
0 commit comments