Documentation
¶
Index ¶
- Constants
- func CSRFProtect(secretKey []byte, secure bool) func(http.Handler) http.Handler
- func CSRFToken(r *http.Request) string
- func ClearSessionCookie(w http.ResponseWriter, secure bool)
- func ContextWithClaims(ctx context.Context, claims *token.SessionClaims) context.Context
- func ContextWithUserProfile(ctx context.Context, user *models.User) context.Context
- func IsHTTPS(baseURL string) bool
- func JWTAuth(tokens *token.Tokens, secureCookies bool) func(http.Handler) http.Handler
- func LoadUserProfile(db *bun.DB) func(http.Handler) http.Handler
- func RequireAuth(next http.Handler) http.Handler
- func SetSessionCookie(w http.ResponseWriter, token string, secure bool)
- func UserFromContext(ctx context.Context) *token.SessionClaims
- func UserProfileFromContext(ctx context.Context) *models.User
- type ContextKey
Constants ¶
View Source
const SessionCookieName = "session"
Variables ¶
This section is empty.
Functions ¶
func ClearSessionCookie ¶
func ClearSessionCookie(w http.ResponseWriter, secure bool)
func ContextWithClaims ¶
func ContextWithUserProfile ¶
func SetSessionCookie ¶
func SetSessionCookie(w http.ResponseWriter, token string, secure bool)
func UserFromContext ¶
func UserFromContext(ctx context.Context) *token.SessionClaims
Types ¶
type ContextKey ¶
type ContextKey string
const UserKey ContextKey = "user"
const UserProfileKey ContextKey = "user_profile"
Click to show internal directories.
Click to hide internal directories.