pb

package
v2.24.2 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

README

Protocol Documentation

Table of Contents

Top

m2m-oauth-server/pb/service.proto

CreateTokenRequest
Field Type Label Description
client_id string Client ID
client_secret string Client Secret
audience string repeated Requested token Audience
scope string repeated Requested token scopes
expiration int64 The requested expiration time in unit timestamp seconds from the client. If not provided, the token will use the maximum allowed by the client, or if it exceeds the maximum allowed, an error will occur.
client_assertion_type string Client assertion type
client_assertion string Client assertion
token_name string Token name
grant_type string Grant type

CreateTokenResponse
Field Type Label Description
access_token string
token_type string
expires_in int64
scope string repeated

DeleteTokensRequest
Field Type Label Description
id_filter string repeated

DeleteTokensResponse
Field Type Label Description
blacklisted_count int64
deleted_count int64

GetTokensRequest
Field Type Label Description
id_filter string repeated
include_blacklisted bool

Token

Tokens are deleted from DB after they are expired and blacklisted/revoked

driven by resource change event

Field Type Label Description
id string Token ID / jti
version uint64 Incremental version for update
name string User-friendly token name
owner string Owner of the token
issued_at int64 Unix timestamp in s when the condition has been created/updated
audience string repeated Token Audience
scope string repeated Token scopes
expiration int64 Token expiration in Unix timestamp seconds
client_id string Client ID
original_token_claims google.protobuf.Value Original token claims
blacklisted Token.BlackListed Token black list section
subject string Subject of the token

Token.BlackListed
Field Type Label Description
flag bool Blacklisted enabled flag, if once token has been blacklisted then it can't be unblacklisted/unrevoked
timestamp int64 Unix timestamp in s when the token has been blacklisted

M2MOAuthService
Method Name Request Type Response Type Description
CreateToken CreateTokenRequest CreateTokenResponse Creates a new token
GetTokens GetTokensRequest Token stream Returns all tokens of the owner
DeleteTokens DeleteTokensRequest DeleteTokensResponse Deletes/blacklist tokens

Scalar Value Types

.proto Type Notes C++ Java Python Go C# PHP Ruby
double double double float float64 double float Float
float float float float float32 float float Float
int32 Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. int32 int int int32 int integer Bignum or Fixnum (as required)
int64 Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. int64 long int/long int64 long integer/string Bignum
uint32 Uses variable-length encoding. uint32 int int/long uint32 uint integer Bignum or Fixnum (as required)
uint64 Uses variable-length encoding. uint64 long int/long uint64 ulong integer/string Bignum or Fixnum (as required)
sint32 Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. int32 int int int32 int integer Bignum or Fixnum (as required)
sint64 Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. int64 long int/long int64 long integer/string Bignum
fixed32 Always four bytes. More efficient than uint32 if values are often greater than 2^28. uint32 int int uint32 uint integer Bignum or Fixnum (as required)
fixed64 Always eight bytes. More efficient than uint64 if values are often greater than 2^56. uint64 long int/long uint64 ulong integer/string Bignum
sfixed32 Always four bytes. int32 int int int32 int integer Bignum or Fixnum (as required)
sfixed64 Always eight bytes. int64 long int/long int64 long integer/string Bignum
bool bool boolean boolean bool bool boolean TrueClass/FalseClass
string A string must always contain UTF-8 encoded or 7-bit ASCII text. string String str/unicode string string string String (UTF-8)
bytes May contain any arbitrary sequence of bytes. string ByteString str []byte ByteString string String (ASCII-8BIT)

Documentation

Overview

Package pb is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	M2MOAuthService_CreateToken_FullMethodName  = "/m2moauthserver.pb.M2MOAuthService/CreateToken"
	M2MOAuthService_GetTokens_FullMethodName    = "/m2moauthserver.pb.M2MOAuthService/GetTokens"
	M2MOAuthService_DeleteTokens_FullMethodName = "/m2moauthserver.pb.M2MOAuthService/DeleteTokens"
)
View Source
const (
	ExpirationKey           = "expiration"
	OwnerKey                = "owner"
	BlackListedFlagKey      = BlackListedKey + ".flag"
	BlackListedTimestampKey = BlackListedKey + ".timestamp"
	BlackListedKey          = "blacklisted"
	TimestampKey            = "timestamp"
	AudienceKey             = "audience"
	IssuedAtKey             = "issuedAt"
)

Variables

View Source
var File_m2m_oauth_server_pb_service_proto protoreflect.FileDescriptor
View Source
var M2MOAuthService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "m2moauthserver.pb.M2MOAuthService",
	HandlerType: (*M2MOAuthServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "CreateToken",
			Handler:    _M2MOAuthService_CreateToken_Handler,
		},
		{
			MethodName: "DeleteTokens",
			Handler:    _M2MOAuthService_DeleteTokens_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "GetTokens",
			Handler:       _M2MOAuthService_GetTokens_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "m2m-oauth-server/pb/service.proto",
}

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

