Skip to content

Commit

Permalink
Merge pull request #139 from nextcloud/backport/auth-check-slave-26
Browse files Browse the repository at this point in the history
[stable26] auth check on slave
  • Loading branch information
ArtificialOwl authored Nov 23, 2023
2 parents 9eb21b5 + 7bc4629 commit 78ada2f
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions lib/Controller/SlaveController.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,18 +193,14 @@ public function createAppToken($jwt) {

try {
list($uid, $password, $options) = $this->decodeJwt($jwt);

if (is_array($options) && isset($options['backend']) && $options['backend'] === 'saml') {
$saml = (($options['backend'] ?? '') === 'saml');
if ($saml) {
$this->autoprovisionIfNeeded($uid, $options);
}

if ($this->userManager->userExists($uid)) {
// if we have a password, we verify it
if (!empty($password)) {
$result = $this->userSession->login($uid, $password);
} else {
$result = true;
}
// if we have a password, we verify it; if not it means we should be using saml.
$result = ('' === $password) ? $saml : $this->userSession->login($uid, $password);
if ($result) {
$token = $this->tokenHandler->generateAppToken($uid);

Expand Down

0 comments on commit 78ada2f

Please sign in to comment.