mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
added stackIdExtractor for cloud mode
Co-Authored-By: Gabriel MABILLE <gamab@users.noreply.github.com>
This commit is contained in:
parent
84866a8a51
commit
bb5ee88d4f
@ -86,7 +86,7 @@ func NewResourceStoreClientCloud(conn *grpc.ClientConn, cfg *setting.Cfg) (Resou
|
||||
|
||||
opts := []authnlib.GrpcClientInterceptorOption{
|
||||
authnlib.WithIDTokenExtractorOption(idTokenExtractor),
|
||||
authnlib.WithMetadataExtractorOption(orgIdExtractor),
|
||||
authnlib.WithMetadataExtractorOption(stackIdExtractor(cfg.StackID)),
|
||||
}
|
||||
|
||||
if cfg.Env == setting.Dev {
|
||||
@ -137,3 +137,9 @@ func orgIdExtractor(ctx context.Context) (key string, values []string, err error
|
||||
|
||||
return authzlib.DefaultStackIDMetadataKey, []string{fmt.Sprintf("%d", requester.GetOrgID())}, nil
|
||||
}
|
||||
|
||||
func stackIdExtractor(stackID string) func(ctx context.Context) (key string, values []string, err error) {
|
||||
return func(ctx context.Context) (key string, values []string, err error) {
|
||||
return authzlib.DefaultStackIDMetadataKey, []string{stackID}, nil
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user