user

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2021 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// APIKeyHeader represents the header used to provide an API key.
	APIKeyHeader = "X-API-KEY"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Handlers

type Handlers struct {
	// contains filtered or unexported fields
}

Handlers represents a group of http handlers in charge of handling users operations.

func NewHandlers

func NewHandlers(ctx context.Context, userManager hub.UserManager, cfg *viper.Viper) (*Handlers, error)

NewHandlers creates a new Handlers instance.

func (*Handlers) BasicAuth

func (h *Handlers) BasicAuth(next http.Handler) http.Handler

BasicAuth is a middleware that provides basic auth support.

func (*Handlers) CheckAvailability

func (h *Handlers) CheckAvailability(w http.ResponseWriter, r *http.Request)

CheckAvailability is an http handler that checks the availability of a given value for the provided resource kind.

func (*Handlers) GetProfile

func (h *Handlers) GetProfile(w http.ResponseWriter, r *http.Request)

GetProfile is an http handler used to get a logged in user profile.

func (*Handlers) InjectUserID

func (h *Handlers) InjectUserID(next http.Handler) http.Handler

InjectUserID is a middleware that injects the id of the user doing the request into the request context when a valid session id is provided.

func (*Handlers) Login

func (h *Handlers) Login(w http.ResponseWriter, r *http.Request)

Login is an http handler used to log a user in.

func (*Handlers) Logout

func (h *Handlers) Logout(w http.ResponseWriter, r *http.Request)

Logout is an http handler used to log a user out.

func (*Handlers) OauthCallback

func (h *Handlers) OauthCallback(w http.ResponseWriter, r *http.Request)

OauthCallback is an http handler in charge of completing the oauth authentication process, registering the user if needed.

func (*Handlers) OauthRedirect

func (h *Handlers) OauthRedirect(w http.ResponseWriter, r *http.Request)

OauthRedirect is an http handler that redirects the user to the oauth provider to proceed with the authorization.

func (*Handlers) RegisterPasswordResetCode added in v0.16.0

func (h *Handlers) RegisterPasswordResetCode(w http.ResponseWriter, r *http.Request)

RegisterPasswordResetCode is an http handler used to register a code to reset the password. The code will be emailed to the address provided.

func (*Handlers) RegisterUser

func (h *Handlers) RegisterUser(w http.ResponseWriter, r *http.Request)

RegisterUser is an http handler used to register a user in the hub database.

func (*Handlers) RequireLogin

func (h *Handlers) RequireLogin(next http.Handler) http.Handler

RequireLogin is a middleware that verifies if a user is logged in.

func (*Handlers) ResetPassword added in v0.16.0

func (h *Handlers) ResetPassword(w http.ResponseWriter, r *http.Request)

ResetPassword is an http handler used to reset the user's password.

func (*Handlers) UpdatePassword

func (h *Handlers) UpdatePassword(w http.ResponseWriter, r *http.Request)

UpdatePassword is an http handler used to update the password in the hub database.

func (*Handlers) UpdateProfile

func (h *Handlers) UpdateProfile(w http.ResponseWriter, r *http.Request)

UpdateProfile is an http handler used to update the user in the hub database.

func (*Handlers) VerifyEmail

func (h *Handlers) VerifyEmail(w http.ResponseWriter, r *http.Request)

VerifyEmail is an http handler used to verify a user's email address.

func (*Handlers) VerifyPasswordResetCode added in v0.16.0

func (h *Handlers) VerifyPasswordResetCode(w http.ResponseWriter, r *http.Request)

VerifyPasswordResetCode is an http handler used to verify a reset password code.

type OauthState

type OauthState struct {
	Random      string
	RedirectURL string
}

OauthState represents the state of an oauth authorization session, used to increase the security of the process and to restore the state of the application.

func NewOauthState

func NewOauthState(s string) (*OauthState, error)

NewOauthState creates a new OauthState instance from the string representation provided.

func (*OauthState) String

func (s *OauthState) String() string

String returns an OauthState instance as a string.

Jump to

Keyboard shortcuts

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