v1

package
v0.1.62 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 16, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package v1 is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var AuthService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "proto.rpc.v1.AuthService",
	HandlerType: (*AuthServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Authenticate",
			Handler:    _AuthService_Authenticate_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "proto/rpc/v1/auth.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)

View Source
var ExternalAuthService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "proto.rpc.v1.ExternalAuthService",
	HandlerType: (*ExternalAuthServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "AuthenticateTo",
			Handler:    _ExternalAuthService_AuthenticateTo_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "proto/rpc/v1/auth.proto",
}

ExternalAuthService_ServiceDesc is the grpc.ServiceDesc for ExternalAuthService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

View Source
var File_proto_rpc_v1_auth_proto protoreflect.FileDescriptor

Functions

func RegisterAuthServiceHandler

func RegisterAuthServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterAuthServiceHandler registers the http handlers for service AuthService to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterAuthServiceHandlerClient

func RegisterAuthServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client AuthServiceClient) error

RegisterAuthServiceHandlerClient registers the http handlers for service AuthService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "AuthServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "AuthServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "AuthServiceClient" to call the correct interceptors.

func RegisterAuthServiceHandlerFromEndpoint

func RegisterAuthServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterAuthServiceHandlerFromEndpoint is same as RegisterAuthServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterAuthServiceHandlerServer

func RegisterAuthServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server AuthServiceServer) error

RegisterAuthServiceHandlerServer registers the http handlers for service AuthService to "mux". UnaryRPC :call AuthServiceServer 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 RegisterAuthServiceHandlerFromEndpoint instead.

func RegisterAuthServiceServer

func RegisterAuthServiceServer(s grpc.ServiceRegistrar, srv AuthServiceServer)

func RegisterExternalAuthServiceHandler added in v0.0.3

func RegisterExternalAuthServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterExternalAuthServiceHandler registers the http handlers for service ExternalAuthService to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterExternalAuthServiceHandlerClient added in v0.0.3

func RegisterExternalAuthServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ExternalAuthServiceClient) error

RegisterExternalAuthServiceHandlerClient registers the http handlers for service ExternalAuthService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ExternalAuthServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ExternalAuthServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "ExternalAuthServiceClient" to call the correct interceptors.

func RegisterExternalAuthServiceHandlerFromEndpoint added in v0.0.3

func RegisterExternalAuthServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterExternalAuthServiceHandlerFromEndpoint is same as RegisterExternalAuthServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterExternalAuthServiceHandlerServer added in v0.0.3

func RegisterExternalAuthServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ExternalAuthServiceServer) error

RegisterExternalAuthServiceHandlerServer registers the http handlers for service ExternalAuthService to "mux". UnaryRPC :call ExternalAuthServiceServer 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 RegisterExternalAuthServiceHandlerFromEndpoint instead.

func RegisterExternalAuthServiceServer added in v0.0.3

func RegisterExternalAuthServiceServer(s grpc.ServiceRegistrar, srv ExternalAuthServiceServer)

Types

type AuthServiceClient

