1 | <?php |
||
37 | class Module extends BaseModule implements BootstrapInterface |
||
38 | { |
||
39 | /** |
||
40 | * @var string backend to use, available backends are 'redis' or 'mysql |
||
41 | */ |
||
42 | public $backend; |
||
43 | |||
44 | /** |
||
45 | * @var Connection|array|string the DB connection object or the application component ID of the DB connection. |
||
46 | */ |
||
47 | public $db; |
||
48 | |||
49 | /** |
||
50 | * @var string override layout. For example @app/views/layouts/oauth2 to use <app>/views/layouts/oauth2.php layout |
||
51 | */ |
||
52 | public $overrideLayout; |
||
53 | |||
54 | /** |
||
55 | * @var string override view path. For example @app/views/oauth2 to use <app>/views/oauth2/(authorize|login|error) views |
||
56 | */ |
||
57 | public $overrideViewPath; |
||
58 | |||
59 | /** |
||
60 | * This user class will be used to link oauth2 authorization system with the application. |
||
61 | * The class must implement \sweelix\oauth2\server\interfaces\UserInterface |
||
62 | * If not defined, the Yii::$app->user->identityClass value will be used |
||
63 | * @var string|array user class definition. |
||
64 | */ |
||
65 | public $identityClass; |
||
66 | |||
67 | /** |
||
68 | * @var string used to separate user session between this module and current application |
||
69 | */ |
||
70 | public $webUserParamId = '__oauth2'; |
||
71 | |||
72 | /** |
||
73 | * @var string used to separate identity cookies between this module and current application |
||
74 | */ |
||
75 | public $identityCookieName = 'oauth2'; |
||
76 | |||
77 | /** |
||
78 | * @var array webUser configuration specific to this module |
||
79 | */ |
||
80 | public $webUser = []; |
||
81 | |||
82 | /** |
||
83 | * @var string change base end point |
||
84 | */ |
||
85 | public $baseEndPoint = ''; |
||
86 | |||
87 | /** |
||
88 | * @var bool configure oauth server (use_jwt_access_tokens) |
||
89 | */ |
||
90 | public $useJwtAccessToken = false; // WARNING: Not sure about the implementation. Use at your own risk ! |
||
91 | |||
92 | /** |
||
93 | * @var array configure oauth server (allowed_algorithms) |
||
94 | */ |
||
95 | public $allowAlgorithm = ['RS256', 'RS384', 'RS512']; |
||
96 | |||
97 | /** |
||
98 | * @var string|array jwt audience. Default to token endpoint |
||
99 | */ |
||
100 | public $jwtAudience = ['token/index']; |
||
101 | |||
102 | /** |
||
103 | * @var bool configure oauth server (store_encrypted_token_string) |
||
104 | */ |
||
105 | public $storeEncryptedTokenString = true; |
||
106 | |||
107 | /** |
||
108 | * @var bool configure oauth server (use_openid_connect) |
||
109 | */ |
||
110 | public $allowOpenIdConnect = false; |
||
111 | |||
112 | /** |
||
113 | * @var int configure oauth server (id_lifetime) |
||
114 | */ |
||
115 | public $idTTL = 3600; |
||
116 | |||
117 | /** |
||
118 | * @var int configure oauth server (access_lifetime) |
||
119 | */ |
||
120 | public $accessTokenTTL = 3600; |
||
121 | |||
122 | /** |
||
123 | * @var int configure oauth server (refresh_token_lifetime) |
||
124 | */ |
||
125 | public $refreshTokenTTL = 1209600; |
||
126 | |||
127 | /** |
||
128 | * @var string configure oauth server (www_realm) |
||
129 | */ |
||
130 | public $realm = 'Service'; |
||
131 | |||
132 | /** |
||
133 | * @var string configure oauth server (token_param_name) |
||
134 | */ |
||
135 | public $tokenQueryName = 'access_token'; |
||
136 | |||
137 | /** |
||
138 | * @var string configure oauth server (token_bearer_header_name) |
||
139 | */ |
||
140 | public $tokenBearerName = 'Bearer'; |
||
141 | |||
142 | /** |
||
143 | * @var bool configure oauth server (enforce_state) |
||
144 | */ |
||
145 | public $enforceState = true; |
||
146 | |||
147 | /** |
||
148 | * @var bool configure oauth server (require_exact_redirect_uri) |
||
149 | */ |
||
150 | public $allowOnlyRedirectUri = true; |
||
151 | |||
152 | /** |
||
153 | * @var bool configure oauth server (allow_implicit) |
||
154 | */ |
||
155 | public $allowImplicit = false; |
||
156 | |||
157 | /** |
||
158 | * @var bool allow authorization code grant |
||
159 | */ |
||
160 | public $allowAuthorizationCode = true; |
||
161 | |||
162 | /** |
||
163 | * @var bool allow client credentials grant |
||
164 | */ |
||
165 | public $allowClientCredentials = true; |
||
166 | |||
167 | /** |
||
168 | * @var bool allow password grant |
||
169 | */ |
||
170 | public $allowPassword = true; |
||
171 | |||
172 | /** |
||
173 | * @var bool configure oauth server (allow_credentials_in_request_body) |
||
174 | */ |
||
175 | public $allowCredentialsInRequestBody = true; |
||
176 | |||
177 | /** |
||
178 | * @var bool configure oauth server (allow_public_clients) |
||
179 | */ |
||
180 | public $allowPublicClients = true; |
||
181 | |||
182 | /** |
||
183 | * @var bool configure oauth server (always_issue_new_refresh_token) |
||
184 | */ |
||
185 | public $alwaysIssueNewRefreshToken = true; |
||
186 | |||
187 | /** |
||
188 | * @var bool configure oauth server (unset_refresh_token_after_use) |
||
189 | */ |
||
190 | public $unsetRefreshTokenAfterUse = false; |
||
191 | |||
192 | /** |
||
193 | * @var int duration of login time for multiple authorize calls |
||
194 | */ |
||
195 | public $loginDuration = 60 * 60 * 24 * 30; |
||
196 | |||
197 | /** |
||
198 | * @var bool configure authorization code (enforce_redirect) |
||
199 | */ |
||
200 | public $enforceRedirect = false; |
||
201 | |||
202 | /** |
||
203 | * @var int configure authorization code (auth_code_lifetime) |
||
204 | */ |
||
205 | public $authorizationCodeTTL = 30; |
||
206 | |||
207 | /** |
||
208 | * @var false|array Cors configuration if allowed @see http://www.yiiframework.com/doc-2.0/yii-filters-cors.html |
||
209 | */ |
||
210 | public $cors = false; |
||
211 | |||
212 | /** |
||
213 | * @inheritdoc |
||
214 | 52 | */ |
|
215 | public function init() |
||
219 | |||
220 | /** |
||
221 | * Load dataservices in container |
||
222 | * @param \yii\base\Application $app |
||
223 | * @since 1.0.0 |
||
224 | 52 | */ |
|
225 | protected function setUpDi($app) |
||
264 | |||
265 | /** |
||
266 | 52 | * @inheritdoc |
|
267 | */ |
||
268 | public function bootstrap($app) |
||
292 | |||
293 | /** |
||
294 | 17 | * @inheritdoc |
|
295 | */ |
||
296 | 17 | public function beforeAction($action) |
|
315 | |||
316 | /** |
||
317 | * Update controllers map to add console commands |
||
318 | * @param ConsoleApplication $app |
||
319 | 40 | * @since 1.0.0 |
|
320 | */ |
||
321 | 40 | protected function mapConsoleControllers(ConsoleApplication $app) |
|
342 | } |
||
343 |