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
|
AllowedAudiences []string
|
||||||
}
|
}
|
||||||
|
|
||||||
func ReadGprcServerConfig(cfg *setting.Cfg) (*GrpcServerConfig, error) {
|
func ReadGprcServerConfig(cfg *setting.Cfg) *GrpcServerConfig {
|
||||||
section := cfg.SectionWithEnvOverrides("grpc_server_authentication")
|
section := cfg.SectionWithEnvOverrides("grpc_server_authentication")
|
||||||
|
|
||||||
return &GrpcServerConfig{
|
return &GrpcServerConfig{
|
||||||
SigningKeysURL: section.Key("signing_keys_url").MustString(""),
|
SigningKeysURL: section.Key("signing_keys_url").MustString(""),
|
||||||
AllowedAudiences: section.Key("allowed_audiences").Strings(","),
|
AllowedAudiences: section.Key("allowed_audiences").Strings(","),
|
||||||
}, nil
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,6 @@ import (
|
|||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"google.golang.org/grpc/credentials/insecure"
|
"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/infra/tracing"
|
||||||
"github.com/grafana/grafana/pkg/services/accesscontrol"
|
"github.com/grafana/grafana/pkg/services/accesscontrol"
|
||||||
"github.com/grafana/grafana/pkg/services/featuremgmt"
|
"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) {
|
func newGrpcLegacyClient(authCfg *Cfg) (authzlib.MultiTenantClient, error) {
|
||||||
// This client interceptor is a noop, as we don't send an access token
|
// This client interceptor is a noop, as we don't send an access token
|
||||||
grpcClientConfig := authnlib.GrpcClientConfig{}
|
clientConfig := authnlib.GrpcClientConfig{}
|
||||||
clientInterceptor, err := authnlib.NewGrpcClientInterceptor(&grpcClientConfig,
|
clientInterceptor, err := authnlib.NewGrpcClientInterceptor(&clientConfig, authnlib.WithDisableAccessTokenOption())
|
||||||
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
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user