extract hardcoded jwt claim names into config (#97)
* extract hardcoded jwt field names into config * Update config.go Co-authored-by: James Read <contact@jread.com>
This commit is contained in:
parent
edf10fdd9f
commit
e18df74d5a
|
|
@ -72,6 +72,8 @@ type Config struct {
|
|||
ShowNewVersions bool
|
||||
AuthJwtCookieName string
|
||||
AuthJwtSecret string
|
||||
AuthJwtClaimUsername string
|
||||
AuthJwtClaimUserGroup string
|
||||
DefaultPermissions PermissionsList
|
||||
AccessControlLists []AccessControlList
|
||||
}
|
||||
|
|
@ -93,6 +95,8 @@ func DefaultConfig() *Config {
|
|||
config.CheckForUpdates = true
|
||||
config.DefaultPermissions.Exec = true
|
||||
config.DefaultPermissions.View = true
|
||||
config.AuthJwtClaimUsername = "name"
|
||||
config.AuthJwtClaimUserGroup = "group"
|
||||
|
||||
return &config
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,8 +88,8 @@ func startRestAPIServer(globalConfig *config.Config) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
username := lookupClaimValueOrDefault(claims, "name", "none")
|
||||
usergroup := lookupClaimValueOrDefault(claims, "group", "none")
|
||||
username := lookupClaimValueOrDefault(claims, cfg.AuthJwtClaimUsername, "none")
|
||||
usergroup := lookupClaimValueOrDefault(claims, cfg.AuthJwtClaimUserGroup, "none")
|
||||
|
||||
md := metadata.Pairs(
|
||||
"username", username,
|
||||
|
|
|
|||
Loading…
Reference in New Issue