Documentation ¶
Index ¶
- Variables
- func RegisterAuthenticateServer(s grpc.ServiceRegistrar, srv AuthenticateServer)
- type AuthenticateClient
- type AuthenticateServer
- type DeleteUserRequest
- type DeleteUserResponse
- func (*DeleteUserResponse) Descriptor() ([]byte, []int)deprecated
- func (x *DeleteUserResponse) GetDeleted() bool
- func (x *DeleteUserResponse) GetDeletedAt() *timestamppb.Timestamp
- func (*DeleteUserResponse) ProtoMessage()
- func (x *DeleteUserResponse) ProtoReflect() protoreflect.Message
- func (x *DeleteUserResponse) Reset()
- func (x *DeleteUserResponse) String() string
- type LoginRequest
- func (*LoginRequest) Descriptor() ([]byte, []int)deprecated
- func (x *LoginRequest) GetEmail() string
- func (x *LoginRequest) GetPassword() string
- func (x *LoginRequest) GetUsername() string
- func (*LoginRequest) ProtoMessage()
- func (x *LoginRequest) ProtoReflect() protoreflect.Message
- func (x *LoginRequest) Reset()
- func (x *LoginRequest) String() string
- type LogoutResponse
- type RegisterRequest
- func (*RegisterRequest) Descriptor() ([]byte, []int)deprecated
- func (x *RegisterRequest) GetPassword() string
- func (x *RegisterRequest) GetUser() *User
- func (x *RegisterRequest) GetVerifyPassword() string
- func (*RegisterRequest) ProtoMessage()
- func (x *RegisterRequest) ProtoReflect() protoreflect.Message
- func (x *RegisterRequest) Reset()
- func (x *RegisterRequest) String() string
- type RegisterResponse
- type TokenRequest
- func (*TokenRequest) Descriptor() ([]byte, []int)deprecated
- func (x *TokenRequest) GetBearerToken() string
- func (x *TokenRequest) GetBearerTokenUuid() string
- func (x *TokenRequest) GetTokenType() TokenType
- func (*TokenRequest) ProtoMessage()
- func (x *TokenRequest) ProtoReflect() protoreflect.Message
- func (x *TokenRequest) Reset()
- func (x *TokenRequest) String() string
- type TokenResponse
- func (*TokenResponse) Descriptor() ([]byte, []int)deprecated
- func (x *TokenResponse) GetAccessToken() string
- func (x *TokenResponse) GetRefreshToken() string
- func (*TokenResponse) ProtoMessage()
- func (x *TokenResponse) ProtoReflect() protoreflect.Message
- func (x *TokenResponse) Reset()
- func (x *TokenResponse) String() string
- type TokenType
- type UnimplementedAuthenticateServer
- func (UnimplementedAuthenticateServer) Delete(context.Context, *DeleteUserRequest) (*DeleteUserResponse, error)
- func (UnimplementedAuthenticateServer) Login(context.Context, *LoginRequest) (*TokenResponse, error)
- func (UnimplementedAuthenticateServer) Logout(context.Context, *TokenRequest) (*LogoutResponse, error)
- func (UnimplementedAuthenticateServer) LogoutEverywhere(context.Context, *TokenRequest) (*LogoutResponse, error)
- func (UnimplementedAuthenticateServer) RefreshToken(context.Context, *TokenRequest) (*TokenResponse, error)
- func (UnimplementedAuthenticateServer) Register(context.Context, *RegisterRequest) (*RegisterResponse, error)
- func (UnimplementedAuthenticateServer) ValidateToken(context.Context, *TokenRequest) (*ValidateTokenResponse, error)
- type UnsafeAuthenticateServer
- type User
- func (*User) Descriptor() ([]byte, []int)deprecated
- func (x *User) GetEmail() string
- func (x *User) GetFamilyName() string
- func (x *User) GetGivenName() string
- func (x *User) GetId() string
- func (x *User) GetUsername() string
- func (*User) ProtoMessage()
- func (x *User) ProtoReflect() protoreflect.Message
- func (x *User) Reset()
- func (x *User) String() string
- type ValidateTokenResponse
- func (*ValidateTokenResponse) Descriptor() ([]byte, []int)deprecated
- func (x *ValidateTokenResponse) GetValidated() bool
- func (*ValidateTokenResponse) ProtoMessage()
- func (x *ValidateTokenResponse) ProtoReflect() protoreflect.Message
- func (x *ValidateTokenResponse) Reset()
- func (x *ValidateTokenResponse) String() string
Constants ¶
This section is empty.
Variables ¶
var ( TokenType_name = map[int32]string{ 0: "UNKNOWN", 1: "ACCESS", 2: "REFRESH", } TokenType_value = map[string]int32{ "UNKNOWN": 0, "ACCESS": 1, "REFRESH": 2, } )
Enum value maps for TokenType.
var Authenticate_ServiceDesc = grpc.ServiceDesc{ ServiceName: "Authenticate", HandlerType: (*AuthenticateServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Login", Handler: _Authenticate_Login_Handler, }, { MethodName: "Logout", Handler: _Authenticate_Logout_Handler, }, { MethodName: "LogoutEverywhere", Handler: _Authenticate_LogoutEverywhere_Handler, }, { MethodName: "Register", Handler: _Authenticate_Register_Handler, }, { MethodName: "RefreshToken", Handler: _Authenticate_RefreshToken_Handler, }, { MethodName: "ValidateToken", Handler: _Authenticate_ValidateToken_Handler, }, { MethodName: "Delete", Handler: _Authenticate_Delete_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "protobuf/auth.proto", }
Authenticate_ServiceDesc is the grpc.ServiceDesc for Authenticate service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var File_protobuf_auth_proto protoreflect.FileDescriptor
Functions ¶
func RegisterAuthenticateServer ¶
func RegisterAuthenticateServer(s grpc.ServiceRegistrar, srv AuthenticateServer)
Types ¶
type AuthenticateClient ¶
type AuthenticateClient interface { // verifies the user creds and returns two signed jwt tokens: access (15 second ttl) and refresh token (7 day ttl) Login(ctx context.Context, in *LoginRequest, opts ...grpc.CallOption) (*TokenResponse, error) // blacklists the token provided in redis Logout(ctx context.Context, in *TokenRequest, opts ...grpc.CallOption) (*LogoutResponse, error) // will find all tokens belonging to the user embedded in the token and blacklist all tokens in redis associated LogoutEverywhere(ctx context.Context, in *TokenRequest, opts ...grpc.CallOption) (*LogoutResponse, error) // creates a new user in the database Register(ctx context.Context, in *RegisterRequest, opts ...grpc.CallOption) (*RegisterResponse, error) // takes the current token, validates it. If validated, blacklist the old access_token (if applicable) and refresh_token // and will generate new ones and return them to the user RefreshToken(ctx context.Context, in *TokenRequest, opts ...grpc.CallOption) (*TokenResponse, error) // takes the current token, validates the signature, and returns a boolean ValidateToken(ctx context.Context, in *TokenRequest, opts ...grpc.CallOption) (*ValidateTokenResponse, error) // marks the user for deletion. Cleanup jobs will run after like 30 days Delete(ctx context.Context, in *DeleteUserRequest, opts ...grpc.CallOption) (*DeleteUserResponse, error) }
AuthenticateClient is the client API for Authenticate 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 NewAuthenticateClient ¶
func NewAuthenticateClient(cc grpc.ClientConnInterface) AuthenticateClient
type AuthenticateServer ¶
type AuthenticateServer interface { // verifies the user creds and returns two signed jwt tokens: access (15 second ttl) and refresh token (7 day ttl) Login(context.Context, *LoginRequest) (*TokenResponse, error) // blacklists the token provided in redis Logout(context.Context, *TokenRequest) (*LogoutResponse, error) // will find all tokens belonging to the user embedded in the token and blacklist all tokens in redis associated LogoutEverywhere(context.Context, *TokenRequest) (*LogoutResponse, error) // creates a new user in the database Register(context.Context, *RegisterRequest) (*RegisterResponse, error) // takes the current token, validates it. If validated, blacklist the old access_token (if applicable) and refresh_token // and will generate new ones and return them to the user RefreshToken(context.Context, *TokenRequest) (*TokenResponse, error) // takes the current token, validates the signature, and returns a boolean ValidateToken(context.Context, *TokenRequest) (*ValidateTokenResponse, error) // marks the user for deletion. Cleanup jobs will run after like 30 days Delete(context.Context, *DeleteUserRequest) (*DeleteUserResponse, error) // contains filtered or unexported methods }
AuthenticateServer is the server API for Authenticate service. All implementations must embed UnimplementedAuthenticateServer for forward compatibility
type DeleteUserRequest ¶
type DeleteUserRequest struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // contains filtered or unexported fields }
func (*DeleteUserRequest) Descriptor
deprecated
func (*DeleteUserRequest) Descriptor() ([]byte, []int)
Deprecated: Use DeleteUserRequest.ProtoReflect.Descriptor instead.
func (*DeleteUserRequest) GetId ¶
func (x *DeleteUserRequest) GetId() string
func (*DeleteUserRequest) ProtoMessage ¶
func (*DeleteUserRequest) ProtoMessage()
func (*DeleteUserRequest) ProtoReflect ¶
func (x *DeleteUserRequest) ProtoReflect() protoreflect.Message
func (*DeleteUserRequest) Reset ¶
func (x *DeleteUserRequest) Reset()
func (*DeleteUserRequest) String ¶
func (x *DeleteUserRequest) String() string
type DeleteUserResponse ¶
type DeleteUserResponse struct { Deleted bool `protobuf:"varint,1,opt,name=deleted,proto3" json:"deleted,omitempty"` DeletedAt *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=deleted_at,json=deletedAt,proto3" json:"deleted_at,omitempty"` // contains filtered or unexported fields }
func (*DeleteUserResponse) Descriptor
deprecated
func (*DeleteUserResponse) Descriptor() ([]byte, []int)
Deprecated: Use DeleteUserResponse.ProtoReflect.Descriptor instead.
func (*DeleteUserResponse) GetDeleted ¶
func (x *DeleteUserResponse) GetDeleted() bool
func (*DeleteUserResponse) GetDeletedAt ¶
func (x *DeleteUserResponse) GetDeletedAt() *timestamppb.Timestamp
func (*DeleteUserResponse) ProtoMessage ¶
func (*DeleteUserResponse) ProtoMessage()
func (*DeleteUserResponse) ProtoReflect ¶
func (x *DeleteUserResponse) ProtoReflect() protoreflect.Message
func (*DeleteUserResponse) Reset ¶
func (x *DeleteUserResponse) Reset()
func (*DeleteUserResponse) String ¶
func (x *DeleteUserResponse) String() string
type LoginRequest ¶
type LoginRequest struct { Email string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"` // optional Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"` //optional Password string `protobuf:"bytes,3,opt,name=password,proto3" json:"password,omitempty"` // contains filtered or unexported fields }
LoginRequest will take in the username or email and validate in conjunction with the password. If somehow both email and username is provided the email will win.
func (*LoginRequest) Descriptor
deprecated
func (*LoginRequest) Descriptor() ([]byte, []int)
Deprecated: Use LoginRequest.ProtoReflect.Descriptor instead.
func (*LoginRequest) GetEmail ¶
func (x *LoginRequest) GetEmail() string
func (*LoginRequest) GetPassword ¶
func (x *LoginRequest) GetPassword() string
func (*LoginRequest) GetUsername ¶
func (x *LoginRequest) GetUsername() string
func (*LoginRequest) ProtoMessage ¶
func (*LoginRequest) ProtoMessage()
func (*LoginRequest) ProtoReflect ¶
func (x *LoginRequest) ProtoReflect() protoreflect.Message
func (*LoginRequest) Reset ¶
func (x *LoginRequest) Reset()
func (*LoginRequest) String ¶
func (x *LoginRequest) String() string
type LogoutResponse ¶
type LogoutResponse struct { Status bool `protobuf:"varint,1,opt,name=status,proto3" json:"status,omitempty"` // contains filtered or unexported fields }
func (*LogoutResponse) Descriptor
deprecated
func (*LogoutResponse) Descriptor() ([]byte, []int)
Deprecated: Use LogoutResponse.ProtoReflect.Descriptor instead.
func (*LogoutResponse) GetStatus ¶
func (x *LogoutResponse) GetStatus() bool
func (*LogoutResponse) ProtoMessage ¶
func (*LogoutResponse) ProtoMessage()
func (*LogoutResponse) ProtoReflect ¶
func (x *LogoutResponse) ProtoReflect() protoreflect.Message
func (*LogoutResponse) Reset ¶
func (x *LogoutResponse) Reset()
func (*LogoutResponse) String ¶
func (x *LogoutResponse) String() string
type RegisterRequest ¶
type RegisterRequest struct { User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` VerifyPassword string `protobuf:"bytes,3,opt,name=verify_password,json=verifyPassword,proto3" json:"verify_password,omitempty"` // contains filtered or unexported fields }
func (*RegisterRequest) Descriptor
deprecated
func (*RegisterRequest) Descriptor() ([]byte, []int)
Deprecated: Use RegisterRequest.ProtoReflect.Descriptor instead.
func (*RegisterRequest) GetPassword ¶
func (x *RegisterRequest) GetPassword() string
func (*RegisterRequest) GetUser ¶
func (x *RegisterRequest) GetUser() *User
func (*RegisterRequest) GetVerifyPassword ¶
func (x *RegisterRequest) GetVerifyPassword() string
func (*RegisterRequest) ProtoMessage ¶
func (*RegisterRequest) ProtoMessage()
func (*RegisterRequest) ProtoReflect ¶
func (x *RegisterRequest) ProtoReflect() protoreflect.Message
func (*RegisterRequest) Reset ¶
func (x *RegisterRequest) Reset()
func (*RegisterRequest) String ¶
func (x *RegisterRequest) String() string
type RegisterResponse ¶
type RegisterResponse struct { Status bool `protobuf:"varint,1,opt,name=status,proto3" json:"status,omitempty"` // contains filtered or unexported fields }
func (*RegisterResponse) Descriptor
deprecated
func (*RegisterResponse) Descriptor() ([]byte, []int)
Deprecated: Use RegisterResponse.ProtoReflect.Descriptor instead.
func (*RegisterResponse) GetStatus ¶
func (x *RegisterResponse) GetStatus() bool
func (*RegisterResponse) ProtoMessage ¶
func (*RegisterResponse) ProtoMessage()
func (*RegisterResponse) ProtoReflect ¶
func (x *RegisterResponse) ProtoReflect() protoreflect.Message
func (*RegisterResponse) Reset ¶
func (x *RegisterResponse) Reset()
func (*RegisterResponse) String ¶
func (x *RegisterResponse) String() string
type TokenRequest ¶
type TokenRequest struct { BearerToken string `protobuf:"bytes,1,opt,name=bearer_token,json=bearerToken,proto3" json:"bearer_token,omitempty"` BearerTokenUuid string `protobuf:"bytes,2,opt,name=bearer_token_uuid,json=bearerTokenUuid,proto3" json:"bearer_token_uuid,omitempty"` TokenType TokenType `protobuf:"varint,3,opt,name=token_type,json=tokenType,proto3,enum=TokenType" json:"token_type,omitempty"` // contains filtered or unexported fields }
A basic token request contains the token, the uuid for the specified token, and the token type. Passed to Logout, validate, and refresh functions
func (*TokenRequest) Descriptor
deprecated
func (*TokenRequest) Descriptor() ([]byte, []int)
Deprecated: Use TokenRequest.ProtoReflect.Descriptor instead.
func (*TokenRequest) GetBearerToken ¶
func (x *TokenRequest) GetBearerToken() string
func (*TokenRequest) GetBearerTokenUuid ¶
func (x *TokenRequest) GetBearerTokenUuid() string
func (*TokenRequest) GetTokenType ¶
func (x *TokenRequest) GetTokenType() TokenType
func (*TokenRequest) ProtoMessage ¶
func (*TokenRequest) ProtoMessage()
func (*TokenRequest) ProtoReflect ¶
func (x *TokenRequest) ProtoReflect() protoreflect.Message
func (*TokenRequest) Reset ¶
func (x *TokenRequest) Reset()
func (*TokenRequest) String ¶
func (x *TokenRequest) String() string
type TokenResponse ¶
type TokenResponse struct { AccessToken string `protobuf:"bytes,1,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"` RefreshToken string `protobuf:"bytes,2,opt,name=refresh_token,json=refreshToken,proto3" json:"refresh_token,omitempty"` // contains filtered or unexported fields }
TokenResponse returns the access token and the refresh token to the user. For use with any protected routes
func (*TokenResponse) Descriptor
deprecated
func (*TokenResponse) Descriptor() ([]byte, []int)
Deprecated: Use TokenResponse.ProtoReflect.Descriptor instead.
func (*TokenResponse) GetAccessToken ¶
func (x *TokenResponse) GetAccessToken() string
func (*TokenResponse) GetRefreshToken ¶
func (x *TokenResponse) GetRefreshToken() string
func (*TokenResponse) ProtoMessage ¶
func (*TokenResponse) ProtoMessage()
func (*TokenResponse) ProtoReflect ¶
func (x *TokenResponse) ProtoReflect() protoreflect.Message
func (*TokenResponse) Reset ¶
func (x *TokenResponse) Reset()
func (*TokenResponse) String ¶
func (x *TokenResponse) String() string
type TokenType ¶
type TokenType int32
func (TokenType) Descriptor ¶
func (TokenType) Descriptor() protoreflect.EnumDescriptor
func (TokenType) EnumDescriptor
deprecated
func (TokenType) Number ¶
func (x TokenType) Number() protoreflect.EnumNumber
func (TokenType) Type ¶
func (TokenType) Type() protoreflect.EnumType
type UnimplementedAuthenticateServer ¶
type UnimplementedAuthenticateServer struct { }
UnimplementedAuthenticateServer must be embedded to have forward compatible implementations.
func (UnimplementedAuthenticateServer) Delete ¶
func (UnimplementedAuthenticateServer) Delete(context.Context, *DeleteUserRequest) (*DeleteUserResponse, error)
func (UnimplementedAuthenticateServer) Login ¶
func (UnimplementedAuthenticateServer) Login(context.Context, *LoginRequest) (*TokenResponse, error)
func (UnimplementedAuthenticateServer) Logout ¶
func (UnimplementedAuthenticateServer) Logout(context.Context, *TokenRequest) (*LogoutResponse, error)
func (UnimplementedAuthenticateServer) LogoutEverywhere ¶
func (UnimplementedAuthenticateServer) LogoutEverywhere(context.Context, *TokenRequest) (*LogoutResponse, error)
func (UnimplementedAuthenticateServer) RefreshToken ¶
func (UnimplementedAuthenticateServer) RefreshToken(context.Context, *TokenRequest) (*TokenResponse, error)
func (UnimplementedAuthenticateServer) Register ¶
func (UnimplementedAuthenticateServer) Register(context.Context, *RegisterRequest) (*RegisterResponse, error)
func (UnimplementedAuthenticateServer) ValidateToken ¶
func (UnimplementedAuthenticateServer) ValidateToken(context.Context, *TokenRequest) (*ValidateTokenResponse, error)
type UnsafeAuthenticateServer ¶
type UnsafeAuthenticateServer interface {
// contains filtered or unexported methods
}
UnsafeAuthenticateServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to AuthenticateServer will result in compilation errors.
type User ¶
type User struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Email string `protobuf:"bytes,2,opt,name=email,proto3" json:"email,omitempty"` Username string `protobuf:"bytes,3,opt,name=username,proto3" json:"username,omitempty"` GivenName string `protobuf:"bytes,4,opt,name=given_name,json=givenName,proto3" json:"given_name,omitempty"` FamilyName string `protobuf:"bytes,5,opt,name=family_name,json=familyName,proto3" json:"family_name,omitempty"` // contains filtered or unexported fields }
User is a basic representation of the user stored in the database
func (*User) Descriptor
deprecated
func (*User) GetFamilyName ¶
func (*User) GetGivenName ¶
func (*User) GetUsername ¶
func (*User) ProtoMessage ¶
func (*User) ProtoMessage()
func (*User) ProtoReflect ¶
func (x *User) ProtoReflect() protoreflect.Message
type ValidateTokenResponse ¶
type ValidateTokenResponse struct { Validated bool `protobuf:"varint,1,opt,name=validated,proto3" json:"validated,omitempty"` // contains filtered or unexported fields }
func (*ValidateTokenResponse) Descriptor
deprecated
func (*ValidateTokenResponse) Descriptor() ([]byte, []int)
Deprecated: Use ValidateTokenResponse.ProtoReflect.Descriptor instead.
func (*ValidateTokenResponse) GetValidated ¶
func (x *ValidateTokenResponse) GetValidated() bool
func (*ValidateTokenResponse) ProtoMessage ¶
func (*ValidateTokenResponse) ProtoMessage()
func (*ValidateTokenResponse) ProtoReflect ¶
func (x *ValidateTokenResponse) ProtoReflect() protoreflect.Message
func (*ValidateTokenResponse) Reset ¶
func (x *ValidateTokenResponse) Reset()
func (*ValidateTokenResponse) String ¶
func (x *ValidateTokenResponse) String() string