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