-
Notifications
You must be signed in to change notification settings - Fork 21
AuthRequestor: Add NotifyUserAuthResult API #499
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
base: master
Are you sure you want to change the base?
AuthRequestor: Add NotifyUserAuthResult API #499
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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds ok to me
pedronis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, one question
| UserAuthTypeRecoveryKey | ||
| ) | ||
|
|
||
| func formatUserAuthTypeString(authTypes UserAuthType) string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question, any reason for this not to be a String method instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 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