Documentation ¶
Overview ¶
Package testuril helps setting up required data for testing, such as tokens, claims and verifiers.
Index ¶
- Constants
- Variables
- func ACRVerify(acr string) error
- func NewAccessToken(issuer, subject string, audience []string, expiration time.Time, ...) (string, *oidc.AccessTokenClaims)
- func NewAccessTokenCustom(issuer, subject string, audience []string, expiration time.Time, ...) (string, *oidc.AccessTokenClaims)
- func NewIDToken(issuer, subject string, audience []string, expiration, authTime time.Time, ...) (string, *oidc.IDTokenClaims)
- func NewIDTokenCustom(issuer, subject string, audience []string, expiration, authTime time.Time, ...) (string, *oidc.IDTokenClaims)
- func NewJWTProfileAssertion(issuer, clientID string, audience []string, issuedAt, expiration time.Time) (string, *oidc.JWTTokenRequest)
- func ValidAccessToken() (string, *oidc.AccessTokenClaims)
- func ValidIDToken() (string, *oidc.IDTokenClaims)
- func ValidJWTProfileAssertion() (string, *oidc.JWTTokenRequest)
- type JWTProfileKeyStorage
- type KeySet
Constants ¶
View Source
const InvalidSignatureToken = `` /* 628-byte string literal not displayed */
View Source
const SignatureAlgorithm = jose.RS256
Variables ¶
View Source
var ( WebKey jose.JSONWebKey Signer jose.Signer )
View Source
var ( ValidIssuer = "local.com" ValidSubject = "tim@local.com" ValidAudience = []string{"unit", "test"} ValidAuthTime = time.Now().Add(-time.Minute) // authtime is always 1 minute in the past ValidExpiration = ValidAuthTime.Add(2 * time.Minute) // token is always 1 more minute available ValidJWTID = "9876" ValidNonce = "12345" ValidACR = "something" ValidAMR = []string{"foo", "bar"} ValidClientID = "555666" ValidSkew = time.Second )
These variables always result in a valid token
Functions ¶
func NewAccessToken ¶
func NewAccessToken(issuer, subject string, audience []string, expiration time.Time, jwtid, clientID string, skew time.Duration) (string, *oidc.AccessTokenClaims)
NewAcccessToken creates a new AccessTokenClaims with passed data and returns a signed token and claims.
func NewAccessTokenCustom ¶
func NewIDToken ¶
func NewIDToken(issuer, subject string, audience []string, expiration, authTime time.Time, nonce string, acr string, amr []string, clientID string, skew time.Duration, atHash string) (string, *oidc.IDTokenClaims)
NewIDToken creates a new IDTokenClaims with passed data and returns a signed token and claims.
func NewIDTokenCustom ¶
func NewJWTProfileAssertion ¶
func ValidAccessToken ¶
func ValidAccessToken() (string, *oidc.AccessTokenClaims)
ValidAccessToken returns a token and claims that are in the token. It uses the Valid* global variables and the token always passes verification within the same test run.
func ValidIDToken ¶
func ValidIDToken() (string, *oidc.IDTokenClaims)
ValidIDToken returns a token and claims that are in the token. It uses the Valid* global variables and the token will always pass verification.
func ValidJWTProfileAssertion ¶
func ValidJWTProfileAssertion() (string, *oidc.JWTTokenRequest)
Types ¶
type JWTProfileKeyStorage ¶
type JWTProfileKeyStorage struct{}
func (JWTProfileKeyStorage) GetKeyByIDAndClientID ¶
Click to show internal directories.
Click to hide internal directories.