Skip to content

Commit

Permalink
Todo cleanup (#396)
Browse files Browse the repository at this point in the history
* we are referring to a user not a uid

* todo cleanu regarding claims
  • Loading branch information
butonic authored and labkode committed Dec 4, 2019
1 parent 4a6f9ea commit cbf238c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
6 changes: 3 additions & 3 deletions internal/grpc/services/authprovider/authprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func (s *service) Authenticate(ctx context.Context, req *provider.AuthenticateRe
username := req.ClientId
password := req.ClientSecret

uid, err := s.authmgr.Authenticate(ctx, username, password)
u, err := s.authmgr.Authenticate(ctx, username, password)
if err != nil {
err = errors.Wrap(err, "authsvc: error in Authenticate")
res := &provider.AuthenticateResponse{
Expand All @@ -103,10 +103,10 @@ func (s *service) Authenticate(ctx context.Context, req *provider.AuthenticateRe
return res, nil
}

log.Info().Msgf("user %s authenticated", uid.String())
log.Info().Msgf("user %s authenticated", u.String())
res := &provider.AuthenticateResponse{
Status: status.NewOK(ctx),
User: uid,
User: u,
}
return res, nil
}
3 changes: 0 additions & 3 deletions pkg/auth/manager/ldap/ldap.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,10 @@ func (am *mgr) Authenticate(ctx context.Context, clientID, clientSecret string)
}

u := &user.User{
// TODO(jfd) clean up idp = iss, sub = opaque ... is redundant
Id: &user.UserId{
Idp: am.c.Idp,
OpaqueId: sr.Entries[0].GetAttributeValue(am.c.Schema.UID),
},
// Subject: claims.Sub, // TODO(labkode) remove from CS3, is in Id
// Issuer: claims.Iss, // TODO(labkode) remove from CS3, is in Id
// TODO add more claims from the StandardClaims, eg EmailVerified
Username: sr.Entries[0].GetAttributeValue(am.c.Schema.UserName),
// TODO groups
Expand Down
5 changes: 1 addition & 4 deletions pkg/auth/manager/oidc/oidc.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,15 +220,12 @@ func (am *mgr) Authenticate(ctx context.Context, clientID, token string) (*user.
}

u := &user.User{
// TODO(jfd) clean up idp = iss, sub = opaque ... is redundant
Id: &user.UserId{
OpaqueId: claims.Sub, // a stable non reassignable id
Idp: claims.Iss, // in the scope of this issuer
},
// Subject: claims.Sub, // TODO(labkode) remove from CS3, is in Id
// Issuer: claims.Iss, // TODO(labkode) remove from CS3, is in Id
Username: claims.PreferredUsername,
// TODO groups
// TODO groups are not covered by oidc but might be sent as a custom claim.
// TODO ... use all claims from oidc?
Groups: []string{},
Mail: claims.Email,
Expand Down

0 comments on commit cbf238c

Please sign in to comment.