authenticationconnect

package
v0.0.0-...-4cd4102 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// ServiceLoginProcedure is the fully-qualified name of the Service's Login RPC.
	ServiceLoginProcedure = "/api.v1.authentication.Service/Login"
	// ServiceLogoutProcedure is the fully-qualified name of the Service's Logout RPC.
	ServiceLogoutProcedure = "/api.v1.authentication.Service/Logout"
	// ServiceGetProcedure is the fully-qualified name of the Service's Get RPC.
	ServiceGetProcedure = "/api.v1.authentication.Service/Get"
	// ServiceRegisterProcedure is the fully-qualified name of the Service's Register RPC.
	ServiceRegisterProcedure = "/api.v1.authentication.Service/Register"
	// ServiceSendPasswordResetProcedure is the fully-qualified name of the Service's SendPasswordReset
	// RPC.
	ServiceSendPasswordResetProcedure = "/api.v1.authentication.Service/SendPasswordReset"
	// ServiceResetPasswordProcedure is the fully-qualified name of the Service's ResetPassword RPC.
	ServiceResetPasswordProcedure = "/api.v1.authentication.Service/ResetPassword"
	// ServiceDeleteProcedure is the fully-qualified name of the Service's Delete RPC.
	ServiceDeleteProcedure = "/api.v1.authentication.Service/Delete"
	// ServiceRefreshTokenProcedure is the fully-qualified name of the Service's RefreshToken RPC.
	ServiceRefreshTokenProcedure = "/api.v1.authentication.Service/RefreshToken"
	// ServiceGetAuthConfigProcedure is the fully-qualified name of the Service's GetAuthConfig RPC.
	ServiceGetAuthConfigProcedure = "/api.v1.authentication.Service/GetAuthConfig"
	// ServiceVerifyEmailProcedure is the fully-qualified name of the Service's VerifyEmail RPC.
	ServiceVerifyEmailProcedure = "/api.v1.authentication.Service/VerifyEmail"
	// ServiceVerifyPhoneNumberProcedure is the fully-qualified name of the Service's VerifyPhoneNumber
	// RPC.
	ServiceVerifyPhoneNumberProcedure = "/api.v1.authentication.Service/VerifyPhoneNumber"
	// ServiceSendVerificationEmailProcedure is the fully-qualified name of the Service's
	// SendVerificationEmail RPC.
	ServiceSendVerificationEmailProcedure = "/api.v1.authentication.Service/SendVerificationEmail"
)

These constants are the fully-qualified names of the RPCs defined in this package. They're exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route.

Note that these are different from the fully-qualified method names used by google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to reflection-formatted method names, remove the leading slash and convert the remaining slash to a period.

View Source
const (
	// ServiceName is the fully-qualified name of the Service service.
	ServiceName = "api.v1.authentication.Service"
)

Variables

This section is empty.

Functions

func NewServiceHandler

func NewServiceHandler(svc ServiceHandler, opts ...connect.HandlerOption) (string, http.Handler)

NewServiceHandler builds an HTTP handler from the service implementation. It returns the path on which to mount the handler and the handler itself.

By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf and JSON codecs. They also support gzip compression.

Types

type ServiceClient

