Documentation
¶
Index ¶
- func AuthenticateRequestThenLoadAuthContext(app core.App) gin.HandlerFunc
- func AuthorizeRequest(app core.App) gin.HandlerFunc
- func BindAccountApi(app core.App, rg *gin.RouterGroup)
- func BindAuthApi(app core.App, rg *gin.RouterGroup, addResetPasswordEndpoint bool)
- func BindFilesApi(app core.App, r *gin.RouterGroup)
- func BindHealthApi(rg *gin.RouterGroup)
- func Cors(allowedOrigins string, router *gin.Engine)
- func Endpoints(app core.App, endpoints config.Endpoints)
- func HandleError(c *gin.Context, err error)
- func NewBadRequestError(c *gin.Context, message string, errors any)
- func NewFilesApi(app core.App) *filesApi
- func NewForbiddenError(c *gin.Context)
- func NewInternalServerError(c *gin.Context)
- func NewNotFoundError(c *gin.Context)
- func NewUnauthorizedError(c *gin.Context)
- func RequestLogger(app core.App) gin.HandlerFunc
- func Serve(app core.App, config config.ServeConfig) error
- func TenantMiddleware(app core.App) gin.HandlerFunc
- type ApiError
- type AuthApi
- func (api *AuthApi) AuthResponseWithUserInfoMap(c *gin.Context, identity string, userInfo map[string]any)
- func (api *AuthApi) AuthResponseWithUserType(c *gin.Context, user entities.User)
- func (api *AuthApi) ChangePassword(c *gin.Context)
- func (api AuthApi) GetTokenAndRefreshToken(id uuid.UUID, identity string, role types.Role) (string, string, error)
- func (api *AuthApi) InitiateResetPassword(c *gin.Context)
- func (api *AuthApi) Login(c *gin.Context)
- func (api *AuthApi) RefreshToken(c *gin.Context)
- func (a *AuthApi) ResetPassword(c *gin.Context)
- func (api *AuthApi) ValidateResetPassword(c *gin.Context)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthenticateRequestThenLoadAuthContext ¶
func AuthenticateRequestThenLoadAuthContext(app core.App) gin.HandlerFunc
func AuthorizeRequest ¶
func AuthorizeRequest(app core.App) gin.HandlerFunc
func BindAccountApi ¶
func BindAccountApi(app core.App, rg *gin.RouterGroup)
func BindAuthApi ¶
func BindAuthApi(app core.App, rg *gin.RouterGroup, addResetPasswordEndpoint bool)
func BindFilesApi ¶
func BindFilesApi(app core.App, r *gin.RouterGroup)
func BindHealthApi ¶
func BindHealthApi(rg *gin.RouterGroup)
func HandleError ¶
func NewFilesApi ¶
func NewForbiddenError ¶
func NewInternalServerError ¶
func NewNotFoundError ¶
func NewUnauthorizedError ¶
func RequestLogger ¶
func RequestLogger(app core.App) gin.HandlerFunc
func TenantMiddleware ¶
func TenantMiddleware(app core.App) gin.HandlerFunc
Types ¶
type ApiError ¶
type AuthApi ¶
type AuthApi struct {
// contains filtered or unexported fields
}
func NewAuthApi ¶
func (*AuthApi) AuthResponseWithUserInfoMap ¶
func (api *AuthApi) AuthResponseWithUserInfoMap(c *gin.Context, identity string, userInfo map[string]any)
Todo: look for better way to represent user information
func (*AuthApi) AuthResponseWithUserType ¶
func (*AuthApi) ChangePassword ¶
ChangePassword godoc @Summary change user's password @Description allow a user to change its password. @Tags auth @Accept json @Produce json @Param request body requests.PasswordChangeRequest true "Password Change request" @Security BearerAuth @Success 200 {object} responses.ApiResponse @Failure 401 {object} apis.ApiError @Failure 500 {object} apis.ApiError @Router /change-password [put]
func (AuthApi) GetTokenAndRefreshToken ¶
func (*AuthApi) InitiateResetPassword ¶
InitiateResetPassword godoc @Summary initiate password reset process for user @Description start the process of resetting user's password @Tags auth @Accept json @Produce json @Param request body requests.ResetPasswordRequest true "Reset password request" @Security BearerAuth @Success 200 {object} responses.ApiResponse @Failure 401 {object} apis.ApiError @Failure 500 {object} apis.ApiError @Router /reset-password [put]
func (*AuthApi) Login ¶
Login godoc @Summary Login a user @Description authenticate a user returning auth token, refresh token and user information @Tags auth @Accept json @Param request body requests.LoginRequest true "Login request" @Produce json @Success 200 {object} responses.AuthResponse @Failure 500 {object} apis.ApiError @Router /Login [post]
func (*AuthApi) RefreshToken ¶
RefreshToken godoc @Summary refresh an auth token @Description get a new auth token with the refresh token for user @Tags auth @Accept json @Produce json @Param request body requests.RefreshTokenRequest true "Refresh token request" @Security BearerAuth @Success 200 {object} responses.AuthResponse @Failure 401 {object} apis.ApiError @Failure 500 {object} apis.ApiError @Router /refresh-token [put]