Skip to content

Conversation

@flotter
Copy link
Contributor

@flotter flotter commented Oct 22, 2025

The command method for serving end-points

func (c *Command) ServeHTTP(w http.ResponseWriter, r *http.Request) {...}

is also responsible for looking up named identities if one exists. Otherwise, it checks if a peer credential UID is available, even if no named local username is associated with it.

Following the addition of basic auth and certificate based identities, exactly what is passed to the response function

type ResponseFunc func(*Command, *http.Request, *UserState) Response

specifically, UserState, is more complicated to picture.

Add tests to cover all the identity types, to capture what we expect in each identity case.

The tests also highlight that components, such as notices, only supporting UID (and not yet names identities) cannot work with all named identity types.

@flotter flotter requested a review from benhoyt October 22, 2025 19:07
Copy link
Contributor

@benhoyt benhoyt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this. Just one minor comment, but approving optimistically.

@flotter flotter changed the title chore(daemon): improve userstate test coverage chore(daemon): improve UserState test coverage Oct 23, 2025
@flotter flotter merged commit 1680d5b into canonical:master Oct 23, 2025
20 checks passed
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.

2 participants