Documentation
¶
Index ¶
- Constants
- func CheckPasswordHash(password, hash string) bool
- func HashPassword(password string) (string, error)
- func RetrieveUserFromCtx[T any](ctx *caesar.Context) (*T, error)
- type Auth
- func (auth *Auth) AuthMiddleware(ctx *caesar.Context) error
- func (a *Auth) Authenticate(ctx *caesar.Context, user any) error
- func (auth *Auth) AuthenticateRequest(ctx *caesar.Context) error
- func (auth *Auth) GenerateJWT(user any) (string, error)
- func (auth *Auth) SignOut(ctx *caesar.Context) error
- func (auth *Auth) SilentMiddleware(ctx *caesar.Context) error
- type AuthCfg
- type SocialAuth
- type SocialAuthProvider
Constants ¶
View Source
const ( SESSION_NAME = "caesar_session" SESSION_VALUE_KEY = "user_id" USER_CONTEXT_KEY = "user" )
Variables ¶
This section is empty.
Functions ¶
func CheckPasswordHash ¶
func HashPassword ¶
Types ¶
type Auth ¶
type Auth struct { *AuthCfg Social *SocialAuth // contains filtered or unexported fields }
func (*Auth) Authenticate ¶
Authenticate is a method that sets the user in the session. The session consists in a http.Cookie that is set in the client's browser.
func (*Auth) GenerateJWT ¶
GenerateJWT is a method that generates a JWT token for the user.
type SocialAuth ¶
type SocialAuth struct {
Providers map[string]SocialAuthProvider
}
func NewSocialAuth ¶
func NewSocialAuth(store *sessions.CookieStore, providers map[string]SocialAuthProvider) *SocialAuth
func (*SocialAuth) Use ¶
func (s *SocialAuth) Use(provider string) *SocialAuthProvider
Click to show internal directories.
Click to hide internal directories.