Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add integration test for authenticating as a disabled user
Signed-off-by: Daniel Calviño Sánchez <[email protected]>
  • Loading branch information
danxuliu committed Dec 3, 2024
commit 2e9f5bc11acbdfd446564058366993a5c9e9e36b
10 changes: 10 additions & 0 deletions tests/integration/features/EnvironmentVariable.feature
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,13 @@ Feature: EnvironmentVariable
And The environment variable "REMOTE_USER" is set to "certainly-not-provisioned-user"
When I send a GET request to "http://localhost:8080/index.php/login"
Then I should be redirected to "http://localhost:8080/index.php/apps/user_saml/saml/notProvisioned"

Scenario: Authenticating using environment variable with SSO as a disabled user on backend
Given A local user with uid "provisioned-disabled-user" exists
And A local user with uid "provisioned-disabled-user" is disabled
And The setting "type" is set to "environment-variable"
And The setting "general-require_provisioned_account" is set to "1"
And The setting "general-uid_mapping" is set to "REMOTE_USER"
And The environment variable "REMOTE_USER" is set to "provisioned-disabled-user"
When I send a GET request to "http://localhost:8080/index.php/login"
Then I should be redirected to "http://localhost:8080/index.php/apps/user_saml/saml/error"
15 changes: 15 additions & 0 deletions tests/integration/features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,21 @@ public function aLocalUserWithUidExists($uid) {
);
}

/**
* @Given A local user with uid :uid is disabled
* @param string $uid
*/
public function aLocalUserWithUidIsDisabled($uid) {
shell_exec(
sprintf(
'OC_PASS=password %s %s user:disable %s',
PHP_BINARY,
__DIR__ . '/../../../../../../occ',
$uid
)
);
}

/**
* @Then I hack :uid into existence
*/
Expand Down
Loading