Documentation
¶
Index ¶
- type AuthHandler
- func (h *AuthHandler) InitiateSocialLogin(c *gin.Context)
- func (h *AuthHandler) Login(c *gin.Context)
- func (h *AuthHandler) Logout(c *gin.Context)
- func (h *AuthHandler) RefreshToken(c *gin.Context)
- func (h *AuthHandler) RegisterRoutes(router *gin.RouterGroup, socialSignupHandler gin.HandlerFunc)
- func (h *AuthHandler) RegisterSocialSignupRoutes(router *gin.RouterGroup, handler gin.HandlerFunc)
- func (h *AuthHandler) SocialSignInOrSignUp(c *gin.Context)
- func (h *AuthHandler) SocialSignup(next gin.HandlerFunc) gin.HandlerFunc
- type AuthorizationHandler
- func (h *AuthorizationHandler) AssignRole(c *gin.Context)
- func (h *AuthorizationHandler) CheckPermission(c *gin.Context)
- func (h *AuthorizationHandler) CreateResource(c *gin.Context)
- func (h *AuthorizationHandler) CreateRole(c *gin.Context)
- func (h *AuthorizationHandler) DeleteResource(c *gin.Context)
- func (h *AuthorizationHandler) DeleteRole(c *gin.Context)
- func (h *AuthorizationHandler) GetResource(c *gin.Context)
- func (h *AuthorizationHandler) GetRole(c *gin.Context)
- func (h *AuthorizationHandler) GetRolePermissions(c *gin.Context)
- func (h *AuthorizationHandler) GetUserRoles(c *gin.Context)
- func (h *AuthorizationHandler) GrantPermission(c *gin.Context)
- func (h *AuthorizationHandler) ListAllPolicies(c *gin.Context)
- func (h *AuthorizationHandler) ListResources(c *gin.Context)
- func (h *AuthorizationHandler) ListRoles(c *gin.Context)
- func (h *AuthorizationHandler) RegisterRoutes(router *gin.RouterGroup)
- func (h *AuthorizationHandler) RevokePermission(c *gin.Context)
- func (h *AuthorizationHandler) UnassignRole(c *gin.Context)
- func (h *AuthorizationHandler) UpdateResource(c *gin.Context)
- func (h *AuthorizationHandler) UpdateRole(c *gin.Context)
- type PasswordHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthHandler ¶
type AuthHandler struct {
// contains filtered or unexported fields
}
AuthHandler handles authentication-related HTTP requests
func NewAuthHandler ¶
func NewAuthHandler( authManager backends.AuthenticationManager, tokenIssuer interfaces.TokenIssuer, googleSignin interfaces.GoogleSignin, config *config.Config, ) *AuthHandler
NewAuthHandler creates a new authentication handler
func (*AuthHandler) InitiateSocialLogin ¶
func (h *AuthHandler) InitiateSocialLogin(c *gin.Context)
@ID initiate-social-login @Summary Initiate Social Login @Description Initiates a social login process @Tags auth, default @Accept json @Produce json @Param request body map[string]any true "Initiate social login request" @Success 202 {object} authresponses.TokenResponse @Failure 401 {object} handlers.ApiError @Failure 400 {object} handlers.ApiError @Failure 500 {object} handlers.ApiError @Router /auth/providers/:provider/initiate [post]
func (*AuthHandler) Login ¶
func (h *AuthHandler) Login(c *gin.Context)
@ID login @Summary Login @Description Logs in a user @Tags auth, default @Accept json @Produce json @Param request body map[string]any true "Login request" @Success 202 {object} authresponses.TokenResponse @Failure 401 {object} handlers.ApiError @Failure 400 {object} handlers.ApiError @Failure 500 {object} handlers.ApiError @Router /auth/login [post]
func (*AuthHandler) Logout ¶
func (h *AuthHandler) Logout(c *gin.Context)
@ID logout @Summary Logout @Description Logs out a user @Tags auth, default @Accept json @Produce json @Success 200 {object} responses.ApiResponsePayload @Failure 401 {object} handlers.ApiError @Failure 400 {object} handlers.ApiError @Failure 500 {object} handlers.ApiError @Security BearerAuth @Router /auth/logout [post]
func (*AuthHandler) RefreshToken ¶
func (h *AuthHandler) RefreshToken(c *gin.Context)
@ID refresh-token @Summary Refresh Token @Description Refreshes a user's token @Tags auth, default @Accept json @Produce json @Param request body requests.RefreshTokenPayload true "Refresh token request" @Success 202 {object} authresponses.TokenResponse @Failure 401 {object} handlers.ApiError @Failure 400 {object} handlers.ApiError @Failure 500 {object} handlers.ApiError @Router /auth/refresh [post]
func (*AuthHandler) RegisterRoutes ¶
func (h *AuthHandler) RegisterRoutes(router *gin.RouterGroup, socialSignupHandler gin.HandlerFunc)
RegisterRoutes registers the authentication routes
func (*AuthHandler) RegisterSocialSignupRoutes ¶
func (h *AuthHandler) RegisterSocialSignupRoutes(router *gin.RouterGroup, handler gin.HandlerFunc)
func (*AuthHandler) SocialSignInOrSignUp ¶
func (h *AuthHandler) SocialSignInOrSignUp(c *gin.Context)
@ID socialSigninOrSignup @Summary Via an oauth provider login or create an account for a user @Description This would either log a user in or create an account for a user using the provided provider's creds. @Tags auth, default @Accept json @Produce json @Param request body map[string]any true "Login request" @Success 202 {object} authresponses.TokenResponse @Failure 401 {object} handlers.ApiError @Failure 400 {object} handlers.ApiError @Failure 500 {object} handlers.ApiError @Router /auth/providers/:provider/login [post]
func (*AuthHandler) SocialSignup ¶
func (h *AuthHandler) SocialSignup(next gin.HandlerFunc) gin.HandlerFunc
@ID socialSignup @Summary Signup using an oauth provider e.g Google @Description Create an account via an oauth provider @Tags auth, default @Accept json @Produce json @Param request body map[string]any true "Login request" @Success 202 {object} authresponses.TokenResponse @Failure 401 {object} handlers.ApiError @Failure 400 {object} handlers.ApiError @Failure 500 {object} handlers.ApiError @Router /auth/providers/:provider/signup [post]
type AuthorizationHandler ¶
type AuthorizationHandler struct {
// contains filtered or unexported fields
}
AuthorizationHandler exposes generic role/permission management over HTTP, riding entirely on AuthorizationManager's casbin-backed methods. Only registered when config.AuthorizationConfig.ExposeManagementAPI is true (see module.go's Initialize) — this is a privileged CRUD surface, not on by default.
func NewAuthorizationHandler ¶
func NewAuthorizationHandler(authMgr *authorization.AuthorizationManager, authMiddleware interfaces.AuthMiddleware) *AuthorizationHandler
NewAuthorizationHandler creates a new authorization management handler.
func (*AuthorizationHandler) AssignRole ¶
func (h *AuthorizationHandler) AssignRole(c *gin.Context)
func (*AuthorizationHandler) CheckPermission ¶
func (h *AuthorizationHandler) CheckPermission(c *gin.Context)
func (*AuthorizationHandler) CreateResource ¶
func (h *AuthorizationHandler) CreateResource(c *gin.Context)
func (*AuthorizationHandler) CreateRole ¶
func (h *AuthorizationHandler) CreateRole(c *gin.Context)
func (*AuthorizationHandler) DeleteResource ¶
func (h *AuthorizationHandler) DeleteResource(c *gin.Context)
func (*AuthorizationHandler) DeleteRole ¶
func (h *AuthorizationHandler) DeleteRole(c *gin.Context)
func (*AuthorizationHandler) GetResource ¶
func (h *AuthorizationHandler) GetResource(c *gin.Context)
func (*AuthorizationHandler) GetRole ¶
func (h *AuthorizationHandler) GetRole(c *gin.Context)
func (*AuthorizationHandler) GetRolePermissions ¶
func (h *AuthorizationHandler) GetRolePermissions(c *gin.Context)
func (*AuthorizationHandler) GetUserRoles ¶
func (h *AuthorizationHandler) GetUserRoles(c *gin.Context)
func (*AuthorizationHandler) GrantPermission ¶
func (h *AuthorizationHandler) GrantPermission(c *gin.Context)
func (*AuthorizationHandler) ListAllPolicies ¶
func (h *AuthorizationHandler) ListAllPolicies(c *gin.Context)
func (*AuthorizationHandler) ListResources ¶
func (h *AuthorizationHandler) ListResources(c *gin.Context)
func (*AuthorizationHandler) ListRoles ¶
func (h *AuthorizationHandler) ListRoles(c *gin.Context)
func (*AuthorizationHandler) RegisterRoutes ¶
func (h *AuthorizationHandler) RegisterRoutes(router *gin.RouterGroup)
RegisterRoutes registers the role/permission management routes. Every route is gated by requireManagePermission — see its doc comment for how the bootstrap chicken-and-egg (who can call this before any permission exists) is resolved.
func (*AuthorizationHandler) RevokePermission ¶
func (h *AuthorizationHandler) RevokePermission(c *gin.Context)
func (*AuthorizationHandler) UnassignRole ¶
func (h *AuthorizationHandler) UnassignRole(c *gin.Context)
func (*AuthorizationHandler) UpdateResource ¶
func (h *AuthorizationHandler) UpdateResource(c *gin.Context)
func (*AuthorizationHandler) UpdateRole ¶
func (h *AuthorizationHandler) UpdateRole(c *gin.Context)
type PasswordHandler ¶
type PasswordHandler struct {
// contains filtered or unexported fields
}
PasswordHandler handles password-related HTTP requests
func NewPasswordHandler ¶
func NewPasswordHandler( passwordManager password.Manager, authMiddleware interfaces.AuthMiddleware, config *config.Config, ) *PasswordHandler
NewPasswordHandler creates a new password handler
func (*PasswordHandler) ChangePassword ¶
func (h *PasswordHandler) ChangePassword(c *gin.Context)
@ID change-password @Summary Change Password @Description Changes a user's password @Tags auth, default @Accept json @Produce json @Param request body requests.PasswordChangePayload true "Password change request" @Success 202 {object} responses.ApiResponsePayload @Failure 401 {object} handlers.ApiError @Failure 400 {object} handlers.ApiError @Failure 500 {object} handlers.ApiError @Security BearerAuth @Router /auth/password/change [post]
func (*PasswordHandler) RegisterRoutes ¶
func (h *PasswordHandler) RegisterRoutes(router *gin.RouterGroup)
RegisterRoutes registers the password handler routes
func (*PasswordHandler) RequestPasswordReset ¶
func (h *PasswordHandler) RequestPasswordReset(c *gin.Context)
@ID request-password-reset @Summary Request Password Reset @Description Requests a password reset @Tags auth, default @Accept json @Produce json @Param request body requests.PasswordResetPayload true "Password reset request" @Success 202 {object} responses.ApiResponsePayload @Failure 400 {object} handlers.ApiError @Failure 500 {object} handlers.ApiError @Router /auth/password/reset-request [post]
func (*PasswordHandler) VerifyPasswordReset ¶
func (h *PasswordHandler) VerifyPasswordReset(c *gin.Context)
@ID verify-password-reset @Summary Verify Password Reset @Description Verifies a password reset @Tags auth, default @Accept json @Produce json @Param request body requests.PasswordResetVerifyPayload true "Password reset verify request" @Success 202 {object} responses.ApiResponsePayload @Failure 400 {object} handlers.ApiError @Failure 500 {object} handlers.ApiError @Router /auth/password/reset-verify [post]