type AuthServiceClient interface {
	// Authenticate attempts to authenticate the caller claiming to be
	// the given entity. The resulting response contains an access token
	// with the subject as the entity and the audience/issuer as the
	// provider of this service. This token should be used for all future
	// RPC requests.
	Authenticate(ctx context.Context, in *AuthenticateRequest, opts ...grpc.CallOption) (*AuthenticateResponse, 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.

type AuthServiceServer

type AuthServiceServer interface {
	// Authenticate attempts to authenticate the caller claiming to be
	// the given entity. The resulting response contains an access token
	// with the subject as the entity and the audience/issuer as the
	// provider of this service. This token should be used for all future
	// RPC requests.
	Authenticate(context.Context, *AuthenticateRequest) (*AuthenticateResponse, error)
	// contains filtered or unexported methods
}

AuthServiceServer is the server API for AuthService service. All implementations must embed UnimplementedAuthServiceServer for forward compatibility

type AuthenticateRequest

type AuthenticateRequest struct {
	Entity      string       `protobuf:"bytes,1,opt,name=entity,proto3" json:"entity,omitempty"`
	Credentials *Credentials `protobuf:"bytes,2,opt,name=credentials,proto3" json:"credentials,omitempty"`
	// contains filtered or unexported fields
}

An AuthenticateRequest contains the credentials used to authenticate.

func (*AuthenticateRequest) Descriptor deprecated

func (*AuthenticateRequest) Descriptor() ([]byte, []int)

Deprecated: Use AuthenticateRequest.ProtoReflect.Descriptor instead.

func (*AuthenticateRequest) GetCredentials

func (x *AuthenticateRequest) GetCredentials() *Credentials

func (*AuthenticateRequest) GetEntity

func (x *AuthenticateRequest) GetEntity() string

func (*AuthenticateRequest) ProtoMessage

func (*AuthenticateRequest) ProtoMessage()

func (*AuthenticateRequest) ProtoReflect

func (x *AuthenticateRequest) ProtoReflect() protoreflect.Message

func (*AuthenticateRequest) Reset

func (x *AuthenticateRequest) Reset()

func (*AuthenticateRequest) String

func (x *AuthenticateRequest) String() string

type AuthenticateResponse

type AuthenticateResponse struct {

	// access_token is a JWT where only the expiration should be deemed
	// important.
	AccessToken string `protobuf:"bytes,1,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"` // Future(erd): maybe a refresh_token
	// contains filtered or unexported fields
}

An AuthenticateResponse is returned after successful authentication.

func (*AuthenticateResponse) Descriptor deprecated

func (*AuthenticateResponse) Descriptor() ([]byte, []int)

Deprecated: Use AuthenticateResponse.ProtoReflect.Descriptor instead.

func (*AuthenticateResponse) GetAccessToken

func (x *AuthenticateResponse) GetAccessToken() string

func (*AuthenticateResponse) ProtoMessage

func (*AuthenticateResponse) ProtoMessage()

func (*AuthenticateResponse) ProtoReflect

func (x *AuthenticateResponse) ProtoReflect() protoreflect.Message

func (*AuthenticateResponse) Reset

func (x *AuthenticateResponse) Reset()

func (*AuthenticateResponse) String

func (x *AuthenticateResponse) String() string

type AuthenticateToRequest added in v0.0.3

type AuthenticateToRequest struct {
	Entity string `protobuf:"bytes,1,opt,name=entity,proto3" json:"entity,omitempty"`
	// contains filtered or unexported fields
}

An AuthenticateToRequest contains the entity to authenticate to.

func (*AuthenticateToRequest) Descriptor deprecated added in v0.0.3

func (*AuthenticateToRequest) Descriptor() ([]byte, []int)

Deprecated: Use AuthenticateToRequest.ProtoReflect.Descriptor instead.

func (*AuthenticateToRequest) GetEntity added in v0.0.3

func (x *AuthenticateToRequest) GetEntity() string

func (*AuthenticateToRequest) ProtoMessage added in v0.0.3

func (*AuthenticateToRequest) ProtoMessage()

func (*AuthenticateToRequest) ProtoReflect added in v0.0.3

func (x *AuthenticateToRequest) ProtoReflect() protoreflect.Message

func (*AuthenticateToRequest) Reset added in v0.0.3

func (x *AuthenticateToRequest) Reset()

func (*AuthenticateToRequest) String added in v0.0.3

func (x *AuthenticateToRequest) String() string

type AuthenticateToResponse added in v0.0.3

type AuthenticateToResponse struct {

	// access_token is a JWT where only the expiration should be deemed
	// important.
	AccessToken string `protobuf:"bytes,1,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"` // Future(erd): maybe a refresh_token
	// contains filtered or unexported fields
}

An AuthenticateResponse is returned after successful authentication.

func (*AuthenticateToResponse) Descriptor deprecated added in v0.0.3

func (*AuthenticateToResponse) Descriptor() ([]byte, []int)

Deprecated: Use AuthenticateToResponse.ProtoReflect.Descriptor instead.

func (*AuthenticateToResponse) GetAccessToken added in v0.0.3

func (x *AuthenticateToResponse) GetAccessToken() string

func (*AuthenticateToResponse) ProtoMessage added in v0.0.3

func (*AuthenticateToResponse) ProtoMessage()

func (*AuthenticateToResponse) ProtoReflect added in v0.0.3

func (x *AuthenticateToResponse) ProtoReflect() protoreflect.Message

func (*AuthenticateToResponse) Reset added in v0.0.3

func (x *AuthenticateToResponse) Reset()

func (*AuthenticateToResponse) String added in v0.0.3

func (x *AuthenticateToResponse) String() string

type Credentials

type Credentials struct {

	// type is the type of credentials being used.
	Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
	// payload is an opaque string used that are of the given type above.
	Payload string `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"`
	// contains filtered or unexported fields
}

func (*Credentials) Descriptor deprecated

func (*Credentials) Descriptor() ([]byte, []int)

Deprecated: Use Credentials.ProtoReflect.Descriptor instead.

func (*Credentials) GetPayload

func (x *Credentials) GetPayload() string

func (*Credentials) GetType

func (x *Credentials) GetType() string

func (*Credentials) ProtoMessage

func (*Credentials) ProtoMessage()

func (*Credentials) ProtoReflect

func (x *Credentials) ProtoReflect() protoreflect.Message

func (*Credentials) Reset

func (x *Credentials) Reset()

func (*Credentials) String

func (x *Credentials) String() string

type ExternalAuthServiceClient added in v0.0.3

type ExternalAuthServiceClient interface {
	// AuthenticateTo attempts to allow the caller to authenticate to another entity.
	// The resulting response contains an access token with the subject
	// as the calling entity, the audience as the other entity, and the issuer
	// as the provider of this service. This token should be used for all
	// future RPC requests to the other entity on the services it provides.
	// This assumes that the caller is already authenticated to the
	// server implementing this service.
	AuthenticateTo(ctx context.Context, in *AuthenticateToRequest, opts ...grpc.CallOption) (*AuthenticateToResponse, error)
}

ExternalAuthServiceClient is the client API for ExternalAuthService 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 NewExternalAuthServiceClient added in v0.0.3

func NewExternalAuthServiceClient(cc grpc.ClientConnInterface) ExternalAuthServiceClient

type ExternalAuthServiceServer added in v0.0.3

type ExternalAuthServiceServer interface {
	// AuthenticateTo attempts to allow the caller to authenticate to another entity.
	// The resulting response contains an access token with the subject
	// as the calling entity, the audience as the other entity, and the issuer
	// as the provider of this service. This token should be used for all
	// future RPC requests to the other entity on the services it provides.
	// This assumes that the caller is already authenticated to the
	// server implementing this service.
	AuthenticateTo(context.Context, *AuthenticateToRequest) (*AuthenticateToResponse, error)
	// contains filtered or unexported methods
}

ExternalAuthServiceServer is the server API for ExternalAuthService service. All implementations must embed UnimplementedExternalAuthServiceServer for forward compatibility

type UnimplementedAuthServiceServer

type UnimplementedAuthServiceServer struct {
}

UnimplementedAuthServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedAuthServiceServer) Authenticate

type UnimplementedExternalAuthServiceServer added in v0.0.3

type UnimplementedExternalAuthServiceServer struct {
}

UnimplementedExternalAuthServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedExternalAuthServiceServer) AuthenticateTo added in v0.0.3

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.

type UnsafeExternalAuthServiceServer added in v0.0.3

type UnsafeExternalAuthServiceServer interface {
	// contains filtered or unexported methods
}

UnsafeExternalAuthServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ExternalAuthServiceServer will result in compilation errors.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL