auth_service

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TokenIntent_name = map[int32]string{
		0: "LOGGER",
		1: "FRONTEND",
	}
	TokenIntent_value = map[string]int32{
		"LOGGER":   0,
		"FRONTEND": 1,
	}
)

Enum value maps for TokenIntent.

View Source
var (
	VerifyTokenRequestResultEnum_name = map[int32]string{
		0: "UNAUTHORISED",
		1: "NOTFOUND",
		2: "AUTHORISED",
	}
	VerifyTokenRequestResultEnum_value = map[string]int32{
		"UNAUTHORISED": 0,
		"NOTFOUND":     1,
		"AUTHORISED":   2,
	}
)

Enum value maps for VerifyTokenRequestResultEnum.

View Source
var (
	GenerateTokenRequestResultEnum_name = map[int32]string{
		0: "NAME_ALREADY_EXISTS",
		1: "TOKEN_ALREADY_EXISTS",
		2: "TOKEN_GENERATION_SUCCEEDED",
	}
	GenerateTokenRequestResultEnum_value = map[string]int32{
		"NAME_ALREADY_EXISTS":        0,
		"TOKEN_ALREADY_EXISTS":       1,
		"TOKEN_GENERATION_SUCCEEDED": 2,
	}
)

Enum value maps for GenerateTokenRequestResultEnum.

View Source
var (
	RevokeTokenRequestResultEnum_name = map[int32]string{
		0: "TOKEN_NOT_FOUND",
		1: "TOKEN_REVOKATION_SUCCEEDED",
	}
	RevokeTokenRequestResultEnum_value = map[string]int32{
		"TOKEN_NOT_FOUND":            0,
		"TOKEN_REVOKATION_SUCCEEDED": 1,
	}
)

Enum value maps for RevokeTokenRequestResultEnum.

View Source
var Authentication_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "codectrl.auth_service.Authentication",
	HandlerType: (*AuthenticationServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "VerifyToken",
			Handler:    _Authentication_VerifyToken_Handler,
		},
		{
			MethodName: "GenerateToken",
			Handler:    _Authentication_GenerateToken_Handler,
		},
		{
			MethodName: "RevokeToken",
			Handler:    _Authentication_RevokeToken_Handler,
		},
		{
			MethodName: "RefreshToken",
			Handler:    _Authentication_RefreshToken_Handler,
		},
		{
			MethodName: "GithubLogin",
			Handler:    _Authentication_GithubLogin_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "auth.proto",
}

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

Functions

func RegisterAuthenticationServer

func RegisterAuthenticationServer(s grpc.ServiceRegistrar, srv AuthenticationServer)

Types

type AuthenticationClient

type AuthenticationClient interface {
	// Takes a token and verifies that it is:
	//
	//	a) In valid format
	//	b) Present in the database/filesystem (down to implementation)
	//	c) Has the correct permissions for the given intent
	VerifyToken(ctx context.Context, in *VerifyTokenRequest, opts ...grpc.CallOption) (*VerifyTokenRequestResult, error)
	GenerateToken(ctx context.Context, in *GenerateTokenRequest, opts ...grpc.CallOption) (*GenerateTokenRequestResult, error)
	RevokeToken(ctx context.Context, in *Token, opts ...grpc.CallOption) (*RevokeTokenRequestResult, error)
	RefreshToken(ctx context.Context, in *Token, opts ...grpc.CallOption) (*Token, error)
	GithubLogin(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*LoginUrl, error)
}

AuthenticationClient is the client API for Authentication 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 AuthenticationServer

type AuthenticationServer interface {
	// Takes a token and verifies that it is:
	//
	//	a) In valid format
	//	b) Present in the database/filesystem (down to implementation)
	//	c) Has the correct permissions for the given intent
	VerifyToken(context.Context, *VerifyTokenRequest) (*VerifyTokenRequestResult, error)
	GenerateToken(context.Context, *GenerateTokenRequest) (*GenerateTokenRequestResult, error)
	RevokeToken(context.Context, *Token) (*RevokeTokenRequestResult, error)
	RefreshToken(context.Context, *Token) (*Token, error)
	GithubLogin(context.Context, *emptypb.Empty) (*LoginUrl, error)
	// contains filtered or unexported methods
}

AuthenticationServer is the server API for Authentication service. All implementations must embed UnimplementedAuthenticationServer for forward compatibility

type GenerateTokenRequest

type GenerateTokenRequest struct {
	Name   *Name       `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Intent TokenIntent `protobuf:"varint,2,opt,name=intent,proto3,enum=codectrl.auth_service.TokenIntent" json:"intent,omitempty"`
	// contains filtered or unexported fields
}

func (*GenerateTokenRequest) Descriptor deprecated

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

Deprecated: Use GenerateTokenRequest.ProtoReflect.Descriptor instead.

func (*GenerateTokenRequest) GetIntent

func (x *GenerateTokenRequest) GetIntent() TokenIntent

func (*GenerateTokenRequest) GetName

func (x *GenerateTokenRequest) GetName() *Name

func (*GenerateTokenRequest) ProtoMessage

func (*GenerateTokenRequest) ProtoMessage()

func (*GenerateTokenRequest) ProtoReflect

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

func (*GenerateTokenRequest) Reset

func (x *GenerateTokenRequest) Reset()

func (*GenerateTokenRequest) String

func (x *GenerateTokenRequest) String() string

type GenerateTokenRequestResult

type GenerateTokenRequestResult struct {
	Status GenerateTokenRequestResultEnum `protobuf:"varint,1,opt,name=status,proto3,enum=codectrl.auth_service.GenerateTokenRequestResultEnum" json:"status,omitempty"`
	Token  *Token                         `protobuf:"bytes,2,opt,name=token,proto3,oneof" json:"token,omitempty"`
	// contains filtered or unexported fields
}

func (*GenerateTokenRequestResult) Descriptor deprecated

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

Deprecated: Use GenerateTokenRequestResult.ProtoReflect.Descriptor instead.

func (*GenerateTokenRequestResult) GetStatus

func (*GenerateTokenRequestResult) GetToken

func (x *GenerateTokenRequestResult) GetToken() *Token

func (*GenerateTokenRequestResult) ProtoMessage

func (*GenerateTokenRequestResult) ProtoMessage()

func (*GenerateTokenRequestResult) ProtoReflect

func (*GenerateTokenRequestResult) Reset

func (x *GenerateTokenRequestResult) Reset()

func (*GenerateTokenRequestResult) String

func (x *GenerateTokenRequestResult) String() string

type GenerateTokenRequestResultEnum

type GenerateTokenRequestResultEnum int32
const (
	GenerateTokenRequestResultEnum_NAME_ALREADY_EXISTS        GenerateTokenRequestResultEnum = 0 // If another token under this name is already present.
	GenerateTokenRequestResultEnum_TOKEN_ALREADY_EXISTS       GenerateTokenRequestResultEnum = 1 // If the exact token is already present.
	GenerateTokenRequestResultEnum_TOKEN_GENERATION_SUCCEEDED GenerateTokenRequestResultEnum = 2 // If the token was successfully added.
)

func (GenerateTokenRequestResultEnum) Descriptor

func (GenerateTokenRequestResultEnum) Enum

func (GenerateTokenRequestResultEnum) EnumDescriptor deprecated

func (GenerateTokenRequestResultEnum) EnumDescriptor() ([]byte, []int)

Deprecated: Use GenerateTokenRequestResultEnum.Descriptor instead.

func (GenerateTokenRequestResultEnum) Number

func (GenerateTokenRequestResultEnum) String

func (GenerateTokenRequestResultEnum) Type

type LoginUrl

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

func (*LoginUrl) Descriptor deprecated

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

Deprecated: Use LoginUrl.ProtoReflect.Descriptor instead.

func (*LoginUrl) GetUrl

func (x *LoginUrl) GetUrl() string

func (*LoginUrl) ProtoMessage

func (*LoginUrl) ProtoMessage()

func (*LoginUrl) ProtoReflect

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

func (*LoginUrl) Reset

func (x *LoginUrl) Reset()

func (*LoginUrl) String

func (x *LoginUrl) String() string

type Name

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

func (*Name) Descriptor deprecated

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

Deprecated: Use Name.ProtoReflect.Descriptor instead.

func (*Name) GetInner

func (x *Name) GetInner() string

func (*Name) ProtoMessage

func (*Name) ProtoMessage()

func (*Name) ProtoReflect

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

func (*Name) Reset

func (x *Name) Reset()

func (*Name) String

func (x *Name) String() string

type RevokeTokenRequestResult

type RevokeTokenRequestResult struct {
	Message string                       `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
	Status  RevokeTokenRequestResultEnum `protobuf:"varint,2,opt,name=status,proto3,enum=codectrl.auth_service.RevokeTokenRequestResultEnum" json:"status,omitempty"`
	// contains filtered or unexported fields
}

