Blame view

common/components/nodge/eauth/src/IAuthService.php 2.5 KB
f91c1ae8   Dmitryi   new commit compon...
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
  <?php
  /**
   * IAuthService interface file.
   *
   * @author Maxim Zemskov <nodge@yandex.ru>
   * @link http://github.com/Nodge/yii-eauth/
   * @license http://www.opensource.org/licenses/bsd-license.php
   */
  
  namespace common\modules\nodge\eauth\src\eauth;
  
  /**
   * IAuthService is the interface for all service types and providers.
   *
   * @package application.extensions.eauth
   */
  interface IAuthService
  {
  
  	/**
  	 * Returns service name(id).
  	 */
  	public function getServiceName();
  
  	/**
  	 * Returns service title.
  	 */
  	public function getServiceTitle();
  
  	/**
  	 * Returns service type (e.g. OpenID, OAuth).
  	 */
  	public function getServiceType();
  
  	/**
  	 * Returns arguments for the jQuery.eauth() javascript function.
  	 */
  	public function getJsArguments();
  
  
  	/**
  	 * Sets {@link EAuth} application component
  	 *
  	 * @param EAuth $component the application auth component.
  	 */
  	public function setComponent($component);
  
  	/**
  	 * Returns the {@link EAuth} application component.
  	 */
  	public function getComponent();
  
  
  	/**
  	 * Sets redirect url after successful authorization.
  	 *
  	 * @param string $url url to redirect.
  	 */
  	public function setRedirectUrl($url);
  
  	/**
  	 * Returns the redirect url after successful authorization.
  	 */
  	public function getRedirectUrl();
  
  
  	/**
  	 * Sets redirect url after unsuccessful authorization (e.g. user canceled).
  	 *
  	 * @param string $url url to redirect.
  	 */
  	public function setCancelUrl($url);
  
  	/**
  	 * Returns the redirect url after unsuccessful authorization (e.g. user canceled).
  	 */
  	public function getCancelUrl();
  
  
  	/**
  	 * Authenticate the user.
  	 */
  	public function authenticate();
  
  	/**
  	 * Whether user was successfuly authenticated.
  	 */
  	public function getIsAuthenticated();
  
  
  	/**
  	 * Redirect to the url. If url is null, {@link redirectUrl} will be used.
  	 *
  	 * @param string $url url to redirect.
  	 */
  	public function redirect($url = null);
  
  	/**
  	 * Redirect to the {@link cancelUrl} or simply close the popup window.
  	 */
  	public function cancel();
  
  
  	/**
  	 * Returns the user unique id.
  	 */
  	public function getId();
  
  	/**
  	 * Returns the array that contains all available authorization attributes.
  	 */
  	public function getAttributes();
  
  	/**
  	 * Returns the authorization attribute value.
  	 *
  	 * @param string $key the attribute name.
  	 * @param mixed $default the default value.
  	 */
  	public function getAttribute($key, $default = null);
  
  	/**
  	 * Whether the authorization attribute exists.
  	 *
  	 * @param string $key the attribute name.
  	 */
  	public function hasAttribute($key);
  
  }