Functions

func RegisterM2MOAuthServiceHandler

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

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

func RegisterM2MOAuthServiceHandlerClient

func RegisterM2MOAuthServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client M2MOAuthServiceClient) error

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

func RegisterM2MOAuthServiceHandlerFromEndpoint

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

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

func RegisterM2MOAuthServiceHandlerServer

func RegisterM2MOAuthServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server M2MOAuthServiceServer) error

RegisterM2MOAuthServiceHandlerServer registers the http handlers for service M2MOAuthService to "mux". UnaryRPC :call M2MOAuthServiceServer 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 RegisterM2MOAuthServiceHandlerFromEndpoint instead. GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.

func RegisterM2MOAuthServiceServer

func RegisterM2MOAuthServiceServer(s grpc.ServiceRegistrar, srv M2MOAuthServiceServer)

Types

type CreateTokenRequest

type CreateTokenRequest struct {

	// Client ID
	ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"`
	// Client Secret
	ClientSecret string `protobuf:"bytes,2,opt,name=client_secret,json=clientSecret,proto3" json:"client_secret,omitempty"`
	// Requested token Audience
	Audience []string `protobuf:"bytes,3,rep,name=audience,proto3" json:"audience,omitempty"`
	// Requested token scopes
	Scope []string `protobuf:"bytes,4,rep,name=scope,proto3" json:"scope,omitempty"`
	// The requested expiration time in unit timestamp seconds from the client. If not provided, the token will use the maximum allowed by the client, or if it exceeds the maximum allowed, an error will occur.
	Expiration int64 `protobuf:"varint,5,opt,name=expiration,proto3" json:"expiration,omitempty"`
	// Client assertion type
	ClientAssertionType string `protobuf:"bytes,6,opt,name=client_assertion_type,json=clientAssertionType,proto3" json:"client_assertion_type,omitempty"`
	// Client assertion
	ClientAssertion string `protobuf:"bytes,7,opt,name=client_assertion,json=clientAssertion,proto3" json:"client_assertion,omitempty"`
	// Token name
	TokenName string `protobuf:"bytes,8,opt,name=token_name,json=tokenName,proto3" json:"token_name,omitempty"`
	// Grant type
	GrantType string `protobuf:"bytes,9,opt,name=grant_type,json=grantType,proto3" json:"grant_type,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateTokenRequest) Descriptor deprecated

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

Deprecated: Use CreateTokenRequest.ProtoReflect.Descriptor instead.

func (*CreateTokenRequest) GetAudience

func (x *CreateTokenRequest) GetAudience() []string

func (*CreateTokenRequest) GetClientAssertion

func (x *CreateTokenRequest) GetClientAssertion() string

func (*CreateTokenRequest) GetClientAssertionType

func (x *CreateTokenRequest) GetClientAssertionType() string

func (*CreateTokenRequest) GetClientId

func (x *CreateTokenRequest) GetClientId() string

func (*CreateTokenRequest) GetClientSecret

func (x *CreateTokenRequest) GetClientSecret() string

func (*CreateTokenRequest) GetExpiration

func (x *CreateTokenRequest) GetExpiration() int64

func (*CreateTokenRequest) GetGrantType

func (x *CreateTokenRequest) GetGrantType() string

func (*CreateTokenRequest) GetScope

func (x *CreateTokenRequest) GetScope() []string

func (*CreateTokenRequest) GetTokenName

func (x *CreateTokenRequest) GetTokenName() string

func (*CreateTokenRequest) ProtoMessage

func (*CreateTokenRequest) ProtoMessage()

func (*CreateTokenRequest) ProtoReflect

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

func (*CreateTokenRequest) Reset

func (x *CreateTokenRequest) Reset()

func (*CreateTokenRequest) String

func (x *CreateTokenRequest) String() string

type CreateTokenResponse

type CreateTokenResponse 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   int64    `protobuf:"varint,3,opt,name=expires_in,json=expiresIn,proto3" json:"expires_in,omitempty"`
	Scope       []string `protobuf:"bytes,4,rep,name=scope,proto3" json:"scope,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateTokenResponse) Descriptor deprecated

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

Deprecated: Use CreateTokenResponse.ProtoReflect.Descriptor instead.

func (*CreateTokenResponse) GetAccessToken

func (x *CreateTokenResponse) GetAccessToken() string

func (*CreateTokenResponse) GetExpiresIn

func (x *CreateTokenResponse) GetExpiresIn() int64

func (*CreateTokenResponse) GetScope

func (x *CreateTokenResponse) GetScope() []string

func (*CreateTokenResponse) GetTokenType

func (x *CreateTokenResponse) GetTokenType() string

func (*CreateTokenResponse) ProtoMessage

func (*CreateTokenResponse) ProtoMessage()

func (*CreateTokenResponse) ProtoReflect

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

func (*CreateTokenResponse) Reset

func (x *CreateTokenResponse) Reset()

func (*CreateTokenResponse) String

func (x *CreateTokenResponse) String() string

type DeleteTokensRequest

type DeleteTokensRequest struct {
	IdFilter []string `protobuf:"bytes,1,rep,name=id_filter,json=idFilter,proto3" json:"id_filter,omitempty"`
	// contains filtered or unexported fields
}

func (*DeleteTokensRequest) Descriptor deprecated

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

Deprecated: Use DeleteTokensRequest.ProtoReflect.Descriptor instead.

func (*DeleteTokensRequest) GetIdFilter

func (x *DeleteTokensRequest) GetIdFilter() []string

func (*DeleteTokensRequest) ProtoMessage

func (*DeleteTokensRequest) ProtoMessage()

func (*DeleteTokensRequest) ProtoReflect

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

func (*DeleteTokensRequest) Reset

func (x *DeleteTokensRequest) Reset()

func (*DeleteTokensRequest) String

func (x *DeleteTokensRequest) String() string

type DeleteTokensResponse

type DeleteTokensResponse struct {
	BlacklistedCount int64 `protobuf:"varint,1,opt,name=blacklisted_count,json=blacklistedCount,proto3" json:"blacklisted_count,omitempty"`
	DeletedCount     int64 `protobuf:"varint,2,opt,name=deleted_count,json=deletedCount,proto3" json:"deleted_count,omitempty"`
	// contains filtered or unexported fields
}

func (*DeleteTokensResponse) Descriptor deprecated

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

Deprecated: Use DeleteTokensResponse.ProtoReflect.Descriptor instead.

func (*DeleteTokensResponse) GetBlacklistedCount

func (x *DeleteTokensResponse) GetBlacklistedCount() int64

func (*DeleteTokensResponse) GetDeletedCount

func (x *DeleteTokensResponse) GetDeletedCount() int64

func (*DeleteTokensResponse) ProtoMessage

func (*DeleteTokensResponse) ProtoMessage()

func (*DeleteTokensResponse) ProtoReflect

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

func (*DeleteTokensResponse) Reset

func (x *DeleteTokensResponse) Reset()

func (*DeleteTokensResponse) String

func (x *DeleteTokensResponse) String() string

type GetTokensRequest

type GetTokensRequest struct {
	IdFilter           []string `protobuf:"bytes,1,rep,name=id_filter,json=idFilter,proto3" json:"id_filter,omitempty"`
	IncludeBlacklisted bool     `protobuf:"varint,2,opt,name=include_blacklisted,json=includeBlacklisted,proto3" json:"include_blacklisted,omitempty"`
	// contains filtered or unexported fields
}

func (*GetTokensRequest) Descriptor deprecated

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

Deprecated: Use GetTokensRequest.ProtoReflect.Descriptor instead.

func (*GetTokensRequest) GetIdFilter

func (x *GetTokensRequest) GetIdFilter() []string

func (*GetTokensRequest) GetIncludeBlacklisted

func (x *GetTokensRequest) GetIncludeBlacklisted() bool

func (*GetTokensRequest) ProtoMessage

func (*GetTokensRequest) ProtoMessage()

func (*GetTokensRequest) ProtoReflect

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

func (*GetTokensRequest) Reset

func (x *GetTokensRequest) Reset()

func (*GetTokensRequest) String

func (x *GetTokensRequest) String() string

type M2MOAuthServiceClient

type M2MOAuthServiceClient interface {
	// Creates a new token
	CreateToken(ctx context.Context, in *CreateTokenRequest, opts ...grpc.CallOption) (*CreateTokenResponse, error)
	// Returns all tokens of the owner
	GetTokens(ctx context.Context, in *GetTokensRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[Token], error)
	// Deletes/blacklist tokens
	DeleteTokens(ctx context.Context, in *DeleteTokensRequest, opts ...grpc.CallOption) (*DeleteTokensResponse, error)
}

M2MOAuthServiceClient is the client API for M2MOAuthService 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 M2MOAuthServiceServer

type M2MOAuthServiceServer interface {
	// Creates a new token
	CreateToken(context.Context, *CreateTokenRequest) (*CreateTokenResponse, error)
	// Returns all tokens of the owner
	GetTokens(*GetTokensRequest, grpc.ServerStreamingServer[Token]) error
	// Deletes/blacklist tokens
	DeleteTokens(context.Context, *DeleteTokensRequest) (*DeleteTokensResponse, error)
	// contains filtered or unexported methods
}

M2MOAuthServiceServer is the server API for M2MOAuthService service. All implementations must embed UnimplementedM2MOAuthServiceServer for forward compatibility.

type M2MOAuthService_GetTokensClient

type M2MOAuthService_GetTokensClient = grpc.ServerStreamingClient[Token]

This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.

type M2MOAuthService_GetTokensServer

type M2MOAuthService_GetTokensServer = grpc.ServerStreamingServer[Token]

This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.

type Token

type Token struct {

	// Token ID / jti
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// Incremental version for update
	Version uint64 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"`
	// User-friendly token name
	Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
	// Owner of the token
	Owner string `protobuf:"bytes,4,opt,name=owner,proto3" json:"owner,omitempty"`
	// Unix timestamp in s when the condition has been created/updated
	IssuedAt int64 `protobuf:"varint,5,opt,name=issued_at,json=issuedAt,proto3" json:"issued_at,omitempty"`
	// Token Audience
	Audience []string `protobuf:"bytes,6,rep,name=audience,proto3" json:"audience,omitempty"`
	// Token scopes
	Scope []string `protobuf:"bytes,7,rep,name=scope,proto3" json:"scope,omitempty"`
	// Token expiration in Unix timestamp seconds
	Expiration int64 `protobuf:"varint,8,opt,name=expiration,proto3" json:"expiration,omitempty"`
	// Client ID
	ClientId string `protobuf:"bytes,9,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"`
	// Original token claims
	OriginalTokenClaims *structpb.Value `protobuf:"bytes,10,opt,name=original_token_claims,json=originalTokenClaims,proto3" json:"original_token_claims,omitempty"`
	// Token black list section
	Blacklisted *Token_BlackListed `protobuf:"bytes,11,opt,name=blacklisted,proto3" json:"blacklisted,omitempty"`
	// Subject of the token
	Subject string `protobuf:"bytes,12,opt,name=subject,proto3" json:"subject,omitempty"`
	// contains filtered or unexported fields
}

Tokens are deleted from DB after they are expired and blacklisted/revoked

func (*Token) Descriptor deprecated

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

Deprecated: Use Token.ProtoReflect.Descriptor instead.

func (*Token) GetAudience

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

func (*Token) GetBlacklisted

func (x *Token) GetBlacklisted() *Token_BlackListed

func (*Token) GetClientId

func (x *Token) GetClientId() string

func (*Token) GetExpiration

func (x *Token) GetExpiration() int64

func (*Token) GetId

func (x *Token) GetId() string

func (*Token) GetIssuedAt

func (x *Token) GetIssuedAt() int64

func (*Token) GetName

func (x *Token) GetName() string

func (*Token) GetOriginalTokenClaims

func (x *Token) GetOriginalTokenClaims() *structpb.Value

func (*Token) GetOwner

func (x *Token) GetOwner() string

func (*Token) GetScope

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

func (*Token) GetSubject

func (x *Token) GetSubject() string

func (*Token) GetVersion

func (x *Token) GetVersion() uint64

func (*Token) MarshalBSON

func (x *Token) MarshalBSON() ([]byte, error)

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

func (*Token) UnmarshalBSON

func (x *Token) UnmarshalBSON(data []byte) error

func (*Token) Validate

func (x *Token) Validate() error

type Token_BlackListed

type Token_BlackListed struct {

	// Blacklisted enabled flag, if once token has been blacklisted then it can't be unblacklisted/unrevoked
	Flag bool `protobuf:"varint,1,opt,name=flag,proto3" json:"flag,omitempty"`
	// Unix timestamp in s when the token has been blacklisted
	Timestamp int64 `protobuf:"varint,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
	// contains filtered or unexported fields
}

func (*Token_BlackListed) Descriptor deprecated

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

Deprecated: Use Token_BlackListed.ProtoReflect.Descriptor instead.

func (*Token_BlackListed) GetFlag

func (x *Token_BlackListed) GetFlag() bool

func (*Token_BlackListed) GetTimestamp

func (x *Token_BlackListed) GetTimestamp() int64

func (*Token_BlackListed) MarshalBSON

func (x *Token_BlackListed) MarshalBSON() ([]byte, error)

func (*Token_BlackListed) ProtoMessage

func (*Token_BlackListed) ProtoMessage()

func (*Token_BlackListed) ProtoReflect

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

func (*Token_BlackListed) Reset

func (x *Token_BlackListed) Reset()

func (*Token_BlackListed) String

func (x *Token_BlackListed) String() string

type UnimplementedM2MOAuthServiceServer

type UnimplementedM2MOAuthServiceServer struct{}

UnimplementedM2MOAuthServiceServer 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 (UnimplementedM2MOAuthServiceServer) CreateToken

func (UnimplementedM2MOAuthServiceServer) DeleteTokens

func (UnimplementedM2MOAuthServiceServer) GetTokens

type UnsafeM2MOAuthServiceServer

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

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

Jump to

Keyboard shortcuts

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