func (*RevokeTokenRequestResult) Descriptor deprecated

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

Deprecated: Use RevokeTokenRequestResult.ProtoReflect.Descriptor instead.

func (*RevokeTokenRequestResult) GetMessage

func (x *RevokeTokenRequestResult) GetMessage() string

func (*RevokeTokenRequestResult) GetStatus

func (*RevokeTokenRequestResult) ProtoMessage

func (*RevokeTokenRequestResult) ProtoMessage()

func (*RevokeTokenRequestResult) ProtoReflect

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

func (*RevokeTokenRequestResult) Reset

func (x *RevokeTokenRequestResult) Reset()

func (*RevokeTokenRequestResult) String

func (x *RevokeTokenRequestResult) String() string

type RevokeTokenRequestResultEnum

type RevokeTokenRequestResultEnum int32
const (
	RevokeTokenRequestResultEnum_TOKEN_NOT_FOUND            RevokeTokenRequestResultEnum = 0 // If the token is not found.
	RevokeTokenRequestResultEnum_TOKEN_REVOKATION_SUCCEEDED RevokeTokenRequestResultEnum = 1 // If the token was successfully added.
)

func (RevokeTokenRequestResultEnum) Descriptor

func (RevokeTokenRequestResultEnum) Enum

func (RevokeTokenRequestResultEnum) EnumDescriptor deprecated

func (RevokeTokenRequestResultEnum) EnumDescriptor() ([]byte, []int)

Deprecated: Use RevokeTokenRequestResultEnum.Descriptor instead.

func (RevokeTokenRequestResultEnum) Number

func (RevokeTokenRequestResultEnum) String

func (RevokeTokenRequestResultEnum) Type

type Token

type Token struct {
	Name        *Name             `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Permissions *TokenPermissions `protobuf:"bytes,2,opt,name=permissions,proto3" json:"permissions,omitempty"`
	Intent      TokenIntent       `protobuf:"varint,3,opt,name=intent,proto3,enum=codectrl.auth_service.TokenIntent" json:"intent,omitempty"`
	// contains filtered or unexported fields
}

func (*Token) Descriptor deprecated

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

Deprecated: Use Token.ProtoReflect.Descriptor instead.

func (*Token) GetIntent

func (x *Token) GetIntent() TokenIntent

func (*Token) GetName

func (x *Token) GetName() *Name

func (*Token) GetPermissions

func (x *Token) GetPermissions() *TokenPermissions

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 TokenIntent

type TokenIntent int32
const (
	TokenIntent_LOGGER   TokenIntent = 0
	TokenIntent_FRONTEND TokenIntent = 1
)

func (TokenIntent) Descriptor

func (TokenIntent) Enum

func (x TokenIntent) Enum() *TokenIntent

func (TokenIntent) EnumDescriptor deprecated

func (TokenIntent) EnumDescriptor() ([]byte, []int)

Deprecated: Use TokenIntent.Descriptor instead.

func (TokenIntent) Number

func (x TokenIntent) Number() protoreflect.EnumNumber

func (TokenIntent) String

func (x TokenIntent) String() string

func (TokenIntent) Type

type TokenPermissions

type TokenPermissions struct {
	Read  bool `protobuf:"varint,1,opt,name=read,proto3" json:"read,omitempty"`
	Write bool `protobuf:"varint,2,opt,name=write,proto3" json:"write,omitempty"`
	// contains filtered or unexported fields
}

func (*TokenPermissions) Descriptor deprecated

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

Deprecated: Use TokenPermissions.ProtoReflect.Descriptor instead.

func (*TokenPermissions) GetRead

func (x *TokenPermissions) GetRead() bool

func (*TokenPermissions) GetWrite

func (x *TokenPermissions) GetWrite() bool

func (*TokenPermissions) ProtoMessage

func (*TokenPermissions) ProtoMessage()

func (*TokenPermissions) ProtoReflect

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

func (*TokenPermissions) Reset

func (x *TokenPermissions) Reset()

func (*TokenPermissions) String

func (x *TokenPermissions) String() string

type UnimplementedAuthenticationServer

type UnimplementedAuthenticationServer struct {
}

UnimplementedAuthenticationServer must be embedded to have forward compatible implementations.

func (UnimplementedAuthenticationServer) GenerateToken

func (UnimplementedAuthenticationServer) GithubLogin

func (UnimplementedAuthenticationServer) RefreshToken

func (UnimplementedAuthenticationServer) RevokeToken

func (UnimplementedAuthenticationServer) VerifyToken

type UnsafeAuthenticationServer

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

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

type VerifyTokenRequest

type VerifyTokenRequest struct {
	Token  *Token      `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"`
	Intent TokenIntent `protobuf:"varint,2,opt,name=intent,proto3,enum=codectrl.auth_service.TokenIntent" json:"intent,omitempty"`
	// contains filtered or unexported fields
}

