Documentation ¶
Index ¶
- Constants
- Variables
- type EAppClaims
- type Service
- func (service Service) CheckToken(request *http.Request) (string, int, error)
- func (service Service) ConfigureEnvironment(size int) error
- func (service Service) CurrentAudience(request *http.Request) string
- func (service Service) ExtractToken(request *http.Request) string
- func (service Service) KeyFunc(token *jwt.Token) (interface{}, error)
- func (service Service) NewToken(id int, sessionIndex string, audience string) (string, time.Time, error)
- func (service Service) ParseWithClaims(tokenString string) (*jwt.Token, error)
- func (service Service) Secret() []byte
- func (service Service) SessionIndex(request *http.Request) string
- func (service Service) TargetAudiences() []string
- func (service Service) Timeout() time.Duration
- func (service Service) TokenClaims(token *jwt.Token) *EAppClaims
Constants ¶
const (
// Issuer is the JWT issuer.
Issuer = "eqip"
)
Variables ¶
var ( // JwtSecret is the secret used to generate tokens. JwtSecret = "" // JwtSigningMethod is the algorithm used for signing tokens. JwtSigningMethod = jwt.SigningMethodHS256 // AuthBearerRegexp is a regular expression to extract the authorization token. AuthBearerRegexp = regexp.MustCompile("Bearer\\s(.*)") )
Functions ¶
This section is empty.
Types ¶
type EAppClaims ¶ added in v1.0.6
type EAppClaims struct { SessionIndex string `json:"sid,omitempty"` jwt.StandardClaims }
EAppClaims are all the claims eApp uses in JWT
type Service ¶ added in v0.5.3
Service is an implementation of JWT service handling.
func (Service) CheckToken ¶ added in v0.5.3
CheckToken tests if the token is valid and is of the correct audience.
func (Service) ConfigureEnvironment ¶ added in v0.5.3
ConfigureEnvironment ensure the secret is set prior to use.
func (Service) CurrentAudience ¶ added in v0.5.3
CurrentAudience is the currently valid audience from the token.
func (Service) ExtractToken ¶ added in v0.5.3
ExtractToken returns the token from an HTTP request header.
func (Service) NewToken ¶ added in v0.5.3
func (service Service) NewToken(id int, sessionIndex string, audience string) (string, time.Time, error)
NewToken generates a new Jwt signed token using a users account information id is the user id for the token. sessionIndex is the user session identifier provided by the SAML identity provider (facilitates Single Logout) audience is a JWT field that defines the intended recipient of the token
func (Service) ParseWithClaims ¶ added in v0.5.3
ParseWithClaims parses the token with standard claims..
func (Service) SessionIndex ¶ added in v1.0.7
SessionIndex returns the SAML user session identifier persisted in the token.
func (Service) TargetAudiences ¶ added in v0.5.3
TargetAudiences which are accepted based on the configured environment.
func (Service) Timeout ¶ added in v0.5.3
Timeout returns the duration in time for how long a session is considered valid. Per policy this defaults to 15 minutes.
func (Service) TokenClaims ¶ added in v0.5.3
func (service Service) TokenClaims(token *jwt.Token) *EAppClaims
TokenClaims return all standard token claims.