IDToken: fix namespace format (#95341)

* Bump authlib version

* Remove temporary formatter and start signing tokens with `stacks-` prefix

* update workspace
This commit is contained in:
Karl Persson
2024-11-04 09:33:03 +01:00
committed by GitHub
parent 8a0c920106
commit 3bcbf231ee
8 changed files with 17 additions and 31 deletions
@@ -22,22 +22,8 @@ func GetNamespaceMapper(cfg *setting.Cfg) NamespaceMapper {
if err != nil {
stackId = 0
}
// Temporarily force this as plural
cloudNamespace := fmt.Sprintf("stacks-%d", stackId)
// cloudNamespace := claims.CloudNamespaceFormatter(stackIdInt)
return func(_ int64) string { return cloudNamespace }
}
return claims.OrgNamespaceFormatter
}
// Temporary version that is only passed to th
func GetTemporarySingularNamespaceMapper(cfg *setting.Cfg) NamespaceMapper {
if cfg != nil && cfg.StackID != "" {
stackIdInt, err := strconv.ParseInt(cfg.StackID, 10, 64)
if err != nil {
stackIdInt = 0
}
cloudNamespace := claims.CloudNamespaceFormatter(stackIdInt)
cloudNamespace := claims.CloudNamespaceFormatter(stackId)
return func(_ int64) string { return cloudNamespace }
}
return claims.OrgNamespaceFormatter
+1 -1
View File
@@ -39,7 +39,7 @@ func ProvideService(
cfg: cfg, logger: log.New("id-service"),
signer: signer, cache: cache,
metrics: newMetrics(reg),
nsMapper: request.GetTemporarySingularNamespaceMapper(cfg), // TODO replace with the plural one
nsMapper: request.GetNamespaceMapper(cfg),
}
authnService.RegisterPostAuthHook(s.hook, 140)