tokensv1

package
v0.0.0-...-59c490d Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package tokensv1 is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	TokenService_Authenticate_FullMethodName = "/tokens.v1.TokenService/Authenticate"
	TokenService_List_FullMethodName         = "/tokens.v1.TokenService/List"
	TokenService_Create_FullMethodName       = "/tokens.v1.TokenService/Create"
	TokenService_Delete_FullMethodName       = "/tokens.v1.TokenService/Delete"
)

Variables

View Source
var File_tokens_v1_service_proto protoreflect.FileDescriptor
View Source
var TokenService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "tokens.v1.TokenService",
	HandlerType: (*TokenServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Authenticate",
			Handler:    _TokenService_Authenticate_Handler,
		},
		{
			MethodName: "List",
			Handler:    _TokenService_List_Handler,
		},
		{
			MethodName: "Create",
			Handler:    _TokenService_Create_Handler,
		},
		{
			MethodName: "Delete",
			Handler:    _TokenService_Delete_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "tokens/v1/service.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 AuthenticateRequest

type AuthenticateRequest struct {

	// grant_type = client_credentials, refresh_token, password, authorization_code, license
	GrantType string `protobuf:"bytes,1,opt,name=grant_type,json=grantType,proto3" json:"grant_type,omitempty"`
	// required for a handful of workflows
	// can also come from the basic auth header
	ClientId     string `protobuf:"bytes,2,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"`
	ClientSecret string `protobuf:"bytes,3,opt,name=client_secret,json=clientSecret,proto3" json:"client_secret,omitempty"`
	// grant_type=refresh_token
	RefreshToken string `protobuf:"bytes,4,opt,name=refresh_token,json=refreshToken,proto3" json:"refresh_token,omitempty"`
	// grant_type=password
	Username string `protobuf:"bytes,5,opt,name=username,proto3" json:"username,omitempty"`
	Password string `protobuf:"bytes,6,opt,name=password,proto3" json:"password,omitempty"`
	// grant_type=authorization_code
	Code         string `protobuf:"bytes,7,opt,name=code,proto3" json:"code,omitempty"`
	RedirectUri  string `protobuf:"bytes,8,opt,name=redirect_uri,json=redirectUri,proto3" json:"redirect_uri,omitempty"`
	CodeVerifier string `protobuf:"bytes,9,opt,name=code_verifier,json=codeVerifier,proto3" json:"code_verifier,omitempty"`
	// grant_type=license
	License string `protobuf:"bytes,10,opt,name=license,proto3" json:"license,omitempty"`
	Scope   string `protobuf:"bytes,20,opt,name=scope,proto3" json:"scope,omitempty"`
	// contains filtered or unexported fields
}

func (*AuthenticateRequest) Descriptor deprecated

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

Deprecated: Use AuthenticateRequest.ProtoReflect.Descriptor instead.

func (*AuthenticateRequest) GetClientId

func (x *AuthenticateRequest) GetClientId() string

func (*AuthenticateRequest) GetClientSecret

func (x *AuthenticateRequest) GetClientSecret() string

func (*AuthenticateRequest) GetCode

func (x *AuthenticateRequest) GetCode() string

func (*AuthenticateRequest) GetCodeVerifier

func (x *AuthenticateRequest) GetCodeVerifier() string

func (*AuthenticateRequest) GetGrantType

func (x *AuthenticateRequest) GetGrantType() string

func (*AuthenticateRequest) GetLicense

func (x *AuthenticateRequest) GetLicense() string

func (*AuthenticateRequest) GetPassword

func (x *AuthenticateRequest) GetPassword() string

func (*AuthenticateRequest) GetRedirectUri

func (x *AuthenticateRequest) GetRedirectUri() string

func (*AuthenticateRequest) GetRefreshToken

func (x *AuthenticateRequest) GetRefreshToken() string

func (*AuthenticateRequest) GetScope

func (x *AuthenticateRequest) GetScope() string

func (*AuthenticateRequest) GetUsername

func (x *AuthenticateRequest) GetUsername() 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 {
	AccessToken      string `protobuf:"bytes,1,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"`
	TokenType        string `protobuf:"bytes,2,opt,name=token_type,json=tokenType,proto3" json:"token_type,omitempty"`
	ExpiresIn        int32  `protobuf:"varint,3,opt,name=expires_in,json=expiresIn,proto3" json:"expires_in,omitempty"`
	RefreshToken     string `protobuf:"bytes,4,opt,name=refresh_token,json=refreshToken,proto3" json:"refresh_token,omitempty"`
	Scope            string `protobuf:"bytes,5,opt,name=scope,proto3" json:"scope,omitempty"`
	Error            string `protobuf:"bytes,10,opt,name=error,proto3" json:"error,omitempty"`
	ErrorDescription string `protobuf:"bytes,11,opt,name=error_description,json=errorDescription,proto3" json:"error_description,omitempty"`
	ErrorUri         string `protobuf:"bytes,12,opt,name=error_uri,json=errorUri,proto3" json:"error_uri,omitempty"`
	// contains filtered or unexported fields
}

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) GetError

