Skip to content

Commit

Permalink
chore: dump groups claims for debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
smlx committed May 7, 2024
1 parent e3ee154 commit 1fb5dc9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ require (
github.com/MicahParks/keyfunc/v2 v2.1.0
github.com/alecthomas/assert/v2 v2.9.0
github.com/alecthomas/kong v0.9.0
github.com/davecgh/go-spew v1.1.1
github.com/gliderlabs/ssh v0.3.7
github.com/go-sql-driver/mysql v1.8.1
github.com/golang-jwt/jwt/v5 v5.2.1
Expand Down Expand Up @@ -34,7 +35,6 @@ require (
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/go-jose/go-jose/v4 v4.0.1 // indirect
github.com/go-logr/logr v1.4.1 // indirect
Expand Down
1 change: 1 addition & 0 deletions internal/keycloak/jwt.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ func (gpids *groupProjectIDs) UnmarshalJSON(data []byte) error {
type LagoonClaims struct {
RealmRoles []string `json:"realm_roles"`
UserGroups []string `json:"group_membership"`
Groups []string `json:"groups"`
GroupProjectIDs groupProjectIDs `json:"group_lagoon_project_ids"`
AuthorizedParty string `json:"azp"`
jwt.RegisteredClaims
Expand Down
2 changes: 2 additions & 0 deletions internal/keycloak/userrolesandgroups.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"net/http"
"time"

"github.com/davecgh/go-spew/spew"
"github.com/google/uuid"
"go.opentelemetry.io/otel"
"golang.org/x/oauth2"
Expand Down Expand Up @@ -48,5 +49,6 @@ func (c *Client) UserRolesAndGroups(ctx context.Context,
if err != nil {
return nil, nil, nil, fmt.Errorf("couldn't parse user access token: %v", err)
}
spew.Dump(claims)
return claims.RealmRoles, claims.UserGroups, claims.GroupProjectIDs, nil
}

0 comments on commit 1fb5dc9

Please sign in to comment.