Skip to content

Commit

Permalink
Merge pull request #11 from vasayxtx/grpc-target-to-endpoint
Browse files Browse the repository at this point in the history
Use term "endpoint" instead of "target" for gRPC server address
  • Loading branch information
MikeYast authored Oct 29, 2024
2 parents e99d274 + 49eea77 commit a7f0727
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,12 @@ func NewTokenIntrospector(
}

var grpcClient *idptoken.GRPCClient
if cfg.Introspection.GRPC.Target != "" {
if cfg.Introspection.GRPC.Endpoint != "" {
transportCreds, err := makeGRPCTransportCredentials(cfg.Introspection.GRPC.TLS)
if err != nil {
return nil, fmt.Errorf("make grpc transport credentials: %w", err)
}
grpcClient, err = idptoken.NewGRPCClientWithOpts(cfg.Introspection.GRPC.Target, transportCreds,
grpcClient, err = idptoken.NewGRPCClientWithOpts(cfg.Introspection.GRPC.Endpoint, transportCreds,
idptoken.GRPCClientOpts{RequestTimeout: cfg.GRPCClient.RequestTimeout, Logger: logger})
if err != nil {
return nil, fmt.Errorf("new grpc client: %w", err)
Expand Down
2 changes: 1 addition & 1 deletion auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ func TestNewTokenIntrospector(t *gotesting.T) {
Introspection: IntrospectionConfig{
Enabled: true,
GRPC: IntrospectionGRPCConfig{
Target: grpcIDPSrv.Addr(),
Endpoint: grpcIDPSrv.Addr(),
TLS: GRPCTLSConfig{
Enabled: true,
CACert: certFile,
Expand Down
6 changes: 3 additions & 3 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const (
cfgKeyJWKSCacheUpdateMinInterval = "auth.jwks.cache.updateMinInterval"
cfgKeyIntrospectionEnabled = "auth.introspection.enabled"
cfgKeyIntrospectionEndpoint = "auth.introspection.endpoint"
cfgKeyIntrospectionGRPCTarget = "auth.introspection.grpc.target"
cfgKeyIntrospectionGRPCEndpoint = "auth.introspection.grpc.endpoint"
cfgKeyIntrospectionGRPCTLSEnabled = "auth.introspection.grpc.tls.enabled"
cfgKeyIntrospectionGRPCTLSCACert = "auth.introspection.grpc.tls.caCert"
cfgKeyIntrospectionGRPCTLSClientCert = "auth.introspection.grpc.tls.clientCert"
Expand Down Expand Up @@ -89,7 +89,7 @@ type IntrospectionCacheConfig struct {

// IntrospectionGRPCConfig is a configuration of how token will be introspected via gRPC.
type IntrospectionGRPCConfig struct {
Target string
Endpoint string
RequestTimeout time.Duration
TLS GRPCTLSConfig
}
Expand Down Expand Up @@ -231,7 +231,7 @@ func (c *Config) setIntrospectionConfig(dp config.DataProvider) error {
}

// GRPC
if c.Introspection.GRPC.Target, err = dp.GetString(cfgKeyIntrospectionGRPCTarget); err != nil {
if c.Introspection.GRPC.Endpoint, err = dp.GetString(cfgKeyIntrospectionGRPCEndpoint); err != nil {
return err
}
if c.Introspection.GRPC.TLS.Enabled, err = dp.GetBool(cfgKeyIntrospectionGRPCTLSEnabled); err != nil {
Expand Down
4 changes: 2 additions & 2 deletions config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ auth:
accessTokenScope:
- token_introspector
grpc:
target: "127.0.0.1:1234"
endpoint: "127.0.0.1:1234"
tls:
enabled: true
caCert: ca-cert.pem
Expand Down Expand Up @@ -102,7 +102,7 @@ auth:
},
AccessTokenScope: []string{"token_introspector"},
GRPC: IntrospectionGRPCConfig{
Target: "127.0.0.1:1234",
Endpoint: "127.0.0.1:1234",
TLS: GRPCTLSConfig{
Enabled: true,
CACert: "ca-cert.pem",
Expand Down

0 comments on commit a7f0727

Please sign in to comment.