-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add "MFA Verified" check to workflowengine #39471
Closed
+125
−3
Closed
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
7b2e541
Merge pull request #160 from nextcloud/master
mrvahedi68 fd70879
Merge pull request #293 from michielbdejong/master
mrvahedi68 dffb571
Merge pull request #312 from nextcloud/master
mrvahedi68 d576c96
Merge branch 'nextcloud:master' into master
mrvahedi68 0f0d0f1
Merge branch 'nextcloud:master' into master
mrvahedi68 7110544
Merge branch 'michielbdejong:master' into master
mrvahedi68 a6d431e
Merge branch 'nextcloud:master' into master
mrvahedi68 6cac3c0
Merge branch 'michielbdejong:master' into master
mrvahedi68 0f3be90
Merge branch 'nextcloud:master' into master
mrvahedi68 3ae0491
Merge branch 'michielbdejong:master' into master
mrvahedi68 bae48ad
Merge branch 'nextcloud:master' into master
mrvahedi68 aa9b32f
Merge branch 'michielbdejong:master' into master
mrvahedi68 037bbc2
Merge branch 'nextcloud:master' into master
mrvahedi68 c88cbbd
Merge branch 'michielbdejong:master' into master
mrvahedi68 fb5841f
Merge branch 'nextcloud:master' into master
mrvahedi68 eefa759
Merge branch 'michielbdejong:master' into master
mrvahedi68 7ea7f9e
add MFA check to workflow
mrvahedi68 6466ceb
rebuild assets
mrvahedi68 eccf0e1
fix lint error
mrvahedi68 ad38523
Merge branch 'nextcloud:master' into master
mrvahedi68 a0d4e45
Merge branch 'michielbdejong:master' into master
mrvahedi68 2977c0f
Merge branch 'master' into mrv/mfa-check-final
mrvahedi68 6c353f0
rebuild assets
mrvahedi68 9782968
Merge branch 'master' into mrv/mfa-check-final
mrvahedi68 c716f8e
Merge branch 'master' into mrv/mfa-check-final
mrvahedi68 a808def
Merge branch 'master' into mrv/mfa-check-final
mrvahedi68 e206efd
Merge branch 'master' into mrv/mfa-check-final
mrvahedi68 cdd894e
Merge branch 'master' into mrv/mfa-check-final
mrvahedi68 6300588
Merge branch 'nextcloud:master' into master
mrvahedi68 7a89553
Merge branch 'michielbdejong:master' into master
mrvahedi68 ffd0c23
Merge branch 'master' into mrv/mfa-check-final
mrvahedi68 ded18c9
rebuild assets
mrvahedi68 50984e4
Merge branch 'master' into mrv/mfa-check-final
mrvahedi68 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
<?php | ||
/** | ||
* @copyright Copyright (c) 2016 Joas Schilling <[email protected]> | ||
* | ||
* @author Arthur Schiwon <[email protected]> | ||
* @author Christoph Wurst <[email protected]> | ||
* @author Joas Schilling <[email protected]> | ||
* @author Julius Härtl <[email protected]> | ||
* @author Richard Steinmetz <[email protected]> | ||
* | ||
* @license GNU AGPL version 3 or any later version | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as | ||
* published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
namespace OCA\WorkflowEngine\Check; | ||
|
||
use OCP\IL10N; | ||
use OCP\WorkflowEngine\ICheck; | ||
use OCP\ISession; | ||
|
||
/** @psalm-suppress PropertyNotSetInConstructor */ | ||
class MfaVerified implements ICheck{ | ||
|
||
/** @var IL10N */ | ||
protected $l; | ||
|
||
/** @var ISession */ | ||
protected $session; | ||
|
||
/** | ||
* @param IL10N $l | ||
* @param ISession $session | ||
*/ | ||
public function __construct(IL10N $l, ISession $session) { | ||
$this->l = $l; | ||
$this->session = $session; | ||
} | ||
|
||
/** | ||
* @param string $operator | ||
* @param string $value | ||
* @return bool | ||
*/ | ||
public function executeCheck($operator, $value): bool { | ||
$mfaVerified = '0'; | ||
if (!empty($this->session->get('globalScale.userData'))) { | ||
$attr = $this->session->get('globalScale.userData')["userData"]; | ||
$mfaVerified = $attr["mfaVerified"]; | ||
} | ||
if (!empty($this->session->get('user_saml.samlUserData'))) { | ||
$attr = $this->session->get('user_saml.samlUserData'); | ||
$mfaVerified = $attr["mfa_verified"][0]; | ||
} | ||
if (!empty($this->session->get("two_factor_auth_passed"))){ | ||
$mfaVerified = '1'; | ||
} | ||
|
||
if ($operator === 'is') { | ||
return $mfaVerified === '1'; // checking whether the current user is MFA-verified | ||
} else { | ||
return $mfaVerified !== '1'; // checking whether the current user is not MFA-verified | ||
} | ||
} | ||
|
||
/** | ||
* @param string $operator | ||
* @param string $value | ||
* @throws \UnexpectedValueException | ||
*/ | ||
public function validateCheck($operator, $value): void { | ||
if (!in_array($operator, ['is', '!is'])) { | ||
throw new \UnexpectedValueException($this->l->t('The given operator is invalid'), 1); | ||
} | ||
} | ||
|
||
public function supportedEntities(): array { | ||
return []; | ||
} | ||
|
||
public function isAvailableForScope(int $scope): bool { | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
apps/workflowengine/src/components/Checks/MfaVerifiedValue.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<template> | ||
<div> | ||
<!-- Only to remove the default input --> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check notice
Code scanning / Psalm
DeprecatedMethod Note