Documentation
¶
Index ¶
- Constants
- Variables
- func RegisterAuthServiceServer(s grpc.ServiceRegistrar, srv AuthServiceServer)
- type AuthRequest
- func (*AuthRequest) Descriptor() ([]byte, []int)deprecated
- func (x *AuthRequest) GetCredentials() []*Credential
- func (x *AuthRequest) GetTarget() *Target
- func (*AuthRequest) ProtoMessage()
- func (x *AuthRequest) ProtoReflect() protoreflect.Message
- func (x *AuthRequest) Reset()
- func (x *AuthRequest) String() string
- type AuthResponse
- func (*AuthResponse) Descriptor() ([]byte, []int)deprecated
- func (x *AuthResponse) GetDecision() AuthResponse_Decision
- func (x *AuthResponse) GetReason() string
- func (*AuthResponse) ProtoMessage()
- func (x *AuthResponse) ProtoReflect() protoreflect.Message
- func (x *AuthResponse) Reset()
- func (x *AuthResponse) String() string
- type AuthResponse_Decision
- func (AuthResponse_Decision) Descriptor() protoreflect.EnumDescriptor
- func (x AuthResponse_Decision) Enum() *AuthResponse_Decision
- func (AuthResponse_Decision) EnumDescriptor() ([]byte, []int)deprecated
- func (x AuthResponse_Decision) Number() protoreflect.EnumNumber
- func (x AuthResponse_Decision) String() string
- func (AuthResponse_Decision) Type() protoreflect.EnumType
- type AuthServiceClient
- type AuthServiceServer
- type Credential
- type Target
- type UnimplementedAuthServiceServer
- type UnsafeAuthServiceServer
Constants ¶
const (
AuthService_Auth_FullMethodName = "/api.auth.v1.AuthService/Auth"
)
Variables ¶
var ( AuthResponse_Decision_name = map[int32]string{ 0: "DECISION_UNSPECIFIED", 1: "DECISION_ALLOW", 2: "DECISION_DENY", } AuthResponse_Decision_value = map[string]int32{ "DECISION_UNSPECIFIED": 0, "DECISION_ALLOW": 1, "DECISION_DENY": 2, } )
Enum value maps for AuthResponse_Decision.
var AuthService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "api.auth.v1.AuthService", HandlerType: (*AuthServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Auth", Handler: _AuthService_Auth_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "api/auth/v1/service.proto", }
AuthService_ServiceDesc is the grpc.ServiceDesc for AuthService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var File_api_auth_v1_auth_proto protoreflect.FileDescriptor
var File_api_auth_v1_credential_proto protoreflect.FileDescriptor
var File_api_auth_v1_service_proto protoreflect.FileDescriptor
var File_api_auth_v1_target_proto protoreflect.FileDescriptor
Functions ¶
func RegisterAuthServiceServer ¶
func RegisterAuthServiceServer(s grpc.ServiceRegistrar, srv AuthServiceServer)
Types ¶
type AuthRequest ¶
type AuthRequest struct {
// target is what the call is addressing. It is what makes an authorization
// decision possible: the same credential may be allowed to reach one namespace
// or method and not another.
Target *Target `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"`
// credentials are the caller's credentials, one entry per header the operator
// declared as carrying one. It is empty when the operator declared no headers
// or the caller sent none of them, which a provider should treat as an
// unauthenticated caller rather than a trusted one.
Credentials []*Credential `protobuf:"bytes,2,rep,name=credentials,proto3" json:"credentials,omitempty"`
// contains filtered or unexported fields
}
AuthRequest asks the provider whether the caller behind an inbound stream may proceed. It carries both who the caller is and what the call is addressing, so a provider can authorize as well as authenticate.
The caller's credentials travel in a field rather than in the request's metadata, because the proxy authenticates itself to this server with metadata of its own and the two would otherwise land on the same header. Splitting them across body and metadata means a provider never has to work out which value on a shared header belongs to whom: metadata credentials are the proxy's, and everything in credentials is the caller's.
The caller's other metadata is forwarded as request metadata, so a provider can weigh context such as the method being invoked, but the credential headers themselves are removed from it. A credential appears in exactly one place.
func (*AuthRequest) Descriptor
deprecated
func (*AuthRequest) Descriptor() ([]byte, []int)
Deprecated: Use AuthRequest.ProtoReflect.Descriptor instead.
func (*AuthRequest) GetCredentials ¶
func (x *AuthRequest) GetCredentials() []*Credential
func (*AuthRequest) GetTarget ¶ added in v0.5.0
func (x *AuthRequest) GetTarget() *Target
func (*AuthRequest) ProtoMessage ¶
func (*AuthRequest) ProtoMessage()
func (*AuthRequest) ProtoReflect ¶
func (x *AuthRequest) ProtoReflect() protoreflect.Message
func (*AuthRequest) Reset ¶
func (x *AuthRequest) Reset()
func (*AuthRequest) String ¶
func (x *AuthRequest) String() string
type AuthResponse ¶
type AuthResponse struct {
// decision is the verdict. Only DECISION_ALLOW admits; every other value,
// including one this proxy is too old to recognize, denies.
Decision AuthResponse_Decision `protobuf:"varint,1,opt,name=decision,proto3,enum=api.auth.v1.AuthResponse_Decision" json:"decision,omitempty"`
// reason is why, written for whoever operates this server. The proxy records it
// and keeps it out of what a refused caller is told, so it may name internal
// systems or subjects. It is optional, and unused for an admitted caller.
Reason string `protobuf:"bytes,2,opt,name=reason,proto3" json:"reason,omitempty"`
// contains filtered or unexported fields
}
AuthResponse is the provider's verdict. The decision carries it rather than the gRPC status: a provider that reached a verdict answers OK and says so here, and reserves an error status for having reached none.
func (*AuthResponse) Descriptor
deprecated
func (*AuthResponse) Descriptor() ([]byte, []int)
Deprecated: Use AuthResponse.ProtoReflect.Descriptor instead.
func (*AuthResponse) GetDecision ¶ added in v0.5.0
func (x *AuthResponse) GetDecision() AuthResponse_Decision
func (*AuthResponse) GetReason ¶ added in v0.5.0
func (x *AuthResponse) GetReason() string
func (*AuthResponse) ProtoMessage ¶
func (*AuthResponse) ProtoMessage()
func (*AuthResponse) ProtoReflect ¶
func (x *AuthResponse) ProtoReflect() protoreflect.Message
func (*AuthResponse) Reset ¶
func (x *AuthResponse) Reset()
func (*AuthResponse) String ¶
func (x *AuthResponse) String() string
type AuthResponse_Decision ¶ added in v0.5.0
type AuthResponse_Decision int32
Decision is whether the caller may proceed. Zero is the absence of a verdict rather than one of them, so a response a provider left unfilled denies instead of admitting: there is no way to admit a caller by omission.
const ( // DECISION_UNSPECIFIED is no verdict. The proxy denies the caller and treats // the provider as the fault, since one that answers without deciding is // misconfigured or newer than the proxy. AuthResponse_DECISION_UNSPECIFIED AuthResponse_Decision = 0 // DECISION_ALLOW admits the caller, and is the only value that does. AuthResponse_DECISION_ALLOW AuthResponse_Decision = 1 // DECISION_DENY refuses the caller, who is told PERMISSION_DENIED. AuthResponse_DECISION_DENY AuthResponse_Decision = 2 )
func (AuthResponse_Decision) Descriptor ¶ added in v0.5.0
func (AuthResponse_Decision) Descriptor() protoreflect.EnumDescriptor
func (AuthResponse_Decision) Enum ¶ added in v0.5.0
func (x AuthResponse_Decision) Enum() *AuthResponse_Decision
func (AuthResponse_Decision) EnumDescriptor
deprecated
added in
v0.5.0
func (AuthResponse_Decision) EnumDescriptor() ([]byte, []int)
Deprecated: Use AuthResponse_Decision.Descriptor instead.
func (AuthResponse_Decision) Number ¶ added in v0.5.0
func (x AuthResponse_Decision) Number() protoreflect.EnumNumber
func (AuthResponse_Decision) String ¶ added in v0.5.0
func (x AuthResponse_Decision) String() string
func (AuthResponse_Decision) Type ¶ added in v0.5.0
func (AuthResponse_Decision) Type() protoreflect.EnumType
type AuthServiceClient ¶
type AuthServiceClient interface {
// Auth reports whether the caller behind the current stream may proceed. The
// verdict travels in the response's decision, and only DECISION_ALLOW admits,
// so a response left unfilled denies rather than admitting by accident.
//
// Return an error only for having reached no verdict at all, such as a backend
// this server cannot itself reach. The proxy denies either way, but an error
// keeps its status code, so UNAVAILABLE or DEADLINE_EXCEEDED tells a worker to
// retry where a denial tells it not to bother. A provider that cannot reach its
// own backend should report that rather than admit the caller: an authenticator
// that fails open is worse than one that is down.
Auth(ctx context.Context, in *AuthRequest, opts ...grpc.CallOption) (*AuthResponse, error)
}
AuthServiceClient is the client API for AuthService service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
AuthService is the contract for a pluggable inbound authenticator. The proxy ships with built-in authenticators for a fixed static token and for OIDC/JWKS validation. An operator whose identity system fits neither (a policy engine, an internal session service, an opaque token only their backend can redeem) can instead run their own authenticator as a gRPC server implementing this service and point the proxy at it.
The proxy terminates inbound authentication rather than passing it through, so this service is asked once per inbound stream, before the stream is routed, and nothing reaches an upstream until it admits the caller. The operator declares which headers carry the caller's credentials: the proxy lifts those into AuthRequest and strips them from the stream it forwards, so a credential this service consumes never reaches an upstream.
func NewAuthServiceClient ¶
func NewAuthServiceClient(cc grpc.ClientConnInterface) AuthServiceClient
type AuthServiceServer ¶
type AuthServiceServer interface {
// Auth reports whether the caller behind the current stream may proceed. The
// verdict travels in the response's decision, and only DECISION_ALLOW admits,
// so a response left unfilled denies rather than admitting by accident.
//
// Return an error only for having reached no verdict at all, such as a backend
// this server cannot itself reach. The proxy denies either way, but an error
// keeps its status code, so UNAVAILABLE or DEADLINE_EXCEEDED tells a worker to
// retry where a denial tells it not to bother. A provider that cannot reach its
// own backend should report that rather than admit the caller: an authenticator
// that fails open is worse than one that is down.
Auth(context.Context, *AuthRequest) (*AuthResponse, error)
// contains filtered or unexported methods
}
AuthServiceServer is the server API for AuthService service. All implementations must embed UnimplementedAuthServiceServer for forward compatibility.
AuthService is the contract for a pluggable inbound authenticator. The proxy ships with built-in authenticators for a fixed static token and for OIDC/JWKS validation. An operator whose identity system fits neither (a policy engine, an internal session service, an opaque token only their backend can redeem) can instead run their own authenticator as a gRPC server implementing this service and point the proxy at it.
The proxy terminates inbound authentication rather than passing it through, so this service is asked once per inbound stream, before the stream is routed, and nothing reaches an upstream until it admits the caller. The operator declares which headers carry the caller's credentials: the proxy lifts those into AuthRequest and strips them from the stream it forwards, so a credential this service consumes never reaches an upstream.
type Credential ¶ added in v0.5.0
type Credential struct {
// header is the canonical (lowercase) metadata key the values arrived under,
// so a provider can tell an opaque API key from a bearer token without
// guessing from the format.
Header string `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"`
// values are that header's values in the order the caller sent them. gRPC
// metadata allows a key to repeat, so this preserves every value rather than
// silently choosing one.
Values []string `protobuf:"bytes,2,rep,name=values,proto3" json:"values,omitempty"`
// contains filtered or unexported fields
}
Credential is one credential-bearing header as the caller sent it.
func (*Credential) Descriptor
deprecated
added in
v0.5.0
func (*Credential) Descriptor() ([]byte, []int)
Deprecated: Use Credential.ProtoReflect.Descriptor instead.
func (*Credential) GetHeader ¶ added in v0.5.0
func (x *Credential) GetHeader() string
func (*Credential) GetValues ¶ added in v0.5.0
func (x *Credential) GetValues() []string
func (*Credential) ProtoMessage ¶ added in v0.5.0
func (*Credential) ProtoMessage()
func (*Credential) ProtoReflect ¶ added in v0.5.0
func (x *Credential) ProtoReflect() protoreflect.Message
func (*Credential) Reset ¶ added in v0.5.0
func (x *Credential) Reset()
func (*Credential) String ¶ added in v0.5.0
func (x *Credential) String() string
type Target ¶ added in v0.5.0
type Target struct {
// full_name is the gRPC full method being invoked, leading slash included, as
// in "/temporal.api.workflowservice.v1.WorkflowService/DescribeNamespace". It
// is always set.
FullName string `protobuf:"bytes,1,opt,name=full_name,json=fullName,proto3" json:"full_name,omitempty"`
// namespace is the Temporal namespace the request names. It is empty when the
// method has no namespace to name, as many do, when the caller sent no message
// to read one from, or when the proxy does not forward this method's service and
// so never looked. Empty therefore means "unknown", not "a namespace called
// nothing": match a namespace-scoped rule against full_name as well, rather than
// reading empty as a namespace that some rule might accept.
Namespace string `protobuf:"bytes,2,opt,name=namespace,proto3" json:"namespace,omitempty"`
// contains filtered or unexported fields
}
Target is what a call is addressing, as the proxy resolved it from the stream it accepted. It is not caller-supplied: the proxy takes the method from the stream itself and the namespace from the first request message, so a caller cannot forge either by sending a header.
func (*Target) Descriptor
deprecated
added in
v0.5.0
func (*Target) GetFullName ¶ added in v0.5.0
func (*Target) GetNamespace ¶ added in v0.5.0
func (*Target) ProtoMessage ¶ added in v0.5.0
func (*Target) ProtoMessage()
func (*Target) ProtoReflect ¶ added in v0.5.0
func (x *Target) ProtoReflect() protoreflect.Message
type UnimplementedAuthServiceServer ¶
type UnimplementedAuthServiceServer struct{}
UnimplementedAuthServiceServer must be embedded to have forward compatible implementations.
NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.
func (UnimplementedAuthServiceServer) Auth ¶
func (UnimplementedAuthServiceServer) Auth(context.Context, *AuthRequest) (*AuthResponse, error)
type UnsafeAuthServiceServer ¶
type UnsafeAuthServiceServer interface {
// contains filtered or unexported methods
}
UnsafeAuthServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to AuthServiceServer will result in compilation errors.