JWT: Add org role mapping support to the JWT provider (#101584)
* add org role mapping to the jwt provider * Fix indentation for OrgMapping assignment * add-test * fix linting * add org_attribute_path * fix test * update doc * update doc * Update pkg/services/authn/clients/jwt.go * Update docs --------- Co-authored-by: Mihaly Gyongyosi <mgyongyosi@users.noreply.github.com>
This commit is contained in:
co-authored by
Mihaly Gyongyosi
parent
ea89499209
commit
aeca9a80a4
@@ -1,6 +1,10 @@
|
||||
package setting
|
||||
|
||||
import "time"
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/grafana/grafana/pkg/util"
|
||||
)
|
||||
|
||||
const (
|
||||
extJWTAccessTokenExpectAudience = "grafana"
|
||||
@@ -22,6 +26,8 @@ type AuthJWTSettings struct {
|
||||
AutoSignUp bool
|
||||
RoleAttributePath string
|
||||
RoleAttributeStrict bool
|
||||
OrgMapping []string
|
||||
OrgAttributePath string
|
||||
AllowAssignGrafanaAdmin bool
|
||||
SkipOrgRoleSync bool
|
||||
GroupsAttributePath string
|
||||
@@ -71,6 +77,8 @@ func (cfg *Cfg) readAuthJWTSettings() {
|
||||
jwtSettings.EmailAttributePath = valueAsString(authJWT, "email_attribute_path", "")
|
||||
jwtSettings.UsernameAttributePath = valueAsString(authJWT, "username_attribute_path", "")
|
||||
jwtSettings.TlsSkipVerify = authJWT.Key("tls_skip_verify_insecure").MustBool(false)
|
||||
jwtSettings.OrgAttributePath = valueAsString(authJWT, "org_attribute_path", "")
|
||||
jwtSettings.OrgMapping = util.SplitString(valueAsString(authJWT, "org_mapping", ""))
|
||||
|
||||
cfg.JWTAuth = jwtSettings
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user