Documentation ¶
Index ¶
- func DeleteLoginCookie() *http.Cookie
- func GenerateKey() ([]byte, []byte, error)
- func ToCookie(tokenString string) *http.Cookie
- func ToCookiesWithCsrfProtection(tokenString string) []*http.Cookie
- type HttpRequestAuthenticator
- type MiddlewareChain
- type MiddlewareChainMap
- type RequestContext
- type Signer
- type UserDetails
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteLoginCookie ¶
func GenerateKey ¶
Types ¶
type HttpRequestAuthenticator ¶
type HttpRequestAuthenticator interface { // authenticates a Request Authenticate(req *http.Request) (*UserDetails, error) AuthenticateJwtString(jwtString string) (*UserDetails, error) // authenticates a Request that has cookies returned by ToCookiesWithCsrfProtection() AuthenticateWithCsrfProtection(req *http.Request) (*UserDetails, error) }
func NewEcJwtAuthenticator ¶
func NewEcJwtAuthenticator(validatorPublicKey []byte) (HttpRequestAuthenticator, error)
type MiddlewareChain ¶
type MiddlewareChain func(w http.ResponseWriter, r *http.Request) *RequestContext
if returns nul, request handling is aborted. in return=nil case middleware is responsible for error response.
type MiddlewareChainMap ¶
type MiddlewareChainMap map[string]MiddlewareChain
type RequestContext ¶
type RequestContext struct {
User *UserDetails
}
type Signer ¶
type Signer interface {
Sign(userDetails UserDetails, now time.Time) string
}
func NewEcJwtSigner ¶
type UserDetails ¶
func NewUserDetails ¶
func NewUserDetails(id string, authTokenJwt string) *UserDetails
Click to show internal directories.
Click to hide internal directories.