AuthRequestor: Add NotifyUserAuthResult API#499
Merged
chrisccoulson merged 3 commits intocanonical:masterfrom Feb 10, 2026
Merged
AuthRequestor: Add NotifyUserAuthResult API#499chrisccoulson merged 3 commits intocanonical:masterfrom
chrisccoulson merged 3 commits intocanonical:masterfrom
Conversation
This adds a new API to AuthRequestor so that ActivcateContext can notify the user about auth results. It notifies about success, failure and when the user supplied credential is badly formatted for the indicated type. It also provides a way to indicate when there are no more tries left for a type. The Plymouth implementation of this sends messages to Plymouth to be displayed. The systemd implementation of this logs errors to stderr. Fixes: FR-12404
070a66a to
01e2af0
Compare
auth_requestor_systemd.go
Outdated
| // delegates to the systemd-ask-password binary. The caller supplies a callback | ||
| // to supply messages for user auth requests. | ||
| func NewSystemdAuthRequestor(stringFn SystemdAuthRequestorStringFn) (AuthRequestor, error) { | ||
| func NewSystemdAuthRequestor(stderr io.Writer, stringFn SystemdAuthRequestorStringFn) (AuthRequestor, error) { |
Collaborator
There was a problem hiding this comment.
I would call it console rather than stderr just because it has to be clear that this should not just go in the journal, but also to the user.
Maybe the doc needs to say that it is used to notify the user about auth result.
Collaborator
Author
There was a problem hiding this comment.
That sounds ok to me
valentindavid
approved these changes
Feb 6, 2026
pedronis
approved these changes
Feb 9, 2026
| UserAuthTypeRecoveryKey | ||
| ) | ||
|
|
||
| func formatUserAuthTypeString(authTypes UserAuthType) string { |
Collaborator
There was a problem hiding this comment.
question, any reason for this not to be a String method instead?
Collaborator
Author
There was a problem hiding this comment.
I didn't implement a String method here because I wasn't sure I wanted this to be part of the public API, although I don't mind really.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This adds a new API to
AuthRequestorso thatActivcateContextcan notifythe user about auth results. It notifies about success, failure and when
the user supplied credential is badly formatted for the indicated type.
It also provides a way to indicate when there are no more tries left for
a type.
The Plymouth implementation of this sends messages to Plymouth to be
displayed. The systemd implementation of this logs errors to stderr.
Fixes: FR-12404