@@ -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 | } |
@@ -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 |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $binding = static::determineBindingToSp($message, $provider); |
80 | 80 | } |
81 | 81 | |
82 | - return static::getService($binding)->send($message, $provider); |
|
82 | + return static::getService($binding)->send($message, $provider); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | |
95 | 95 | switch (true) { |
96 | 96 | case MessageHelper::isRequest($message): |
97 | - if (! $provider->getMetadataModel()->getFirstSpSsoDescriptor()->getFirstAssertionConsumerService( |
|
97 | + if (!$provider->getMetadataModel()->getFirstSpSsoDescriptor()->getFirstAssertionConsumerService( |
|
98 | 98 | SamlConstants::BINDING_SAML2_HTTP_POST |
99 | 99 | )) { |
100 | 100 | if ($provider->getMetadataModel()->getFirstSpSsoDescriptor()->getFirstAssertionConsumerService( |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | |
109 | 109 | break; |
110 | 110 | case MessageHelper::isResponse($message): |
111 | - if (! $provider->getMetadataModel()->getFirstSpSsoDescriptor()->getFirstSingleLogoutService( |
|
111 | + if (!$provider->getMetadataModel()->getFirstSpSsoDescriptor()->getFirstSingleLogoutService( |
|
112 | 112 | SamlConstants::BINDING_SAML2_HTTP_POST |
113 | 113 | )) { |
114 | 114 | if ($provider->getMetadataModel()->getFirstSpSsoDescriptor()->getFirstSingleLogoutService( |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | |
140 | 140 | switch (true) { |
141 | 141 | case MessageHelper::isRequest($message): |
142 | - if (! $provider->getMetadataModel()->getFirstIdpSsoDescriptor()->getFirstSingleSignOnService( |
|
142 | + if (!$provider->getMetadataModel()->getFirstIdpSsoDescriptor()->getFirstSingleSignOnService( |
|
143 | 143 | SamlConstants::BINDING_SAML2_HTTP_POST |
144 | 144 | )) { |
145 | 145 | if ($provider->getMetadataModel()->getFirstIdpSsoDescriptor()->getFirstSingleSignOnService( |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | } |
153 | 153 | break; |
154 | 154 | case MessageHelper::isResponse($message): |
155 | - if (! $provider->getMetadataModel()->getFirstIdpSsoDescriptor()->getFirstSingleLogoutService( |
|
155 | + if (!$provider->getMetadataModel()->getFirstIdpSsoDescriptor()->getFirstSingleLogoutService( |
|
156 | 156 | SamlConstants::BINDING_SAML2_HTTP_POST |
157 | 157 | )) { |
158 | 158 | if ($provider->getMetadataModel()->getFirstIdpSsoDescriptor()->getFirstSingleLogoutService( |
@@ -71,7 +71,7 @@ |
||
71 | 71 | public function save(ProviderIdentityInterface $record, $runValidation = true, $attributeNames = null): ProviderIdentityInterface |
72 | 72 | { |
73 | 73 | |
74 | - if (! $record->save($runValidation, $attributeNames)) { |
|
74 | + if (!$record->save($runValidation, $attributeNames)) { |
|
75 | 75 | throw new \Exception(Json::encode($record->getErrors())); |
76 | 76 | } |
77 | 77 |