Skip to content

Commit 78ada2f

Browse files
Merge pull request #139 from nextcloud/backport/auth-check-slave-26
[stable26] auth check on slave
2 parents 9eb21b5 + 7bc4629 commit 78ada2f

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

lib/Controller/SlaveController.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -193,18 +193,14 @@ public function createAppToken($jwt) {
193193

194194
try {
195195
list($uid, $password, $options) = $this->decodeJwt($jwt);
196-
197-
if (is_array($options) && isset($options['backend']) && $options['backend'] === 'saml') {
196+
$saml = (($options['backend'] ?? '') === 'saml');
197+
if ($saml) {
198198
$this->autoprovisionIfNeeded($uid, $options);
199199
}
200200

201201
if ($this->userManager->userExists($uid)) {
202-
// if we have a password, we verify it
203-
if (!empty($password)) {
204-
$result = $this->userSession->login($uid, $password);
205-
} else {
206-
$result = true;
207-
}
202+
// if we have a password, we verify it; if not it means we should be using saml.
203+
$result = ('' === $password) ? $saml : $this->userSession->login($uid, $password);
208204
if ($result) {
209205
$token = $this->tokenHandler->generateAppToken($uid);
210206

0 commit comments

Comments
 (0)