func (*VerifyTokenRequest) Descriptor deprecated

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

Deprecated: Use VerifyTokenRequest.ProtoReflect.Descriptor instead.

func (*VerifyTokenRequest) GetIntent

func (x *VerifyTokenRequest) GetIntent() TokenIntent

func (*VerifyTokenRequest) GetToken

func (x *VerifyTokenRequest) GetToken() *Token

func (*VerifyTokenRequest) ProtoMessage

func (*VerifyTokenRequest) ProtoMessage()

func (*VerifyTokenRequest) ProtoReflect

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

func (*VerifyTokenRequest) Reset

func (x *VerifyTokenRequest) Reset()

func (*VerifyTokenRequest) String

func (x *VerifyTokenRequest) String() string

type VerifyTokenRequestResult

type VerifyTokenRequestResult struct {
	Message string                       `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
	Status  VerifyTokenRequestResultEnum `protobuf:"varint,2,opt,name=status,proto3,enum=codectrl.auth_service.VerifyTokenRequestResultEnum" json:"status,omitempty"`
	// contains filtered or unexported fields
}

func (*VerifyTokenRequestResult) Descriptor deprecated

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

Deprecated: Use VerifyTokenRequestResult.ProtoReflect.Descriptor instead.

func (*VerifyTokenRequestResult) GetMessage

func (x *VerifyTokenRequestResult) GetMessage() string

func (*VerifyTokenRequestResult) GetStatus

func (*VerifyTokenRequestResult) ProtoMessage

func (*VerifyTokenRequestResult) ProtoMessage()

func (*VerifyTokenRequestResult) ProtoReflect

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

func (*VerifyTokenRequestResult) Reset

func (x *VerifyTokenRequestResult) Reset()

func (*VerifyTokenRequestResult) String

func (x *VerifyTokenRequestResult) String() string

type VerifyTokenRequestResultEnum

type VerifyTokenRequestResultEnum int32
const (
	VerifyTokenRequestResultEnum_UNAUTHORISED VerifyTokenRequestResultEnum = 0
	VerifyTokenRequestResultEnum_NOTFOUND     VerifyTokenRequestResultEnum = 1
	VerifyTokenRequestResultEnum_AUTHORISED   VerifyTokenRequestResultEnum = 2
)

func (VerifyTokenRequestResultEnum) Descriptor

func (VerifyTokenRequestResultEnum) Enum

func (VerifyTokenRequestResultEnum) EnumDescriptor deprecated

func (VerifyTokenRequestResultEnum) EnumDescriptor() ([]byte, []int)

Deprecated: Use VerifyTokenRequestResultEnum.Descriptor instead.

func (VerifyTokenRequestResultEnum) Number

func (VerifyTokenRequestResultEnum) String

func (VerifyTokenRequestResultEnum) Type

Jump to

Keyboard shortcuts

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