mirror of
https://github.com/grafana/grafana.git
synced 2024-11-26 02:40:26 -06:00
removed WithIDTokenExtractorOption, and other PR feedback
This commit is contained in:
parent
21220c2cca
commit
d09e14c26a
@ -25,11 +25,11 @@ type GrpcServerConfig struct {
|
||||
AllowedAudiences []string
|
||||
}
|
||||
|
||||
func ReadGprcServerConfig(cfg *setting.Cfg) (*GrpcServerConfig, error) {
|
||||
func ReadGprcServerConfig(cfg *setting.Cfg) *GrpcServerConfig {
|
||||
section := cfg.SectionWithEnvOverrides("grpc_server_authentication")
|
||||
|
||||
return &GrpcServerConfig{
|
||||
SigningKeysURL: section.Key("signing_keys_url").MustString(""),
|
||||
AllowedAudiences: section.Key("allowed_audiences").Strings(","),
|
||||
}, nil
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,6 @@ import (
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/credentials/insecure"
|
||||
|
||||
"github.com/grafana/grafana/pkg/apimachinery/identity"
|
||||
"github.com/grafana/grafana/pkg/infra/tracing"
|
||||
"github.com/grafana/grafana/pkg/services/accesscontrol"
|
||||
"github.com/grafana/grafana/pkg/services/featuremgmt"
|
||||
@ -116,18 +115,8 @@ func newInProcLegacyClient(server *legacyServer) (authzlib.MultiTenantClient, er
|
||||
|
||||
func newGrpcLegacyClient(authCfg *Cfg) (authzlib.MultiTenantClient, error) {
|
||||
// This client interceptor is a noop, as we don't send an access token
|
||||
grpcClientConfig := authnlib.GrpcClientConfig{}
|
||||
clientInterceptor, err := authnlib.NewGrpcClientInterceptor(&grpcClientConfig,
|
||||
authnlib.WithDisableAccessTokenOption(),
|
||||
authnlib.WithIDTokenExtractorOption(func(ctx context.Context) (string, error) {
|
||||
r, err := identity.GetRequester(ctx)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
token := r.GetIDToken()
|
||||
return token, nil
|
||||
}),
|
||||
)
|
||||
clientConfig := authnlib.GrpcClientConfig{}
|
||||
clientInterceptor, err := authnlib.NewGrpcClientInterceptor(&clientConfig, authnlib.WithDisableAccessTokenOption())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user