handlers

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdminHandlers added in v0.0.3

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

AdminHandlers provides pre-built HTTP handlers for admin operations

func NewAdminHandlers added in v0.0.3

func NewAdminHandlers(service *auth.Service, store store.Store, cfg *AdminHandlersConfig) *AdminHandlers

NewAdminHandlers creates a new AdminHandlers instance

func (*AdminHandlers) RegisterRoutes added in v0.0.3

func (h *AdminHandlers) RegisterRoutes(mux *http.ServeMux)

RegisterRoutes registers all admin routes on the provided mux

type AdminHandlersConfig added in v0.0.3

type AdminHandlersConfig struct {
	// AdminRole is the role name required to access admin endpoints (default: "admin")
	AdminRole string
	// RouteConfig is the admin route configuration
	RouteConfig *config.AdminRouteConfig
}

AdminHandlersConfig holds configuration for admin handlers

type AssignRoleRequest added in v0.0.3

type AssignRoleRequest struct {
	RoleID   string `json:"role_id"`
	RoleName string `json:"role_name"`
}

AssignRoleRequest represents a request to assign a role to a user

type CreatePermissionRequest added in v0.0.3

type CreatePermissionRequest struct {
	Name        string `json:"name"`
	Resource    string `json:"resource"`
	Action      string `json:"action"`
	Description string `json:"description"`
}

CreatePermissionRequest represents a request to create a permission

type CreateRoleRequest added in v0.0.3

type CreateRoleRequest struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

CreateRoleRequest represents a request to create a role

type ErrorResponse

type ErrorResponse struct {
	Error   string `json:"error"`
	Message string `json:"message,omitempty"`
}

ErrorResponse represents an error response

type GrantPermissionRequest added in v0.0.3

type GrantPermissionRequest struct {
	PermissionID   string `json:"permission_id"`
	PermissionName string `json:"permission_name"`
}

GrantPermissionRequest represents a request to grant a permission to a role

type Handlers

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

Handlers provides pre-built HTTP handlers for authentication

func NewHandlers

func NewHandlers(service *auth.Service, routeConfig *config.RouteConfig) *Handlers

NewHandlers creates a new Handlers instance

func (*Handlers) ChangePassword

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

ChangePassword handles changing user password (requires authentication)

func (*Handlers) GoogleOAuthCallback

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

GoogleOAuthCallback handles the Google OAuth callback

func (*Handlers) GoogleOAuthLogin

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

GoogleOAuthLogin initiates Google OAuth login flow

func (*Handlers) Login

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

Login handles user authentication

func (*Handlers) Logout

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

Logout handles user logout (requires authentication)

func (*Handlers) Profile

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

Profile handles retrieving user profile (requires authentication)

func (*Handlers) RefreshToken

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

RefreshToken handles token refresh

func (*Handlers) Register

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

Register handles user registration

func (*Handlers) RegisterRoutes

func (h *Handlers) RegisterRoutes(mux *http.ServeMux)

RegisterRoutes registers all authentication routes on the provided mux

func (*Handlers) RequestPasswordReset

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

RequestPasswordReset handles password reset requests

func (*Handlers) ResendVerification

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

ResendVerification handles resending verification email (requires authentication)

func (*Handlers) ResetPassword

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

ResetPassword handles password reset with token

func (*Handlers) UnlinkGoogleOAuth

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

UnlinkGoogleOAuth handles unlinking a Google OAuth account (requires authentication)

func (*Handlers) VerifyEmail

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

VerifyEmail handles email verification

type SuccessResponse

type SuccessResponse struct {
	Message string      `json:"message"`
	Data    interface{} `json:"data,omitempty"`
}

SuccessResponse represents a success response

type UpdatePermissionRequest added in v0.0.3

type UpdatePermissionRequest struct {
	Name        string `json:"name"`
	Resource    string `json:"resource"`
	Action      string `json:"action"`
	Description string `json:"description"`
}

UpdatePermissionRequest represents a request to update a permission

type UpdateRoleRequest added in v0.0.3

type UpdateRoleRequest struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

UpdateRoleRequest represents a request to update a role

Jump to

Keyboard shortcuts

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