func (x *AuthenticateResponse) GetError() string

func (*AuthenticateResponse) GetErrorDescription

func (x *AuthenticateResponse) GetErrorDescription() string

func (*AuthenticateResponse) GetErrorUri

func (x *AuthenticateResponse) GetErrorUri() string

func (*AuthenticateResponse) GetExpiresIn

func (x *AuthenticateResponse) GetExpiresIn() int32

func (*AuthenticateResponse) GetRefreshToken

func (x *AuthenticateResponse) GetRefreshToken() string

func (*AuthenticateResponse) GetScope

func (x *AuthenticateResponse) GetScope() string

func (*AuthenticateResponse) GetTokenType

func (x *AuthenticateResponse) GetTokenType() 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 CreateRequest

type CreateRequest struct {
	Token *Token `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateRequest) Descriptor deprecated

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

Deprecated: Use CreateRequest.ProtoReflect.Descriptor instead.

func (*CreateRequest) GetToken

func (x *CreateRequest) GetToken() *Token

func (*CreateRequest) ProtoMessage

func (*CreateRequest) ProtoMessage()

func (*CreateRequest) ProtoReflect

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

func (*CreateRequest) Reset

func (x *CreateRequest) Reset()

func (*CreateRequest) String

func (x *CreateRequest) String() string

type CreateResponse

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

func (*CreateResponse) Descriptor deprecated

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

Deprecated: Use CreateResponse.ProtoReflect.Descriptor instead.

func (*CreateResponse) GetToken

func (x *CreateResponse) GetToken() string

func (*CreateResponse) ProtoMessage

func (*CreateResponse) ProtoMessage()

func (*CreateResponse) ProtoReflect

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

func (*CreateResponse) Reset

func (x *CreateResponse) Reset()

func (*CreateResponse) String

func (x *CreateResponse) String() string

type DeleteRequest

type DeleteRequest struct {
	TokenId string `protobuf:"bytes,1,opt,name=token_id,json=tokenId,proto3" json:"token_id,omitempty"`
	// contains filtered or unexported fields
}

func (*DeleteRequest) Descriptor deprecated

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

Deprecated: Use DeleteRequest.ProtoReflect.Descriptor instead.

func (*DeleteRequest) GetTokenId

func (x *DeleteRequest) GetTokenId() string

func (*DeleteRequest) ProtoMessage

func (*DeleteRequest) ProtoMessage()

func (*DeleteRequest) ProtoReflect

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

func (*DeleteRequest) Reset

func (x *DeleteRequest) Reset()

func (*DeleteRequest) String

func (x *DeleteRequest) String() string

type DeleteResponse

type DeleteResponse struct {
	// contains filtered or unexported fields
}

func (*DeleteResponse) Descriptor deprecated

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

Deprecated: Use DeleteResponse.ProtoReflect.Descriptor instead.

func (*DeleteResponse) ProtoMessage

func (*DeleteResponse) ProtoMessage()

func (*DeleteResponse) ProtoReflect

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

func (*DeleteResponse) Reset

func (x *DeleteResponse) Reset()

func (*DeleteResponse) String

func (x *DeleteResponse) String() string

type ListRequest

type ListRequest struct {
	// contains filtered or unexported fields
}

func (*ListRequest) Descriptor deprecated

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

Deprecated: Use ListRequest.ProtoReflect.Descriptor instead.

func (*ListRequest) ProtoMessage

func (*ListRequest) ProtoMessage()

func (*ListRequest) ProtoReflect

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

func (*ListRequest) Reset

func (x *ListRequest) Reset()

func (*ListRequest) String

func (x *ListRequest) String() string

type ListResponse

type ListResponse struct {
	Tokens []*Token `protobuf:"bytes,5,rep,name=tokens,proto3" json:"tokens,omitempty"`
	// contains filtered or unexported fields
}

func (*ListResponse) Descriptor deprecated

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

Deprecated: Use ListResponse.ProtoReflect.Descriptor instead.

func (*ListResponse) GetTokens

func (x *ListResponse) GetTokens() []*Token

func (*ListResponse) ProtoMessage

func (*ListResponse) ProtoMessage()

func (*ListResponse) ProtoReflect

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

func (*ListResponse) Reset

func (x *ListResponse) Reset()

func (*ListResponse) String

func (x *ListResponse) String() string

type Token

type Token struct {
	Id     string   `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Name   string   `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	Scopes []string `protobuf:"bytes,3,rep,name=scopes,proto3" json:"scopes,omitempty"`
	// one of
	NoExpiry  bool   `protobuf:"varint,4,opt,name=no_expiry,json=noExpiry,proto3" json:"no_expiry,omitempty"`
	ExpiresAt string `protobuf:"bytes,5,opt,name=expires_at,json=expiresAt,proto3" json:"expires_at,omitempty"`
	ExpiresIn string `protobuf:"bytes,6,opt,name=expires_in,json=expiresIn,proto3" json:"expires_in,omitempty"`
	// contains filtered or unexported fields
}

func (*Token) Descriptor deprecated

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

Deprecated: Use Token.ProtoReflect.Descriptor instead.

func (*Token) GetExpiresAt

func (x *Token) GetExpiresAt() string

func (*Token) GetExpiresIn

func (x *Token) GetExpiresIn() string

func (*Token) GetId

func (x *Token) GetId() string

func (*Token) GetName

func (x *Token) GetName() string

func (*Token) GetNoExpiry

func (x *Token) GetNoExpiry() bool

func (*Token) GetScopes

func (x *Token) GetScopes() []string

func (*Token) ProtoMessage

func (*Token) ProtoMessage()

func (*Token) ProtoReflect

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

func (*Token) Reset

func (x *Token) Reset()

func (*Token) String

func (x *Token) String() string

type TokenServiceClient

type TokenServiceClient interface {
	Authenticate(ctx context.Context, in *AuthenticateRequest, opts ...grpc.CallOption) (*AuthenticateResponse, error)
	List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error)
	Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error)
	Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, 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.

type TokenServiceServer

type TokenServiceServer interface {
	Authenticate(context.Context, *AuthenticateRequest) (*AuthenticateResponse, error)
	List(context.Context, *ListRequest) (*ListResponse, error)
	Create(context.Context, *CreateRequest) (*CreateResponse, error)
	Delete(context.Context, *DeleteRequest) (*DeleteResponse, error)
	// contains filtered or unexported methods
}

TokenServiceServer is the server API for TokenService service. All implementations must embed UnimplementedTokenServiceServer for forward compatibility

type UnimplementedTokenServiceServer

type UnimplementedTokenServiceServer struct {
}

UnimplementedTokenServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedTokenServiceServer) Authenticate

func (UnimplementedTokenServiceServer) Create

func (UnimplementedTokenServiceServer) Delete

func (UnimplementedTokenServiceServer) List

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.

Jump to

Keyboard shortcuts

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