authentication

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	Oauth2 *oauth2.Providers
	// contains filtered or unexported fields
}

func New

func New(p sdkParams) *Handler

func (*Handler) Build

func (h *Handler) Build(opts ...connect.HandlerOption) (string, http.Handler)

func (*Handler) Delete

func (h *Handler) Delete(ctx context.Context, req *connect.Request[authentication.DeleteRequest]) (*connect.Response[authentication.DeleteResponse], error)

Delete removes a user from the namespace.

func (*Handler) Get

func (h *Handler) Get(ctx context.Context, req *connect.Request[authentication.GetRequest]) (*connect.Response[authentication.GetResponse], error)

Get fetches a user from the namespace using its id in the access token.

func (*Handler) GetAuthConfig

func (h *Handler) GetAuthConfig(ctx context.Context, req *connect.Request[authentication.GetAuthConfigRequest]) (resp *connect.Response[authentication.GetAuthConfigResponse], err error)

GetAuthConfig this returns a config for a specific namespace together with urls to all OIDC providers.

func (*Handler) Login

func (h *Handler) Login(ctx context.Context, req *connect.Request[authentication.LoginRequest]) (*connect.Response[authentication.LoginResponse], error)

Login validates a user credentials and issues a access/refresh token pair used to validate requests.

func (*Handler) Logout

func (h *Handler) Logout(ctx context.Context, req *connect.Request[authentication.LogoutRequest]) (*connect.Response[authentication.LogoutResponse], error)

Logout validates the access token and blocks it in the database for future attempts.

func (*Handler) RefreshToken

func (h *Handler) RefreshToken(ctx context.Context, req *connect.Request[authentication.RefreshTokenRequest]) (*connect.Response[authentication.RefreshTokenResponse], error)

RefreshToken issues a new access/refresh token pair from the refresh token.

func (*Handler) Register

func (h *Handler) Register(ctx context.Context, req *connect.Request[authentication.RegisterRequest]) (*connect.Response[authentication.RegisterResponse], error)

Register inserts new user in the namespace.

func (*Handler) ResetPassword

func (h *Handler) ResetPassword(ctx context.Context, req *connect.Request[authentication.ResetPasswordRequest]) (*connect.Response[authentication.ResetPasswordResponse], error)

ResetPassword updates the users password if the provided code can be validated by the hash.

func (*Handler) SendPasswordReset

func (h *Handler) SendPasswordReset(ctx context.Context, req *connect.Request[authentication.SendPasswordResetRequest]) (*connect.Response[authentication.SendPasswordResetResponse], error)

SendResetPasswordEmail sends an email to the user with a code used to reset his/her password.

func (*Handler) ServiceName

func (h *Handler) ServiceName() string

func (*Handler) VerifyEmail

func (h *Handler) VerifyEmail(ctx context.Context, req *connect.Request[authentication.VerifyEmailRequest]) (*connect.Response[authentication.VerifyEmailResponse], error)

func (*Handler) VerifyPhoneNumber

func (h *Handler) VerifyPhoneNumber(ctx context.Context, req *connect.Request[authentication.VerifyPhoneNumberRequest]) (*connect.Response[authentication.VerifyPhoneNumberResponse], error)

Jump to

Keyboard shortcuts

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