mirror of
https://github.com/minio/minio.git
synced 2025-11-23 11:07:50 -05:00
Add support for {jwt:sub} substitutions for policies (#8393)
Fixes #8345
This commit is contained in:
@@ -167,7 +167,7 @@ func NewPolicySys() *PolicySys {
|
||||
}
|
||||
}
|
||||
|
||||
func getConditionValues(request *http.Request, locationConstraint string, username string) map[string][]string {
|
||||
func getConditionValues(request *http.Request, locationConstraint string, username string, claims map[string]interface{}) map[string][]string {
|
||||
currTime := UTCNow()
|
||||
principalType := func() string {
|
||||
if username != "" {
|
||||
@@ -207,6 +207,13 @@ func getConditionValues(request *http.Request, locationConstraint string, userna
|
||||
args["LocationConstraint"] = []string{locationConstraint}
|
||||
}
|
||||
|
||||
// JWT specific values
|
||||
for k, v := range claims {
|
||||
vStr, ok := v.(string)
|
||||
if ok {
|
||||
args[k] = []string{vStr}
|
||||
}
|
||||
}
|
||||
return args
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user