Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

Consumable authentication handlers #3169

Merged
merged 5 commits into from
Apr 5, 2022
Merged

Conversation

izaaklauer
Copy link
Contributor

@izaaklauer izaaklauer commented Mar 31, 2022

In much the same vein as #3149, this refactoring allows other waypoint server implementations to consume the authentication logic here. This should not change any behavior or functionality.

@@ -25,28 +26,25 @@ import (
)

const (
// The username of the initial user created during bootstrapping. This
// DefaultUser is the username of the initial user created during bootstrapping. This
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updating comments to godoc style

@izaaklauer izaaklauer added the pr/no-changelog No automatic changelog entry required for this pull request label Mar 31, 2022
Comment on lines +476 to +484
encodedId, err := s.encodeId(ctx, currentUser.Id)
if err != nil {
msg := "failed to encode id when generating a login token"
log.Error(msg, "currentUser.Id", currentUser.Id, "err", err)
return nil, status.Error(codes.Internal, msg)
}

login := &pb.Token_Login{
UserId: currentUser.Id,
UserId: encodedId,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll note that I don't love this flow. It's not at all intuitive when IDs need to be encoded/decoded, and I don't have any great heuristics to offer. It will be easy for us to implement new logic in the future that skips doing this.

if conf.Cookie == "" {
err := state.ServerConfigSet(conf)
if err != nil && status.Convert(err).Code() != codes.Unimplemented {
if !cfg.skipServerConfigInit {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a mostly unrelated change - it allows the server to be started without initializing a global cookie.

@izaaklauer izaaklauer marked this pull request as ready for review March 31, 2022 23:38
@izaaklauer izaaklauer changed the title Consumable service handlers 2 Consumable authentication handlers Mar 31, 2022
@izaaklauer izaaklauer requested a review from evanphx March 31, 2022 23:38
@izaaklauer izaaklauer merged commit d432482 into main Apr 5, 2022
@izaaklauer izaaklauer deleted the consumable-service-handlers-2 branch April 5, 2022 22:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pr/no-changelog No automatic changelog entry required for this pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants