forked from hwi/HWIOAuthBundle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathResourceOwnerInterface.php
101 lines (90 loc) · 2.81 KB
/
ResourceOwnerInterface.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?php
/*
* This file is part of the HWIOAuthBundle package.
*
* (c) Hardware.Info <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace HWI\Bundle\OAuthBundle\OAuth;
use HWI\Bundle\OAuthBundle\OAuth\Response\UserResponseInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
/**
* ResourceOwnerInterface
*
* @author Geoffrey Bachelet <[email protected]>
* @author Alexander <[email protected]>
*/
interface ResourceOwnerInterface
{
/**
* Retrieves the user's information from an access_token
*
* @param array $accessToken The access token
* @param array $extraParameters An array of parameters to add to the url
*
* @return UserResponseInterface The wrapped response interface.
*/
public function getUserInformation(array $accessToken, array $extraParameters = array());
/**
* Returns the provider's authorization url
*
* @param string $redirectUri The uri to redirect the client back to
* @param array $extraParameters An array of parameters to add to the url
*
* @return string The authorization url
*/
public function getAuthorizationUrl($redirectUri, array $extraParameters = array());
/**
* Retrieve an access token for a given code
*
* @param Request $request The request object where is going to extract the code from
* @param string $redirectUri The uri to redirect the client back to
* @param array $extraParameters An array of parameters to add to the url
*
* @return array The access token
*/
public function getAccessToken(Request $request, $redirectUri, array $extraParameters = array());
/**
* Check whatever CSRF token from request is valid or not
*
* @param string $csrfToken
*
* @return boolean True if CSRF token is valid
*
* @throws AuthenticationException When token is not valid
*/
public function isCsrfTokenValid($csrfToken);
/**
* Return a name for the resource owner.
*
* @return string
*/
public function getName();
/**
* Retrieve an option by name
*
* @param string $name The option name
*
* @return mixed The option value
*
* @throws \InvalidArgumentException When the option does not exist
*/
public function getOption($name);
/**
* Checks whether the class can handle the request.
*
* @param Request $request
*
* @return boolean
*/
public function handles(Request $request);
/**
* Sets a name for the resource owner.
*
* @param string $name
*/
public function setName($name);
}