revert codacy

This commit is contained in:
Pascal Fischer
2023-03-30 18:54:55 +02:00
parent e08af7fcdf
commit f273fe9f51
2 changed files with 13 additions and 17 deletions

View File

@@ -34,10 +34,8 @@ type AuthMiddleware struct {
audience string
}
type key string
const (
userProperty key = "user"
userProperty = "user"
)
// NewAuthMiddleware instance constructor
@@ -131,10 +129,10 @@ func (m *AuthMiddleware) CheckPATFromRequest(w http.ResponseWriter, r *http.Requ
}
claimMaps := jwt.MapClaims{}
claimMaps[string(jwtclaims.UserIDClaim)] = user.Id
claimMaps[m.audience+string(jwtclaims.AccountIDSuffix)] = account.Id
claimMaps[m.audience+string(jwtclaims.DomainIDSuffix)] = account.Domain
claimMaps[m.audience+string(jwtclaims.DomainCategorySuffix)] = account.DomainCategory
claimMaps[jwtclaims.UserIDClaim] = user.Id
claimMaps[m.audience+jwtclaims.AccountIDSuffix] = account.Id
claimMaps[m.audience+jwtclaims.DomainIDSuffix] = account.Domain
claimMaps[m.audience+jwtclaims.DomainCategorySuffix] = account.DomainCategory
jwtToken := jwt.NewWithClaims(jwt.SigningMethodHS256, claimMaps)
newRequest := r.WithContext(context.WithValue(r.Context(), jwtclaims.TokenUserProperty, jwtToken))
// Update the current request with the new context information.