@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | ->where('id = :id', [':id' => $clientKey]) |
| 85 | 85 | ->one($this->db); |
| 86 | 86 | if ($entity !== false) { |
| 87 | - throw new DuplicateKeyException('Duplicate key "' . $clientKey . '"'); |
|
| 87 | + throw new DuplicateKeyException('Duplicate key "'.$clientKey.'"'); |
|
| 88 | 88 | } |
| 89 | 89 | $values = $client->getDirtyAttributes($attributes); |
| 90 | 90 | $clientParameters = []; |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | ->where('id = :id', [':id' => $values[$modelKey]]) |
| 163 | 163 | ->one($this->db); |
| 164 | 164 | if ($entity !== false) { |
| 165 | - throw new DuplicateKeyException('Duplicate key "' . $values[$modelKey] . '"'); |
|
| 165 | + throw new DuplicateKeyException('Duplicate key "'.$values[$modelKey].'"'); |
|
| 166 | 166 | } |
| 167 | 167 | } |
| 168 | 168 | $clientKey = isset($values[$modelKey]) ? $values[$modelKey] : $client->getKey(); |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | ->where('id = :id', [':id' => $authCodeKey]) |
| 72 | 72 | ->one($this->db); |
| 73 | 73 | if ($entity !== false) { |
| 74 | - throw new DuplicateKeyException('Duplicate key "' . $authCodeKey . '"'); |
|
| 74 | + throw new DuplicateKeyException('Duplicate key "'.$authCodeKey.'"'); |
|
| 75 | 75 | } |
| 76 | 76 | $values = $authCode->getDirtyAttributes($attributes); |
| 77 | 77 | $authCodeParameters = []; |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | ->where('id = :id', [':id' => $values[$modelKey]]) |
| 138 | 138 | ->one($this->db); |
| 139 | 139 | if ($entity !== false) { |
| 140 | - throw new DuplicateKeyException('Duplicate key "' . $values[$modelKey] . '"'); |
|
| 140 | + throw new DuplicateKeyException('Duplicate key "'.$values[$modelKey].'"'); |
|
| 141 | 141 | } |
| 142 | 142 | } |
| 143 | 143 | $authCodeKey = isset($values[$modelKey]) ? $values[$modelKey] : $authCode->getKey(); |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | ->where('id = :id', [':id' => $scope->id]) |
| 73 | 73 | ->one($this->db); |
| 74 | 74 | if ($entity !== false) { |
| 75 | - throw new DuplicateKeyException('Duplicate key "' . $scope->id . '"'); |
|
| 75 | + throw new DuplicateKeyException('Duplicate key "'.$scope->id.'"'); |
|
| 76 | 76 | } |
| 77 | 77 | $values = $scope->getDirtyAttributes($attributes); |
| 78 | 78 | $scopeParameters = []; |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | ->where('id = :id', [':id' => $values[$modelKey]]) |
| 127 | 127 | ->one($this->db); |
| 128 | 128 | if ($entity !== false) { |
| 129 | - throw new DuplicateKeyException('Duplicate key "' . $values[$modelKey] . '"'); |
|
| 129 | + throw new DuplicateKeyException('Duplicate key "'.$values[$modelKey].'"'); |
|
| 130 | 130 | } |
| 131 | 131 | } |
| 132 | 132 | $scopeKey = isset($values[$modelKey]) ? $values[$modelKey] : $scope->getKey(); |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | ->where('id = :id', [':id' => $cypherKeyKey]) |
| 67 | 67 | ->one($this->db); |
| 68 | 68 | if ($entity !== false) { |
| 69 | - throw new DuplicateKeyException('Duplicate key "' . $cypherKeyKey . '"'); |
|
| 69 | + throw new DuplicateKeyException('Duplicate key "'.$cypherKeyKey.'"'); |
|
| 70 | 70 | } |
| 71 | 71 | $values = $cypherKey->getDirtyAttributes($attributes); |
| 72 | 72 | $cypherKeyParameters = []; |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | ->where('id = :id', [':id' => $values[$modelKey]]) |
| 121 | 121 | ->one($this->db); |
| 122 | 122 | if ($entity !== false) { |
| 123 | - throw new DuplicateKeyException('Duplicate key "' . $values[$modelKey] . '"'); |
|
| 123 | + throw new DuplicateKeyException('Duplicate key "'.$values[$modelKey].'"'); |
|
| 124 | 124 | } |
| 125 | 125 | } |
| 126 | 126 | $cypherKeyKey = isset($values[$modelKey]) ? $values[$modelKey] : $cypherKey->getKey(); |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | ->where('id = :id', [':id' => $jtiKey]) |
| 68 | 68 | ->one($this->db); |
| 69 | 69 | if ($entity !== false) { |
| 70 | - throw new DuplicateKeyException('Duplicate key "' . $jtiKey . '"'); |
|
| 70 | + throw new DuplicateKeyException('Duplicate key "'.$jtiKey.'"'); |
|
| 71 | 71 | } |
| 72 | 72 | $values = $jti->getDirtyAttributes($attributes); |
| 73 | 73 | $jtisParameters = []; |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | ->where('id = :id', [':id' => $values[$modelKey]]) |
| 122 | 122 | ->one($this->db); |
| 123 | 123 | if ($entity !== false) { |
| 124 | - throw new DuplicateKeyException('Duplicate key "' . $values[$modelKey] . '"'); |
|
| 124 | + throw new DuplicateKeyException('Duplicate key "'.$values[$modelKey].'"'); |
|
| 125 | 125 | } |
| 126 | 126 | } |
| 127 | 127 | $jtiKey = isset($values[$modelKey]) ? $values[$modelKey] : $jti->getKey(); |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | /** |
| 193 | 193 | * @var int duration of login time for multiple authorize calls |
| 194 | 194 | */ |
| 195 | - public $loginDuration = 60 * 60 * 24 * 30; |
|
| 195 | + public $loginDuration = 60*60*24*30; |
|
| 196 | 196 | |
| 197 | 197 | /** |
| 198 | 198 | * @var bool configure authorization code (enforce_redirect) |
@@ -273,19 +273,19 @@ discard block |
||
| 273 | 273 | } |
| 274 | 274 | $this->setUpDi($app); |
| 275 | 275 | if (empty($this->baseEndPoint) === false) { |
| 276 | - $this->baseEndPoint = trim($this->baseEndPoint, '/') . '/'; |
|
| 276 | + $this->baseEndPoint = trim($this->baseEndPoint, '/').'/'; |
|
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | if ($app instanceof ConsoleApplication) { |
| 280 | 280 | $this->mapConsoleControllers($app); |
| 281 | 281 | } else { |
| 282 | 282 | $app->getUrlManager()->addRules([ |
| 283 | - ['verb' => 'POST', 'pattern' => $this->baseEndPoint . 'token', 'route' => $this->id . '/token/index'], |
|
| 284 | - ['verb' => 'OPTIONS', 'pattern' => $this->baseEndPoint . 'token', 'route' => $this->id . '/token/options'], |
|
| 285 | - ['verb' => 'GET', 'pattern' => $this->baseEndPoint . 'authorize', 'route' => $this->id . '/authorize/index'], |
|
| 286 | - ['pattern' => $this->baseEndPoint . 'authorize-login', 'route' => $this->id . '/authorize/login'], |
|
| 287 | - ['pattern' => $this->baseEndPoint . 'authorize-application', 'route' => $this->id . '/authorize/authorize'], |
|
| 288 | - ['pattern' => $this->baseEndPoint . 'authorize-error', 'route' => $this->id . '/authorize/error'], |
|
| 283 | + ['verb' => 'POST', 'pattern' => $this->baseEndPoint.'token', 'route' => $this->id.'/token/index'], |
|
| 284 | + ['verb' => 'OPTIONS', 'pattern' => $this->baseEndPoint.'token', 'route' => $this->id.'/token/options'], |
|
| 285 | + ['verb' => 'GET', 'pattern' => $this->baseEndPoint.'authorize', 'route' => $this->id.'/authorize/index'], |
|
| 286 | + ['pattern' => $this->baseEndPoint.'authorize-login', 'route' => $this->id.'/authorize/login'], |
|
| 287 | + ['pattern' => $this->baseEndPoint.'authorize-application', 'route' => $this->id.'/authorize/authorize'], |
|
| 288 | + ['pattern' => $this->baseEndPoint.'authorize-error', 'route' => $this->id.'/authorize/error'], |
|
| 289 | 289 | ]); |
| 290 | 290 | } |
| 291 | 291 | } |
@@ -63,13 +63,13 @@ discard block |
||
| 63 | 63 | $scope->isDefault = (bool)$this->isDefault; |
| 64 | 64 | $scope->definition = $this->definition; |
| 65 | 65 | if ($scope->save() === true) { |
| 66 | - $this->stdout('Scope created :' . "\n"); |
|
| 67 | - $this->stdout(' - id: ' . $scope->id . "\n"); |
|
| 68 | - $this->stdout(' - isDefault: ' . ($scope->isDefault ? 'Yes' : 'No') . "\n"); |
|
| 69 | - $this->stdout(' - definition: ' . $scope->definition . "\n"); |
|
| 66 | + $this->stdout('Scope created :'."\n"); |
|
| 67 | + $this->stdout(' - id: '.$scope->id."\n"); |
|
| 68 | + $this->stdout(' - isDefault: '.($scope->isDefault ? 'Yes' : 'No')."\n"); |
|
| 69 | + $this->stdout(' - definition: '.$scope->definition."\n"); |
|
| 70 | 70 | return ExitCode::OK; |
| 71 | 71 | } else { |
| 72 | - $this->stdout('Scope cannot be created.' . "\n"); |
|
| 72 | + $this->stdout('Scope cannot be created.'."\n"); |
|
| 73 | 73 | return ExitCode::UNSPECIFIED_ERROR; |
| 74 | 74 | } |
| 75 | 75 | } |
@@ -91,17 +91,17 @@ discard block |
||
| 91 | 91 | $scope->isDefault = $this->isDefault; |
| 92 | 92 | $scope->definition = $this->definition; |
| 93 | 93 | if ($scope->save() === true) { |
| 94 | - $this->stdout('Scope updated :' . "\n"); |
|
| 95 | - $this->stdout(' - id: ' . $scope->id . "\n"); |
|
| 96 | - $this->stdout(' - isDefault: ' . ($scope->isDefault ? 'Yes' : 'No') . "\n"); |
|
| 97 | - $this->stdout(' - definition: ' . $scope->definition . "\n"); |
|
| 94 | + $this->stdout('Scope updated :'."\n"); |
|
| 95 | + $this->stdout(' - id: '.$scope->id."\n"); |
|
| 96 | + $this->stdout(' - isDefault: '.($scope->isDefault ? 'Yes' : 'No')."\n"); |
|
| 97 | + $this->stdout(' - definition: '.$scope->definition."\n"); |
|
| 98 | 98 | return ExitCode::OK; |
| 99 | 99 | } else { |
| 100 | - $this->stdout('Scope ' . $id . ' cannot be updated' . "\n"); |
|
| 100 | + $this->stdout('Scope '.$id.' cannot be updated'."\n"); |
|
| 101 | 101 | return ExitCode::UNSPECIFIED_ERROR; |
| 102 | 102 | } |
| 103 | 103 | } else { |
| 104 | - $this->stdout('Scope ' . $id . ' does not exist' . "\n"); |
|
| 104 | + $this->stdout('Scope '.$id.' does not exist'."\n"); |
|
| 105 | 105 | return ExitCode::UNSPECIFIED_ERROR; |
| 106 | 106 | } |
| 107 | 107 | } |
@@ -121,14 +121,14 @@ discard block |
||
| 121 | 121 | $scope = $scopeClass::findOne($id); |
| 122 | 122 | if ($scope !== null) { |
| 123 | 123 | if ($scope->delete() === true) { |
| 124 | - $this->stdout('Scope ' . $id . ' deleted' . "\n"); |
|
| 124 | + $this->stdout('Scope '.$id.' deleted'."\n"); |
|
| 125 | 125 | return ExitCode::OK; |
| 126 | 126 | } else { |
| 127 | - $this->stdout('Scope ' . $id . ' cannot be deleted' . "\n"); |
|
| 127 | + $this->stdout('Scope '.$id.' cannot be deleted'."\n"); |
|
| 128 | 128 | return ExitCode::UNSPECIFIED_ERROR; |
| 129 | 129 | } |
| 130 | 130 | } else { |
| 131 | - $this->stdout('Scope ' . $id . ' does not exist' . "\n"); |
|
| 131 | + $this->stdout('Scope '.$id.' does not exist'."\n"); |
|
| 132 | 132 | return ExitCode::UNSPECIFIED_ERROR; |
| 133 | 133 | } |
| 134 | 134 | } |
@@ -79,14 +79,14 @@ discard block |
||
| 79 | 79 | $client->scopes = empty($this->scopes) ? null : explode(',', $this->scopes); |
| 80 | 80 | $client->grantTypes = empty($this->grantTypes) ? null : explode(',', $this->grantTypes); |
| 81 | 81 | if ($client->save() === true) { |
| 82 | - $this->stdout('Client created :' . "\n"); |
|
| 83 | - $this->stdout(' - id: ' . $client->id . "\n"); |
|
| 84 | - $this->stdout(' - secret: ' . $client->secret . "\n"); |
|
| 85 | - $this->stdout(' - name: ' . $client->name . "\n"); |
|
| 86 | - $this->stdout(' - redirectUri: ' . implode(',', $client->redirectUri) . "\n"); |
|
| 82 | + $this->stdout('Client created :'."\n"); |
|
| 83 | + $this->stdout(' - id: '.$client->id."\n"); |
|
| 84 | + $this->stdout(' - secret: '.$client->secret."\n"); |
|
| 85 | + $this->stdout(' - name: '.$client->name."\n"); |
|
| 86 | + $this->stdout(' - redirectUri: '.implode(',', $client->redirectUri)."\n"); |
|
| 87 | 87 | return ExitCode::OK; |
| 88 | 88 | } else { |
| 89 | - $this->stdout('Client cannot be created.' . "\n"); |
|
| 89 | + $this->stdout('Client cannot be created.'."\n"); |
|
| 90 | 90 | return ExitCode::UNSPECIFIED_ERROR; |
| 91 | 91 | } |
| 92 | 92 | } |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | protected function getRandomString($length = 40) |
| 101 | 101 | { |
| 102 | - $bytes = (int)$length / 2; |
|
| 102 | + $bytes = (int)$length/2; |
|
| 103 | 103 | return bin2hex(openssl_random_pseudo_bytes($bytes)); |
| 104 | 104 | } |
| 105 | 105 | |
@@ -124,18 +124,18 @@ discard block |
||
| 124 | 124 | $client->scopes = empty($this->scopes) ? null : explode(',', $this->scopes); |
| 125 | 125 | $client->grantTypes = empty($this->grantTypes) ? null : explode(',', $this->grantTypes); |
| 126 | 126 | if ($client->save() === true) { |
| 127 | - $this->stdout('Client updated :' . "\n"); |
|
| 128 | - $this->stdout(' - id: ' . $client->id . "\n"); |
|
| 129 | - $this->stdout(' - secret: ' . $client->secret . "\n"); |
|
| 130 | - $this->stdout(' - name: ' . $client->name . "\n"); |
|
| 131 | - $this->stdout(' - redirectUri: ' . implode(',', $client->redirectUri) . "\n"); |
|
| 127 | + $this->stdout('Client updated :'."\n"); |
|
| 128 | + $this->stdout(' - id: '.$client->id."\n"); |
|
| 129 | + $this->stdout(' - secret: '.$client->secret."\n"); |
|
| 130 | + $this->stdout(' - name: '.$client->name."\n"); |
|
| 131 | + $this->stdout(' - redirectUri: '.implode(',', $client->redirectUri)."\n"); |
|
| 132 | 132 | return ExitCode::OK; |
| 133 | 133 | } else { |
| 134 | - $this->stdout('Client ' . $id . ' cannot be updated.' . "\n"); |
|
| 134 | + $this->stdout('Client '.$id.' cannot be updated.'."\n"); |
|
| 135 | 135 | return ExitCode::UNSPECIFIED_ERROR; |
| 136 | 136 | } |
| 137 | 137 | } else { |
| 138 | - $this->stdout('Client ' . $id . ' does not exist' . "\n"); |
|
| 138 | + $this->stdout('Client '.$id.' does not exist'."\n"); |
|
| 139 | 139 | return ExitCode::UNSPECIFIED_ERROR; |
| 140 | 140 | } |
| 141 | 141 | } |
@@ -155,14 +155,14 @@ discard block |
||
| 155 | 155 | $client = $clientClass::findOne($id); |
| 156 | 156 | if ($client !== null) { |
| 157 | 157 | if ($client->delete() === true) { |
| 158 | - $this->stdout('Client ' . $id . ' deleted' . "\n"); |
|
| 158 | + $this->stdout('Client '.$id.' deleted'."\n"); |
|
| 159 | 159 | return ExitCode::OK; |
| 160 | 160 | } else { |
| 161 | - $this->stdout('Client ' . $id . ' cannot be deleted.' . "\n"); |
|
| 161 | + $this->stdout('Client '.$id.' cannot be deleted.'."\n"); |
|
| 162 | 162 | return ExitCode::UNSPECIFIED_ERROR; |
| 163 | 163 | } |
| 164 | 164 | } else { |
| 165 | - $this->stdout('Client ' . $id . ' does not exist' . "\n"); |
|
| 165 | + $this->stdout('Client '.$id.' does not exist'."\n"); |
|
| 166 | 166 | return ExitCode::UNSPECIFIED_ERROR; |
| 167 | 167 | } |
| 168 | 168 | } |
@@ -84,12 +84,12 @@ discard block |
||
| 84 | 84 | $cypherKey->generateKeys(); |
| 85 | 85 | } |
| 86 | 86 | if ($cypherKey->save() === true) { |
| 87 | - $this->stdout('Key created :' . "\n"); |
|
| 88 | - $this->stdout(' - id: ' . $cypherKey->id . "\n"); |
|
| 89 | - $this->stdout(' - Algorithm: ' . $cypherKey->encryptionAlgorithm . "\n"); |
|
| 87 | + $this->stdout('Key created :'."\n"); |
|
| 88 | + $this->stdout(' - id: '.$cypherKey->id."\n"); |
|
| 89 | + $this->stdout(' - Algorithm: '.$cypherKey->encryptionAlgorithm."\n"); |
|
| 90 | 90 | return ExitCode::OK; |
| 91 | 91 | } else { |
| 92 | - $this->stdout('Key cannot be created.' . "\n"); |
|
| 92 | + $this->stdout('Key cannot be created.'."\n"); |
|
| 93 | 93 | return ExitCode::UNSPECIFIED_ERROR; |
| 94 | 94 | } |
| 95 | 95 | } |
@@ -122,16 +122,16 @@ discard block |
||
| 122 | 122 | $cypherKey->generateKeys(); |
| 123 | 123 | } |
| 124 | 124 | if ($cypherKey->save() === true) { |
| 125 | - $this->stdout('Key updated :' . "\n"); |
|
| 126 | - $this->stdout(' - id: ' . $cypherKey->id . "\n"); |
|
| 127 | - $this->stdout(' - Algorithm: ' . $cypherKey->encryptionAlgorithm . "\n"); |
|
| 125 | + $this->stdout('Key updated :'."\n"); |
|
| 126 | + $this->stdout(' - id: '.$cypherKey->id."\n"); |
|
| 127 | + $this->stdout(' - Algorithm: '.$cypherKey->encryptionAlgorithm."\n"); |
|
| 128 | 128 | return ExitCode::OK; |
| 129 | 129 | } else { |
| 130 | - $this->stdout('Key ' . $id . ' cannot be updated' . "\n"); |
|
| 130 | + $this->stdout('Key '.$id.' cannot be updated'."\n"); |
|
| 131 | 131 | return ExitCode::UNSPECIFIED_ERROR; |
| 132 | 132 | } |
| 133 | 133 | } else { |
| 134 | - $this->stdout('Key ' . $id . ' does not exist' . "\n"); |
|
| 134 | + $this->stdout('Key '.$id.' does not exist'."\n"); |
|
| 135 | 135 | return ExitCode::UNSPECIFIED_ERROR; |
| 136 | 136 | } |
| 137 | 137 | } |
@@ -151,14 +151,14 @@ discard block |
||
| 151 | 151 | $cypherKey = $cypherKeyClass::findOne($id); |
| 152 | 152 | if ($cypherKey !== null) { |
| 153 | 153 | if ($cypherKey->delete() === true) { |
| 154 | - $this->stdout('Key ' . $id . ' deleted' . "\n"); |
|
| 154 | + $this->stdout('Key '.$id.' deleted'."\n"); |
|
| 155 | 155 | return ExitCode::OK; |
| 156 | 156 | } else { |
| 157 | - $this->stdout('Key ' . $id . ' cannot be deleted' . "\n"); |
|
| 157 | + $this->stdout('Key '.$id.' cannot be deleted'."\n"); |
|
| 158 | 158 | return ExitCode::UNSPECIFIED_ERROR; |
| 159 | 159 | } |
| 160 | 160 | } else { |
| 161 | - $this->stdout('Key ' . $id . ' does not exist' . "\n"); |
|
| 161 | + $this->stdout('Key '.$id.' does not exist'."\n"); |
|
| 162 | 162 | return ExitCode::UNSPECIFIED_ERROR; |
| 163 | 163 | } |
| 164 | 164 | } |