internal

package
v0.0.0-...-9b07614 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 7, 2023 License: MulanPSL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const FakeAudience = "example-users"

FakeAudience means example users const

View Source
const FakeIssuer = "fake-issuer"

FakeIssuer means fake issuer const

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

KeyID means fake key id const

View Source
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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL