Documentation ¶
Index ¶
Constants ¶
View Source
const FakeAudience = "example-users"
View Source
const FakeIssuer = "fake-issuer"
View Source
const KeyID = `fake-key-id`
PrivateKey is an ECDSA private key which was generated with the following command:
openssl ecparam -name prime256v1 -genkey -noout -out ecprivatekey.pem
View Source
const PermissionsClaim = "perm"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FakeAuthenticator ¶
type FakeAuthenticator struct { PrivateKey *ecdsa.PrivateKey PublicKey *ecdsa.PublicKey KeySet jwk.Set }
func NewFakeAuthenticator ¶
func NewFakeAuthenticator(keyfile string) (*FakeAuthenticator, error)
NewFakeAuthenticator creates an authenticator example which uses the ECDSA key in the given file to validate JWT's that it has signed itself.
func (*FakeAuthenticator) CreateJWSWithClaims ¶
func (f *FakeAuthenticator) CreateJWSWithClaims(claims []string) ([]byte, error)
CreateJWSWithClaims is a helper function to create JWT's with the specified claims.
func (*FakeAuthenticator) SignToken ¶
func (f *FakeAuthenticator) SignToken(t jwt.Token) ([]byte, error)
SignToken takes a JWT and signs it with our priviate key, returning a JWS.
func (*FakeAuthenticator) ValidateJWS ¶
func (f *FakeAuthenticator) ValidateJWS(jwsString string) (jwt.Token, error)
ValidateJWS ensures that the critical JWT claims needed to ensure that we trust the JWT are present and with the correct values.
Click to show internal directories.
Click to hide internal directories.