Skip to content

Commit

Permalink
auth check on slave
Browse files Browse the repository at this point in the history
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
  • Loading branch information
ArtificialOwl committed Nov 23, 2023
1 parent 9eb21b5 commit 7bc4629
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 7bc4629

Please sign in to comment.