Skip to content

Commit

Permalink
feat(pam/nativemodel): Do not render qrcode but show uri only in pkex…
Browse files Browse the repository at this point in the history
…ec (#405)

Do not include qrcode in polkit UI

Polkit dialogs are normally quite simple, so don't even try to render a textual QR code there.

![Schermata del 2024-07-01
18-20-41](https://github.com/ubuntu/authd/assets/345675/50b8c289-e080-4b9f-a9bd-a5dddd278252)


UDENG-3422
  • Loading branch information
3v1n0 committed Jul 5, 2024
2 parents 34e22c8 + cbe6f3b commit 25eafef
Show file tree
Hide file tree
Showing 9 changed files with 959 additions and 63 deletions.
5 changes: 5 additions & 0 deletions pam/integration-tests/native_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ func TestNativeAuthenticate(t *testing.T) {
termEnv string
sessionEnv string
pamUser string
pamServiceName string
}{
"Authenticate user successfully": {tape: "simple_auth"},
"Authenticate user successfully with preset user": {tape: "simple_auth_with_preset_user"},
Expand All @@ -42,6 +43,7 @@ func TestNativeAuthenticate(t *testing.T) {
"Authenticate user with qr code in a TTY": {tape: "qr_code", pamUser: "user-integration-qr-code-tty", termEnv: "linux"},
"Authenticate user with qr code in a TTY session": {tape: "qr_code", pamUser: "user-integration-qr-code-tty-session", termEnv: "xterm-256color", sessionEnv: "tty"},
"Authenticate user with qr code in screen": {tape: "qr_code", pamUser: "user-integration-qr-code-screen", termEnv: "screen"},
"Authenticate user with qr code in polkit": {tape: "qr_code", pamUser: "user-integration-qr-code-screen", pamServiceName: "polkit-1"},
"Authenticate user and reset password while enforcing policy": {tape: "mandatory_password_reset"},
"Authenticate user and offer password reset": {tape: "optional_password_reset_skip"},
"Authenticate user and accept password reset": {tape: "optional_password_reset_accept"},
Expand Down Expand Up @@ -102,6 +104,9 @@ func TestNativeAuthenticate(t *testing.T) {
if tc.pamUser != "" {
cmd.Env = append(cmd.Env, fmt.Sprintf("AUTHD_PAM_CLI_USER=%s", tc.pamUser))
}
if tc.pamServiceName != "" {
cmd.Env = append(cmd.Env, fmt.Sprintf("AUTHD_PAM_CLI_SERVICE=%s", tc.pamServiceName))
}
if tc.termEnv != "" {
cmd.Env = append(cmd.Env, fmt.Sprintf("AUTHD_PAM_CLI_TERM=%s", tc.termEnv))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2449,6 +2449,7 @@ Scan the qrcode or enter the code in the login page
████▄▄▄▄▄▄▄█▄█▄█▄█▄████▄▄▄▄▄▄████
█████████████████████████████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
https://ubuntu.com
1337

== Qr Code authentication (use 'r' to go back) ==
Expand Down Expand Up @@ -2506,7 +2507,6 @@ Select action:






────────────────────────────────────────────────────────────────────────────────
Expand Down Expand Up @@ -2606,6 +2606,7 @@ Scan the qrcode or enter the code in the login page
████▄▄▄▄▄▄▄█▄█▄█▄█▄████▄▄▄▄▄▄████
█████████████████████████████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
https://ubuntu.com
1337

== Qr Code authentication (use 'r' to go back) ==
Expand Down Expand Up @@ -2663,7 +2664,6 @@ Select authentication mode:






────────────────────────────────────────────────────────────────────────────────
Expand Down Expand Up @@ -2763,6 +2763,7 @@ Scan the qrcode or enter the code in the login page
████▄▄▄▄▄▄▄█▄█▄█▄█▄████▄▄▄▄▄▄████
█████████████████████████████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
https://ubuntu.com
1337

== Qr Code authentication (use 'r' to go back) ==
Expand Down Expand Up @@ -2820,7 +2821,6 @@ Select action:






────────────────────────────────────────────────────────────────────────────────
Expand Down Expand Up @@ -2920,6 +2920,7 @@ Scan the qrcode or enter the code in the login page
████▄▄▄▄▄▄▄█▄█▄█▄█▄████▄▄▄▄▄▄████
█████████████████████████████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
https://ubuntu.com
1337

== Qr Code authentication (use 'r' to go back) ==
Expand Down Expand Up @@ -2977,7 +2978,6 @@ Select authentication mode:






────────────────────────────────────────────────────────────────────────────────
Expand Down Expand Up @@ -3077,6 +3077,7 @@ Scan the qrcode or enter the code in the login page
████▄▄▄▄▄▄▄█▄█▄█▄█▄████▄▄▄▄▄▄████
█████████████████████████████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
https://ubuntu.com
1337

== Qr Code authentication (use 'r' to go back) ==
Expand Down Expand Up @@ -3136,7 +3137,6 @@ Select authentication mode:




────────────────────────────────────────────────────────────────────────────────
> ./pam_authd login socket=${AUTHD_TESTS_CLI_AUTHENTICATE_TESTS_SOCK} force_native_client=true
Username: user-integration-switch-mode
Expand Down Expand Up @@ -3234,6 +3234,7 @@ Scan the qrcode or enter the code in the login page
████▄▄▄▄▄▄▄█▄█▄█▄█▄████▄▄▄▄▄▄████
█████████████████████████████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
https://ubuntu.com
1337

== Qr Code authentication (use 'r' to go back) ==
Expand Down Expand Up @@ -3293,7 +3294,6 @@ Select authentication mode:




────────────────────────────────────────────────────────────────────────────────
> ./pam_authd login socket=${AUTHD_TESTS_CLI_AUTHENTICATE_TESTS_SOCK} force_native_client=true
Username: user-integration-switch-mode
Expand Down Expand Up @@ -3391,6 +3391,7 @@ Scan the qrcode or enter the code in the login page
████▄▄▄▄▄▄▄█▄█▄█▄█▄████▄▄▄▄▄▄████
█████████████████████████████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
https://ubuntu.com
1337

== Qr Code authentication (use 'r' to go back) ==
Expand Down Expand Up @@ -3450,7 +3451,6 @@ Enter your pin code:




────────────────────────────────────────────────────────────────────────────────
> ./pam_authd login socket=${AUTHD_TESTS_CLI_AUTHENTICATE_TESTS_SOCK} force_native_client=true
Username: user-integration-switch-mode
Expand Down Expand Up @@ -3548,6 +3548,7 @@ Scan the qrcode or enter the code in the login page
████▄▄▄▄▄▄▄█▄█▄█▄█▄████▄▄▄▄▄▄████
█████████████████████████████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
https://ubuntu.com
1337

== Qr Code authentication (use 'r' to go back) ==
Expand Down Expand Up @@ -3607,7 +3608,6 @@ PAM AcctMgmt() exited with success
>



────────────────────────────────────────────────────────────────────────────────
> ./pam_authd login socket=${AUTHD_TESTS_CLI_AUTHENTICATE_TESTS_SOCK} force_native_client=true
Username: user-integration-switch-mode
Expand Down Expand Up @@ -3705,6 +3705,7 @@ Scan the qrcode or enter the code in the login page
████▄▄▄▄▄▄▄█▄█▄█▄█▄████▄▄▄▄▄▄████
█████████████████████████████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
https://ubuntu.com
1337

== Qr Code authentication (use 'r' to go back) ==
Expand Down Expand Up @@ -3764,5 +3765,4 @@ PAM AcctMgmt() exited with success
>



────────────────────────────────────────────────────────────────────────────────
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ Scan the qrcode or enter the code in the login page
████▄▄▄▄▄▄▄█▄█▄█▄█▄████▄▄▄▄▄▄████
█████████████████████████████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
https://ubuntu.com
1337

== Qr Code authentication (use 'r' to go back) ==
Expand Down Expand Up @@ -421,7 +422,6 @@ Select action:






────────────────────────────────────────────────────────────────────────────────
Expand Down Expand Up @@ -461,6 +461,7 @@ Scan the qrcode or enter the code in the login page
████▄▄▄▄▄▄▄█▄█▄█▄█▄████▄▄▄▄▄▄████
█████████████████████████████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
https://ubuntu.com
1337

== Qr Code authentication (use 'r' to go back) ==
Expand All @@ -485,6 +486,7 @@ Scan the qrcode or enter the code in the login page
████▄▄▄▄▄▄▄█▄█▄█▄█▄████▄▄▄▄▄▄████
█████████████████████████████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
https://ubuntu.com
1337

== Qr Code authentication (use 'r' to go back) ==
Expand Down Expand Up @@ -526,8 +528,6 @@ Select action:








Expand Down Expand Up @@ -568,6 +568,7 @@ Scan the qrcode or enter the code in the login page
████▄▄▄▄▄▄▄█▄█▄█▄█▄████▄▄▄▄▄▄████
█████████████████████████████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
https://ubuntu.com
1337

== Qr Code authentication (use 'r' to go back) ==
Expand All @@ -592,6 +593,7 @@ Scan the qrcode or enter the code in the login page
████▄▄▄▄▄▄▄█▄█▄█▄█▄████▄▄▄▄▄▄████
█████████████████████████████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
https://ubuntu.com
1337

== Qr Code authentication (use 'r' to go back) ==
Expand Down Expand Up @@ -633,8 +635,6 @@ Select action: 1








Expand Down Expand Up @@ -675,6 +675,7 @@ Scan the qrcode or enter the code in the login page
████▄▄▄▄▄▄▄█▄█▄█▄█▄████▄▄▄▄▄▄████
█████████████████████████████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
https://ubuntu.com
1337

== Qr Code authentication (use 'r' to go back) ==
Expand All @@ -699,6 +700,7 @@ Scan the qrcode or enter the code in the login page
████▄▄▄▄▄▄▄█▄█▄█▄█▄████▄▄▄▄▄▄████
█████████████████████████████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
https://ubuntu.com
1337

== Qr Code authentication (use 'r' to go back) ==
Expand Down Expand Up @@ -740,8 +742,6 @@ PAM AcctMgmt() exited with success








Expand Down Expand Up @@ -782,6 +782,7 @@ Scan the qrcode or enter the code in the login page
████▄▄▄▄▄▄▄█▄█▄█▄█▄████▄▄▄▄▄▄████
█████████████████████████████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
https://ubuntu.com
1337

== Qr Code authentication (use 'r' to go back) ==
Expand All @@ -806,6 +807,7 @@ Scan the qrcode or enter the code in the login page
████▄▄▄▄▄▄▄█▄█▄█▄█▄████▄▄▄▄▄▄████
█████████████████████████████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
https://ubuntu.com
1337

== Qr Code authentication (use 'r' to go back) ==
Expand Down Expand Up @@ -847,8 +849,6 @@ PAM AcctMgmt() exited with success








Expand Down
Loading

0 comments on commit 25eafef

Please sign in to comment.