Documentation ¶
Index ¶
Constants ¶
const FakeAudience = "example-users"
FakeAudience means example users const
const FakeIssuer = "fake-issuer"
FakeIssuer means fake issuer const
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
KeyID means fake key id const
const PermissionsClaim = "perm"
PermissionsClaim means perm const
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 }
FakeAuthenticator means authentication information struct
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.