Skip to content

Conversation

@chrisccoulson
Copy link
Collaborator

@chrisccoulson chrisccoulson commented Feb 2, 2026

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

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
@chrisccoulson chrisccoulson force-pushed the auth-requestor-send-errors-to-plymouth branch from 070a66a to 01e2af0 Compare February 2, 2026 17:42
@chrisccoulson chrisccoulson marked this pull request as ready for review February 2, 2026 17:42
// 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) {
Copy link
Collaborator

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.

Copy link
Collaborator Author

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

Copy link
Collaborator

@pedronis pedronis left a 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 {
Copy link
Collaborator

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?

Copy link
Collaborator Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants