@@ -123,7 +123,7 @@ |
||
| 123 | 123 | { |
| 124 | 124 | $algorithm = $reader->getAlgorithm(); |
| 125 | 125 | |
| 126 | - if (! in_array($algorithm, [ |
|
| 126 | + if (!in_array($algorithm, [ |
|
| 127 | 127 | XMLSecurityKey::RSA_SHA1, |
| 128 | 128 | XMLSecurityKey::RSA_SHA256, |
| 129 | 129 | XMLSecurityKey::RSA_SHA384, |
@@ -39,7 +39,7 @@ |
||
| 39 | 39 | |
| 40 | 40 | protected function installKeyChain() |
| 41 | 41 | { |
| 42 | - if (! \Craft::$app->plugins->getPlugin('keychain')) { |
|
| 42 | + if (!\Craft::$app->plugins->getPlugin('keychain')) { |
|
| 43 | 43 | \Craft::$app->plugins->installPlugin('keychain'); |
| 44 | 44 | } |
| 45 | 45 | } |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | public function beforeSave($insert) |
| 36 | 36 | { |
| 37 | - if (! $this->entityId) { |
|
| 37 | + if (!$this->entityId) { |
|
| 38 | 38 | $this->entityId = $this->getEntityId(); |
| 39 | 39 | } |
| 40 | 40 | $this->sha256 = hash(static::METADATA_HASH_ALGO, $this->metadata); |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | */ |
| 59 | 59 | public function getMetadataModel(): EntityDescriptor |
| 60 | 60 | { |
| 61 | - if (! $this->metadataModel) { |
|
| 61 | + if (!$this->metadataModel) { |
|
| 62 | 62 | $this->metadataModel = EntityDescriptor::loadXml($this->metadata); |
| 63 | 63 | } |
| 64 | 64 | |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | |
| 26 | 26 | public function getUser() |
| 27 | 27 | { |
| 28 | - if (! $this->user) { |
|
| 28 | + if (!$this->user) { |
|
| 29 | 29 | $this->user = \Craft::$app->getUsers()->getUserById( |
| 30 | 30 | $this->userId |
| 31 | 31 | ); |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | /** |
| 52 | 52 | * Register Core Module on Craft |
| 53 | 53 | */ |
| 54 | - if (! \Craft::$app->getModule(Saml::MODULE_ID)) { |
|
| 54 | + if (!\Craft::$app->getModule(Saml::MODULE_ID)) { |
|
| 55 | 55 | \Craft::$app->setModule(Saml::MODULE_ID, [ |
| 56 | 56 | 'class' => Saml::class |
| 57 | 57 | ]); |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | Event::on( |
| 78 | 78 | View::class, |
| 79 | 79 | View::EVENT_REGISTER_CP_TEMPLATE_ROOTS, |
| 80 | - function (RegisterTemplateRootsEvent $e) { |
|
| 80 | + function(RegisterTemplateRootsEvent $e) { |
|
| 81 | 81 | if (is_dir($baseDir = Saml::getTemplateRoot())) { |
| 82 | 82 | $e->roots[Saml::getTemplateRootKey($this)] = $baseDir; |
| 83 | 83 | } |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | */ |
| 38 | 38 | public function getEntityId() |
| 39 | 39 | { |
| 40 | - if (! $this->entityId) { |
|
| 40 | + if (!$this->entityId) { |
|
| 41 | 41 | $this->entityId = UrlHelper::baseUrl(); |
| 42 | 42 | } |
| 43 | 43 | |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | ); |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - if (! $this->keyPairId) { |
|
| 115 | + if (!$this->keyPairId) { |
|
| 116 | 116 | $this->keyPairId = null; |
| 117 | 117 | $this->createKeyPair = true; |
| 118 | 118 | } |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | { |
| 129 | 129 | |
| 130 | 130 | $this->newProviderRecord([]); |
| 131 | - if (! $this->keyPairId) { |
|
| 131 | + if (!$this->keyPairId) { |
|
| 132 | 132 | $this->chooseFromKeyChain(); |
| 133 | 133 | } |
| 134 | 134 | |
@@ -136,14 +136,14 @@ discard block |
||
| 136 | 136 | if ($this->keyPairId === null && $this->createKeyPair) { |
| 137 | 137 | $openSslConfig = $this->promptKeyPair(); |
| 138 | 138 | $keyPairRecord = $openSslConfig->create(); |
| 139 | - if (! KeyChain::getInstance()->getService()->save($keyPairRecord)) { |
|
| 139 | + if (!KeyChain::getInstance()->getService()->save($keyPairRecord)) { |
|
| 140 | 140 | $this->stderr( |
| 141 | 141 | sprintf('Failed to save new key pair to the database') . PHP_EOL |
| 142 | 142 | , Console::FG_RED); |
| 143 | 143 | return ExitCode::DATAERR; |
| 144 | 144 | } |
| 145 | 145 | } else if ($this->keyPairId) { |
| 146 | - if (! ($keyPairRecord = KeyChainRecord::findOne([ |
|
| 146 | + if (!($keyPairRecord = KeyChainRecord::findOne([ |
|
| 147 | 147 | 'id' => $this->keyPairId, |
| 148 | 148 | ]))) { |
| 149 | 149 | $this->stderr( |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | public function actionImport($file, $type) |
| 186 | 186 | { |
| 187 | 187 | |
| 188 | - if (! in_array($type, ['idp', 'sp'])) { |
|
| 188 | + if (!in_array($type, ['idp', 'sp'])) { |
|
| 189 | 189 | throw new \InvalidArgumentException('Type must be idp or sp'); |
| 190 | 190 | } |
| 191 | 191 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | return $this->cache[$condition['entityId']]; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - if (! $provider = $class::find()->where($condition)->one()) { |
|
| 53 | + if (!$provider = $class::find()->where($condition)->one()) { |
|
| 54 | 54 | return null; |
| 55 | 55 | } |
| 56 | 56 | |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | */ |
| 81 | 81 | protected function findByType($type) |
| 82 | 82 | { |
| 83 | - if (! in_array($type, ['sp', 'idp'])) { |
|
| 83 | + if (!in_array($type, ['sp', 'idp'])) { |
|
| 84 | 84 | throw new \InvalidArgumentException("Type must be idp or sp."); |
| 85 | 85 | } |
| 86 | 86 | return $this->find([ |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | //save record |
| 138 | - if (! $record->save($runValidation, $attributeNames)) { |
|
| 138 | + if (!$record->save($runValidation, $attributeNames)) { |
|
| 139 | 139 | throw new \Exception(Json::encode($record->getErrors())); |
| 140 | 140 | } |
| 141 | 141 | |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | $attributeNames = null |
| 160 | 160 | ) |
| 161 | 161 | { |
| 162 | - if (! $provider->id && ! $keyChain->id) { |
|
| 162 | + if (!$provider->id && !$keyChain->id) { |
|
| 163 | 163 | throw new \Exception('Provider id and keychain id must exist before linking.'); |
| 164 | 164 | } |
| 165 | 165 | $linkAttributes = [ |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | ]; |
| 168 | 168 | |
| 169 | 169 | /** @var LinkRecord $link */ |
| 170 | - if (! $link = LinkRecord::find()->where($linkAttributes)->one()) { |
|
| 170 | + if (!$link = LinkRecord::find()->where($linkAttributes)->one()) { |
|
| 171 | 171 | $link = new LinkRecord($linkAttributes); |
| 172 | 172 | } |
| 173 | 173 | |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | $link, |
| 177 | 177 | $linkAttributes |
| 178 | 178 | ); |
| 179 | - if (! $link->save($runValidation, $attributeNames)) { |
|
| 179 | + if (!$link->save($runValidation, $attributeNames)) { |
|
| 180 | 180 | throw new \Exception(Json::encode($record->getErrors())); |
| 181 | 181 | } |
| 182 | 182 | } |
@@ -119,8 +119,9 @@ |
||
| 119 | 119 | 'metadata' => SerializeHelper::toXml($entityDescriptor), |
| 120 | 120 | ]); |
| 121 | 121 | |
| 122 | - if ($keyChainRecord) |
|
| 123 | - $provider->setKeychain($keyChainRecord); |
|
| 122 | + if ($keyChainRecord) { |
|
| 123 | + $provider->setKeychain($keyChainRecord); |
|
| 124 | + } |
|
| 124 | 125 | |
| 125 | 126 | return $provider; |
| 126 | 127 | } |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | $provider = $this->getSamlPlugin()->getProvider()->findByEntityId( |
| 44 | 44 | $issuer->getValue() |
| 45 | 45 | ); |
| 46 | - if (! $provider) { |
|
| 46 | + if (!$provider) { |
|
| 47 | 47 | throw new InvalidIssuer( |
| 48 | 48 | sprintf("Invalid issuer: %s", $issuer->getValue()) |
| 49 | 49 | ); |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | /** |
| 157 | 157 | * Validate Signature |
| 158 | 158 | */ |
| 159 | - if ($message->getSignature() && ! SecurityHelper::validSignature($message, $key)) { |
|
| 159 | + if ($message->getSignature() && !SecurityHelper::validSignature($message, $key)) { |
|
| 160 | 160 | throw new InvalidSignature("Invalid request", 400); |
| 161 | 161 | } |
| 162 | 162 | |