Skip to content

Commit

Permalink
address pr comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jr0d committed Apr 21, 2021
1 parent 19f1285 commit 49f58bb
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ func main() {
userInfoStore = &storage.GorillaUserInfoStore{
SessionStore: cookieStore,
SessionName: config.ClaimsSessionName,
Auth: authenticator,
}
} else {
userInfoStore = cluster.NewClusterStore(
Expand Down
5 changes: 3 additions & 2 deletions internal/storage/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,14 +207,15 @@ func (cs *ClusterStorage) getSecretByClaim(claimsId string) (*corev1.Secret, err
for _, s := range secrets.Items {
cid, ok := s.ObjectMeta.Labels[storage.ClaimsIDLabel]
if !ok {
logger.Errorf("found managed secret not containing claimID")
logger.Errorf(
fmt.Sprintf("found managed secret not containing claimID: offender: %s/%s", s.Namespace, s.Name))
continue
}
if claimsId == cid {
return &s, nil
}
}
return nil, SecretError("not found")
return nil, SecretError("not found:")
}

func (cs *ClusterStorage) deleteClaimsSecret(claimsId string) error {
Expand Down
2 changes: 1 addition & 1 deletion internal/storage/cluster/gc.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (gc *GarbageCollector) Collect() {
gc.logDebug("collector starting")
err := gc.cs.deleteExpiredSecrets()
if err != nil {
gc.logDebug("error deleting expired secrets")
gc.logDebug(fmt.Sprintf("error deleting expired secrets: %v", err))
}
gc.logDebug("collector finished")
}
Expand Down
6 changes: 3 additions & 3 deletions internal/storage/gorilla.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type GorillaUserInfoStore struct {
SessionStore sessions.Store
SessionName string

auth *authentication.Authenticator
Auth *authentication.Authenticator
}

func (c *GorillaUserInfoStore) Get(r *http.Request) (*v1alpha1.UserInfo, error) {
Expand All @@ -32,7 +32,7 @@ func (c *GorillaUserInfoStore) Get(r *http.Request) (*v1alpha1.UserInfo, error)
return nil, nil
}

var userinfo *v1alpha1.UserInfo
userinfo := &v1alpha1.UserInfo{}
if err := json.Unmarshal(data.([]byte), userinfo); err != nil {
return nil, fmt.Errorf("error parsing userinfo: %w", err)
}
Expand All @@ -53,7 +53,7 @@ func (c *GorillaUserInfoStore) Save(r *http.Request, w http.ResponseWriter, info
}

session.Values[UserInfoKey] = data
session.Options.Domain = c.auth.GetCookieDomain(r)
session.Options.Domain = c.Auth.GetCookieDomain(r)
if err := session.Save(r, w); err != nil {
return fmt.Errorf("error saving session: %w", err)
}
Expand Down

0 comments on commit 49f58bb

Please sign in to comment.