|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace League\OAuth1\Client\Server; |
|
4
|
|
|
|
|
5
|
|
|
use League\OAuth1\Client\Credentials\TokenCredentials; |
|
6
|
|
|
use Psr\Http\Message\ResponseInterface; |
|
7
|
|
|
|
|
8
|
|
|
class Bitbucket extends AbstractServer |
|
9
|
|
|
{ |
|
10
|
|
|
/** |
|
11
|
|
|
* Checks a provider response for errors. |
|
12
|
|
|
* |
|
13
|
|
|
* @param ResponseInterface $response |
|
14
|
|
|
* @param array|string $data Parsed response data |
|
15
|
|
|
* |
|
16
|
|
|
* @return void |
|
17
|
|
|
* @throws IdentityProviderException |
|
18
|
|
|
*/ |
|
19
|
2 |
|
protected function checkResponse(ResponseInterface $response, $data) |
|
20
|
|
|
{ |
|
21
|
|
|
// |
|
22
|
2 |
|
} |
|
23
|
|
|
|
|
24
|
|
|
/** |
|
25
|
|
|
* Generates a resource owner object from a successful resource owner |
|
26
|
|
|
* details request. |
|
27
|
|
|
* |
|
28
|
|
|
* @param array $response |
|
29
|
|
|
* @param TokenCredentials $tokenCredentials |
|
30
|
|
|
* |
|
31
|
|
|
* @return ResourceOwnerInterface |
|
32
|
|
|
*/ |
|
33
|
2 |
|
protected function createResourceOwner(array $response, TokenCredentials $tokenCredentials) |
|
34
|
|
|
{ |
|
35
|
2 |
|
return new BitbucketResourceOwner($response); |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* Gets the URL for redirecting the resource owner to authorize the client. |
|
40
|
|
|
* |
|
41
|
|
|
* @return string |
|
42
|
|
|
*/ |
|
43
|
2 |
|
protected function getBaseAuthorizationUrl(array $options = array()) |
|
44
|
|
|
{ |
|
45
|
2 |
|
return 'https://bitbucket.org/api/1.0/oauth/authenticate'; |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* Gets the URL for retrieving temporary credentials. |
|
50
|
|
|
* |
|
51
|
|
|
* @return string |
|
52
|
|
|
*/ |
|
53
|
2 |
|
protected function getBaseTemporaryCredentialsUrl() |
|
54
|
|
|
{ |
|
55
|
2 |
|
return 'https://bitbucket.org/api/1.0/oauth/request_token'; |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* Gets the URL retrieving token credentials. |
|
60
|
|
|
* |
|
61
|
|
|
* @return string |
|
62
|
|
|
*/ |
|
63
|
2 |
|
protected function getBaseTokenCredentialsUrl() |
|
64
|
|
|
{ |
|
65
|
2 |
|
return 'https://bitbucket.org/api/1.0/oauth/access_token'; |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
/** |
|
69
|
|
|
* Gets the URL for retrieving user details. |
|
70
|
|
|
* |
|
71
|
|
|
* @return string |
|
72
|
|
|
*/ |
|
73
|
2 |
|
protected function getResourceOwnerDetailsUrl(TokenCredentials $tokenCredentials) |
|
74
|
|
|
{ |
|
75
|
2 |
|
return 'https://bitbucket.org/api/1.0/user'; |
|
76
|
|
|
} |
|
77
|
|
|
} |
|
78
|
|
|
|