Documentation ¶
Index ¶
- func BasicAuth(username, password string, realm ...string) egor.Middleware
- func CreateJWTToken(secret string, payload any, exp time.Duration) (string, error)
- func GetClaims(req *http.Request) jwt.MapClaims
- func JWT(secret string) egor.Middleware
- func VerifyJWToken(secret, tokenString string) (jwt.MapClaims, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BasicAuth ¶
func BasicAuth(username, password string, realm ...string) egor.Middleware
Basic Auth middleware. If the username and password are not correct, a 401 status code is sent. The realm is the realm to display in the login box. Default is "Restricted".
func CreateJWTToken ¶
CreateToken creates a new JWT token with the given payload and expiry duration. JWT is signed with the given secret using the HMAC256 alegorithm.
func JWT ¶
func JWT(secret string) egor.Middleware
JWT creates a JWT middleware with the given secret and options.
func VerifyJWToken ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.