type ServiceClient interface {
	// Login authenticats a user and returns a access/refresh token
	Login(context.Context, *connect.Request[authentication.LoginRequest]) (*connect.Response[authentication.LoginResponse], error)
	// Logout validates the access token and blocks it afterwards
	Logout(context.Context, *connect.Request[authentication.LogoutRequest]) (*connect.Response[authentication.LogoutResponse], error)
	// Get the logged in user
	Get(context.Context, *connect.Request[authentication.GetRequest]) (*connect.Response[authentication.GetResponse], error)
	// Register creates a new user
	Register(context.Context, *connect.Request[authentication.RegisterRequest]) (*connect.Response[authentication.RegisterResponse], error)
	// Send reset password email to the user
	SendPasswordReset(context.Context, *connect.Request[authentication.SendPasswordResetRequest]) (*connect.Response[authentication.SendPasswordResetResponse], error)
	// Reset password of the user
	ResetPassword(context.Context, *connect.Request[authentication.ResetPasswordRequest]) (*connect.Response[authentication.ResetPasswordResponse], error)
	// Delete logged in user
	Delete(context.Context, *connect.Request[authentication.DeleteRequest]) (*connect.Response[authentication.DeleteResponse], error)
	// Refresh logged in token pair
	RefreshToken(context.Context, *connect.Request[authentication.RefreshTokenRequest]) (*connect.Response[authentication.RefreshTokenResponse], error)
	// Get auth config for how available login methods
	GetAuthConfig(context.Context, *connect.Request[authentication.GetAuthConfigRequest]) (*connect.Response[authentication.GetAuthConfigResponse], error)
	// Verify email
	VerifyEmail(context.Context, *connect.Request[authentication.VerifyEmailRequest]) (*connect.Response[authentication.VerifyEmailResponse], error)
	// Verify phone number
	VerifyPhoneNumber(context.Context, *connect.Request[authentication.VerifyPhoneNumberRequest]) (*connect.Response[authentication.VerifyPhoneNumberResponse], error)
	SendVerificationEmail(context.Context, *connect.Request[authentication.SendVerificationEmailRequest]) (*connect.Response[authentication.SendVerificationEmailResponse], error)
}

ServiceClient is a client for the api.v1.authentication.Service service.

func NewServiceClient

func NewServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) ServiceClient

NewServiceClient constructs a client for the api.v1.authentication.Service service. By default, it uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or connect.WithGRPCWeb() options.

The URL supplied here should be the base URL for the Connect or gRPC server (for example, http://api.acme.com or https://acme.com/grpc).

type ServiceHandler

type ServiceHandler interface {
	// Login authenticats a user and returns a access/refresh token
	Login(context.Context, *connect.Request[authentication.LoginRequest]) (*connect.Response[authentication.LoginResponse], error)
	// Logout validates the access token and blocks it afterwards
	Logout(context.Context, *connect.Request[authentication.LogoutRequest]) (*connect.Response[authentication.LogoutResponse], error)
	// Get the logged in user
	Get(context.Context, *connect.Request[authentication.GetRequest]) (*connect.Response[authentication.GetResponse], error)
	// Register creates a new user
	Register(context.Context, *connect.Request[authentication.RegisterRequest]) (*connect.Response[authentication.RegisterResponse], error)
	// Send reset password email to the user
	SendPasswordReset(context.Context, *connect.Request[authentication.SendPasswordResetRequest]) (*connect.Response[authentication.SendPasswordResetResponse], error)
	// Reset password of the user
	ResetPassword(context.Context, *connect.Request[authentication.ResetPasswordRequest]) (*connect.Response[authentication.ResetPasswordResponse], error)
	// Delete logged in user
	Delete(context.Context, *connect.Request[authentication.DeleteRequest]) (*connect.Response[authentication.DeleteResponse], error)
	// Refresh logged in token pair
	RefreshToken(context.Context, *connect.Request[authentication.RefreshTokenRequest]) (*connect.Response[authentication.RefreshTokenResponse], error)
	// Get auth config for how available login methods
	GetAuthConfig(context.Context, *connect.Request[authentication.GetAuthConfigRequest]) (*connect.Response[authentication.GetAuthConfigResponse], error)
	// Verify email
	VerifyEmail(context.Context, *connect.Request[authentication.VerifyEmailRequest]) (*connect.Response[authentication.VerifyEmailResponse], error)
	// Verify phone number
	VerifyPhoneNumber(context.Context, *connect.Request[authentication.VerifyPhoneNumberRequest]) (*connect.Response[authentication.VerifyPhoneNumberResponse], error)
	SendVerificationEmail(context.Context, *connect.Request[authentication.SendVerificationEmailRequest]) (*connect.Response[authentication.SendVerificationEmailResponse], error)
}

ServiceHandler is an implementation of the api.v1.authentication.Service service.

type UnimplementedServiceHandler

type UnimplementedServiceHandler struct{}

UnimplementedServiceHandler returns CodeUnimplemented from all methods.

Jump to

Keyboard shortcuts

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