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