-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pam/adapter/model: Start user selection only after has been requested
So we avoid writing at all in the terminal if user selection is not required, add tests to verify this behavior
- Loading branch information
Showing
8 changed files
with
298 additions
and
4 deletions.
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
132 changes: 132 additions & 0 deletions
132
...tests/testdata/TestCLIAuthenticate/golden/authenticate_user_successfully_with_preset_user
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,132 @@ | ||
> env AUTHD_PAM_CLI_USER=user3 ./pam_authd login socket=${AUTHD_TESTS_CLI_AUTHENTICATE_TESTS_SOC | ||
K} | ||
Select your provider | ||
|
||
> 1. local | ||
2. ExampleBroker | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
──────────────────────────────────────────────────────────────────────────────── | ||
> env AUTHD_PAM_CLI_USER=user3 ./pam_authd login socket=${AUTHD_TESTS_CLI_AUTHENTICATE_TESTS_SOC | ||
K} | ||
Gimme your password | ||
> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
──────────────────────────────────────────────────────────────────────────────── | ||
> env AUTHD_PAM_CLI_USER=user3 ./pam_authd login socket=${AUTHD_TESTS_CLI_AUTHENTICATE_TESTS_SOC | ||
K} | ||
Gimme your password | ||
PAM Authenticate() for user "user3" exited with success | ||
PAM AcctMgmt() exited with success | ||
> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
──────────────────────────────────────────────────────────────────────────────── | ||
> env AUTHD_PAM_CLI_USER=user3 ./pam_authd login socket=${AUTHD_TESTS_CLI_AUTHENTICATE_TESTS_SOC | ||
K} | ||
Gimme your password | ||
PAM Authenticate() for user "user3" exited with success | ||
PAM AcctMgmt() exited with success | ||
> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
──────────────────────────────────────────────────────────────────────────────── |
99 changes: 99 additions & 0 deletions
99
...n-tests/testdata/TestCLIAuthenticate/golden/autoselect_local_broker_for_local_user_preset
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,99 @@ | ||
> env AUTHD_PAM_CLI_USER=root ./pam_authd login socket=${AUTHD_TESTS_CLI_AUTHENTICATE_TESTS_SOCK | ||
} | ||
PAM Info Message: auth=incomplete | ||
PAM Authenticate() for user "root" exited with error (PAM exit code: 25): The return value shoul | ||
d be ignored by PAM dispatch | ||
PAM AcctMgmt() exited with error (PAM exit code: 26): Critical error - immediate abort | ||
> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
──────────────────────────────────────────────────────────────────────────────── | ||
> env AUTHD_PAM_CLI_USER=root ./pam_authd login socket=${AUTHD_TESTS_CLI_AUTHENTICATE_TESTS_SOCK | ||
} | ||
PAM Info Message: auth=incomplete | ||
PAM Authenticate() for user "root" exited with error (PAM exit code: 25): The return value shoul | ||
d be ignored by PAM dispatch | ||
PAM AcctMgmt() exited with error (PAM exit code: 26): Critical error - immediate abort | ||
> | ||
> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
──────────────────────────────────────────────────────────────────────────────── | ||
> env AUTHD_PAM_CLI_USER=root ./pam_authd login socket=${AUTHD_TESTS_CLI_AUTHENTICATE_TESTS_SOCK | ||
} | ||
PAM Info Message: auth=incomplete | ||
PAM Authenticate() for user "root" exited with error (PAM exit code: 25): The return value shoul | ||
d be ignored by PAM dispatch | ||
PAM AcctMgmt() exited with error (PAM exit code: 26): Critical error - immediate abort | ||
> | ||
> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
──────────────────────────────────────────────────────────────────────────────── |
27 changes: 27 additions & 0 deletions
27
pam/integration-tests/testdata/tapes/local_user_preset.tape
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,27 @@ | ||
Output local_user_preset.txt | ||
Output local_user_preset.gif # If we don't specify a .gif output, it will create a default out.gif file. | ||
|
||
# Configuration header to standardize the output. | ||
# Does not work with the "Source" command. | ||
Set Width 800 | ||
Set Height 500 | ||
# TODO: Ideally, we should use Ubuntu Mono. However, the github runner is still on Jammy, which does not have it. | ||
# We should update this to use Ubuntu Mono once the runner is updated. | ||
Set FontFamily "Monospace" | ||
Set FontSize 13 | ||
Set Padding 0 | ||
Set Margin 0 | ||
Set Shell bash | ||
|
||
Hide | ||
Type "env AUTHD_PAM_CLI_USER=root ./pam_authd login socket=${AUTHD_TESTS_CLI_AUTHENTICATE_TESTS_SOCK}" | ||
Enter | ||
Sleep 300ms | ||
Show | ||
|
||
Hide | ||
Enter | ||
Sleep 300ms | ||
Show | ||
|
||
Sleep 300ms |
33 changes: 33 additions & 0 deletions
33
pam/integration-tests/testdata/tapes/simple_auth_with_preset_user.tape
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,33 @@ | ||
Output simple_auth_with_preset_user.txt | ||
Output simple_auth_with_preset_user.gif # If we don't specify a .gif output, it will create a default out.gif file. | ||
|
||
# Configuration header to standardize the output. | ||
# Does not work with the "Source" command. | ||
Set Width 800 | ||
Set Height 500 | ||
# TODO: Ideally, we should use Ubuntu Mono. However, the github runner is still on Jammy, which does not have it. | ||
# We should update this to use Ubuntu Mono once the runner is updated. | ||
Set FontFamily "Monospace" | ||
Set FontSize 13 | ||
Set Padding 0 | ||
Set Margin 0 | ||
Set Shell bash | ||
|
||
Hide | ||
Type "env AUTHD_PAM_CLI_USER=user3 ./pam_authd login socket=${AUTHD_TESTS_CLI_AUTHENTICATE_TESTS_SOCK}" | ||
Enter | ||
Sleep 300ms | ||
Show | ||
|
||
Hide | ||
Type "2" | ||
Sleep 300ms | ||
Show | ||
|
||
Hide | ||
Type "goodpass" | ||
Enter | ||
Sleep 2s | ||
Show | ||
|
||
Sleep 300ms |
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