Documentation
¶
Overview ¶
Package token is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterTokenServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterTokenServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client TokenServiceClient) error
- func RegisterTokenServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterTokenServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server TokenServiceServer) error
- func RegisterTokenServiceServer(s grpc.ServiceRegistrar, srv TokenServiceServer)
- type IssueRequest
- type IssueResponse
- func (*IssueResponse) Descriptor() ([]byte, []int)deprecated
- func (x *IssueResponse) GetAccessToken() string
- func (x *IssueResponse) GetExpiresAt() *timestamppb.Timestamp
- func (x *IssueResponse) GetKeyId() string
- func (x *IssueResponse) GetTokenType() string
- func (*IssueResponse) ProtoMessage()
- func (x *IssueResponse) ProtoReflect() protoreflect.Message
- func (x *IssueResponse) Reset()
- func (x *IssueResponse) String() string
- type RevokeRequest
- func (*RevokeRequest) Descriptor() ([]byte, []int)deprecated
- func (x *RevokeRequest) GetName() string
- func (x *RevokeRequest) GetPurge() bool
- func (x *RevokeRequest) GetUid() string
- func (*RevokeRequest) ProtoMessage()
- func (x *RevokeRequest) ProtoReflect() protoreflect.Message
- func (x *RevokeRequest) Reset()
- func (x *RevokeRequest) String() string
- type Token
- type TokenConfig
- func (*TokenConfig) Descriptor() ([]byte, []int)deprecated
- func (x *TokenConfig) GetAudience() []string
- func (x *TokenConfig) GetClusters() []string
- func (x *TokenConfig) GetExtraClaims() map[string]string
- func (x *TokenConfig) GetGroups() []string
- func (x *TokenConfig) GetScopes() []string
- func (x *TokenConfig) GetServiceAccounts() []string
- func (x *TokenConfig) GetSubject() string
- func (x *TokenConfig) GetTtl() *durationpb.Duration
- func (x *TokenConfig) GetUsername() string
- func (*TokenConfig) ProtoMessage()
- func (x *TokenConfig) ProtoReflect() protoreflect.Message
- func (x *TokenConfig) Reset()
- func (x *TokenConfig) String() string
- type TokenServiceClient
- type TokenServiceServer
- type TokenStatus
- type UnimplementedTokenServiceServer
- type UnsafeTokenServiceServer
Constants ¶
This section is empty.
Variables ¶
var File_token_v1_token_proto protoreflect.FileDescriptor
var TokenService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "token.v1.TokenService", HandlerType: (*TokenServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Issue", Handler: _TokenService_Issue_Handler, }, { MethodName: "Revoke", Handler: _TokenService_Revoke_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "token/v1/token.proto", }
TokenService_ServiceDesc is the grpc.ServiceDesc for TokenService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterTokenServiceHandler ¶
func RegisterTokenServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterTokenServiceHandler registers the http handlers for service TokenService to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterTokenServiceHandlerClient ¶
func RegisterTokenServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client TokenServiceClient) error
RegisterTokenServiceHandlerClient registers the http handlers for service TokenService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "TokenServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "TokenServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "TokenServiceClient" to call the correct interceptors.
func RegisterTokenServiceHandlerFromEndpoint ¶
func RegisterTokenServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterTokenServiceHandlerFromEndpoint is same as RegisterTokenServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterTokenServiceHandlerServer ¶
func RegisterTokenServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server TokenServiceServer) error
RegisterTokenServiceHandlerServer registers the http handlers for service TokenService to "mux". UnaryRPC :call TokenServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterTokenServiceHandlerFromEndpoint instead.
func RegisterTokenServiceServer ¶
func RegisterTokenServiceServer(s grpc.ServiceRegistrar, srv TokenServiceServer)
Types ¶
type IssueRequest ¶
type IssueRequest struct {
Token *Token `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"`
// contains filtered or unexported fields
}
func (*IssueRequest) Descriptor
deprecated
func (*IssueRequest) Descriptor() ([]byte, []int)
Deprecated: Use IssueRequest.ProtoReflect.Descriptor instead.
func (*IssueRequest) GetToken ¶
func (x *IssueRequest) GetToken() *Token
func (*IssueRequest) ProtoMessage ¶
func (*IssueRequest) ProtoMessage()
func (*IssueRequest) ProtoReflect ¶
func (x *IssueRequest) ProtoReflect() protoreflect.Message
func (*IssueRequest) Reset ¶
func (x *IssueRequest) Reset()
func (*IssueRequest) String ¶
func (x *IssueRequest) String() string
type IssueResponse ¶
type IssueResponse struct {
// AccessToken string
// ExpiresAt time.Time
// KeyID string
// TokenType string
AccessToken string `protobuf:"bytes,1,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"`
ExpiresAt *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=expires_at,json=expiresAt,proto3" json:"expires_at,omitempty"`
KeyId string `protobuf:"bytes,3,opt,name=key_id,json=keyId,proto3" json:"key_id,omitempty"`
TokenType string `protobuf:"bytes,4,opt,name=token_type,json=tokenType,proto3" json:"token_type,omitempty"`
// contains filtered or unexported fields
}
func (*IssueResponse) Descriptor
deprecated
func (*IssueResponse) Descriptor() ([]byte, []int)
Deprecated: Use IssueResponse.ProtoReflect.Descriptor instead.
func (*IssueResponse) GetAccessToken ¶
func (x *IssueResponse) GetAccessToken() string
func (*IssueResponse) GetExpiresAt ¶
func (x *IssueResponse) GetExpiresAt() *timestamppb.Timestamp
func (*IssueResponse) GetKeyId ¶
func (x *IssueResponse) GetKeyId() string
func (*IssueResponse) GetTokenType ¶
func (x *IssueResponse) GetTokenType() string
func (*IssueResponse) ProtoMessage ¶
func (*IssueResponse) ProtoMessage()
func (*IssueResponse) ProtoReflect ¶
func (x *IssueResponse) ProtoReflect() protoreflect.Message
func (*IssueResponse) Reset ¶
func (x *IssueResponse) Reset()
func (*IssueResponse) String ¶
func (x *IssueResponse) String() string
type RevokeRequest ¶
type RevokeRequest struct {
Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid,omitempty"`
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
Purge bool `protobuf:"varint,3,opt,name=purge,proto3" json:"purge,omitempty"`
// contains filtered or unexported fields
}
func (*RevokeRequest) Descriptor
deprecated
func (*RevokeRequest) Descriptor() ([]byte, []int)
Deprecated: Use RevokeRequest.ProtoReflect.Descriptor instead.
func (*RevokeRequest) GetName ¶
func (x *RevokeRequest) GetName() string
func (*RevokeRequest) GetPurge ¶
func (x *RevokeRequest) GetPurge() bool
func (*RevokeRequest) GetUid ¶
func (x *RevokeRequest) GetUid() string
func (*RevokeRequest) ProtoMessage ¶
func (*RevokeRequest) ProtoMessage()
func (*RevokeRequest) ProtoReflect ¶
func (x *RevokeRequest) ProtoReflect() protoreflect.Message
func (*RevokeRequest) Reset ¶
func (x *RevokeRequest) Reset()
func (*RevokeRequest) String ¶
func (x *RevokeRequest) String() string
type Token ¶
type Token struct {
Config *TokenConfig `protobuf:"bytes,3,opt,name=config,proto3" json:"config,omitempty"`
// contains filtered or unexported fields
}
func (*Token) Descriptor
deprecated
func (*Token) GetConfig ¶
func (x *Token) GetConfig() *TokenConfig
func (*Token) ProtoMessage ¶
func (*Token) ProtoMessage()
func (*Token) ProtoReflect ¶
func (x *Token) ProtoReflect() protoreflect.Message
type TokenConfig ¶
type TokenConfig struct {
// string subject = 1 [(buf.validate.field).string.min_len = 1];
// string issuer = 2;
// repeated string groups = 3;
// repeated string audience = 4;
// string tenant = 5;
// map<string, string> claims = 6;
// google.protobuf.Timestamp auth_time = 7;
// google.protobuf.Duration ttl = 8;
Subject string `protobuf:"bytes,1,opt,name=subject,proto3" json:"subject,omitempty"`
Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"`
Groups []string `protobuf:"bytes,3,rep,name=groups,proto3" json:"groups,omitempty"`
Audience []string `protobuf:"bytes,4,rep,name=audience,proto3" json:"audience,omitempty"`
Scopes []string `protobuf:"bytes,5,rep,name=scopes,proto3" json:"scopes,omitempty"`
Clusters []string `protobuf:"bytes,6,rep,name=clusters,proto3" json:"clusters,omitempty"`
ServiceAccounts []string `protobuf:"bytes,7,rep,name=service_accounts,json=serviceAccounts,proto3" json:"service_accounts,omitempty"`
Ttl *durationpb.Duration `protobuf:"bytes,8,opt,name=ttl,proto3" json:"ttl,omitempty"`
ExtraClaims map[string]string `` /* 182-byte string literal not displayed */
// contains filtered or unexported fields
}
func (*TokenConfig) Descriptor
deprecated
func (*TokenConfig) Descriptor() ([]byte, []int)
Deprecated: Use TokenConfig.ProtoReflect.Descriptor instead.
func (*TokenConfig) GetAudience ¶
func (x *TokenConfig) GetAudience() []string
func (*TokenConfig) GetClusters ¶
func (x *TokenConfig) GetClusters() []string
func (*TokenConfig) GetExtraClaims ¶
func (x *TokenConfig) GetExtraClaims() map[string]string
func (*TokenConfig) GetGroups ¶
func (x *TokenConfig) GetGroups() []string
func (*TokenConfig) GetScopes ¶
func (x *TokenConfig) GetScopes() []string
func (*TokenConfig) GetServiceAccounts ¶
func (x *TokenConfig) GetServiceAccounts() []string
func (*TokenConfig) GetSubject ¶
func (x *TokenConfig) GetSubject() string
func (*TokenConfig) GetTtl ¶
func (x *TokenConfig) GetTtl() *durationpb.Duration
func (*TokenConfig) GetUsername ¶
func (x *TokenConfig) GetUsername() string
func (*TokenConfig) ProtoMessage ¶
func (*TokenConfig) ProtoMessage()
func (*TokenConfig) ProtoReflect ¶
func (x *TokenConfig) ProtoReflect() protoreflect.Message
func (*TokenConfig) Reset ¶
func (x *TokenConfig) Reset()
func (*TokenConfig) String ¶
func (x *TokenConfig) String() string
type TokenServiceClient ¶
type TokenServiceClient interface {
Issue(ctx context.Context, in *IssueRequest, opts ...grpc.CallOption) (*IssueResponse, error)
Revoke(ctx context.Context, in *RevokeRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
}
TokenServiceClient is the client API for TokenService 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.
func NewTokenServiceClient ¶
func NewTokenServiceClient(cc grpc.ClientConnInterface) TokenServiceClient
type TokenServiceServer ¶
type TokenServiceServer interface {
Issue(context.Context, *IssueRequest) (*IssueResponse, error)
Revoke(context.Context, *RevokeRequest) (*emptypb.Empty, error)
// contains filtered or unexported methods
}
TokenServiceServer is the server API for TokenService service. All implementations must embed UnimplementedTokenServiceServer for forward compatibility
type TokenStatus ¶
type TokenStatus struct {
// contains filtered or unexported fields
}
func (*TokenStatus) Descriptor
deprecated
func (*TokenStatus) Descriptor() ([]byte, []int)
Deprecated: Use TokenStatus.ProtoReflect.Descriptor instead.
func (*TokenStatus) ProtoMessage ¶
func (*TokenStatus) ProtoMessage()
func (*TokenStatus) ProtoReflect ¶
func (x *TokenStatus) ProtoReflect() protoreflect.Message
func (*TokenStatus) Reset ¶
func (x *TokenStatus) Reset()
func (*TokenStatus) String ¶
func (x *TokenStatus) String() string
type UnimplementedTokenServiceServer ¶
type UnimplementedTokenServiceServer struct {
}
UnimplementedTokenServiceServer must be embedded to have forward compatible implementations.
func (UnimplementedTokenServiceServer) Issue ¶
func (UnimplementedTokenServiceServer) Issue(context.Context, *IssueRequest) (*IssueResponse, error)
func (UnimplementedTokenServiceServer) Revoke ¶
func (UnimplementedTokenServiceServer) Revoke(context.Context, *RevokeRequest) (*emptypb.Empty, error)
type UnsafeTokenServiceServer ¶
type UnsafeTokenServiceServer interface {
// contains filtered or unexported methods
}
UnsafeTokenServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to TokenServiceServer will result in compilation errors.