Documentation
¶
Index ¶
- Constants
- Variables
- func CheckToken(r *http.Request, validTokenFunc func(string, string) (bool, error), ...) (string, error)
- func ConfigureEnvironment(size int) error
- func CurrentAudience(r *http.Request) string
- func ExtractToken(r *http.Request) string
- func KeyFunc(token *jwt.Token) (interface{}, error)
- func NewToken(id int, audience string) (string, time.Time, error)
- func ParseWithClaims(tokenString string) (*jwt.Token, error)
- func Secret() []byte
- func Timeout() time.Duration
- func TokenClaims(token *jwt.Token) *jwt.StandardClaims
Constants ¶
View Source
const ( Issuer = "eqip" BasicAuthAudience = "Basic" TwoFactorAudience = "2FA" SingleSignOnAudience = "SSO" )
Variables ¶
View Source
var ( JwtSecret = Secret() JwtSigningMethod = jwt.SigningMethodHS256 AuthBearerRegexp = regexp.MustCompile("Bearer\\s(.*)") Expiration = Timeout() )
Functions ¶
func CheckToken ¶
func CheckToken(r *http.Request, validTokenFunc func(string, string) (bool, error), audiences ...string) (string, error)
CheckToken tests if the token is valid and is of the correct audience.
func ConfigureEnvironment ¶
ConfigureEnvironment ensure the secret is set prior to use.
func CurrentAudience ¶
CurrentAudience is the currently valid audience from the token.
func ExtractToken ¶
ExtractToken returns the token from an HTTP request header.
func ParseWithClaims ¶
ParseWithClaims parses the token with standard claims..
func Timeout ¶
Timeout returns the duration in time for how long a session is considered valid. Per policy this defaults to 15 minutes.
func TokenClaims ¶
func TokenClaims(token *jwt.Token) *jwt.StandardClaims
TokenClaims return all standard token claims.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.