Skip to content

gl-johnson/mock-jwt-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mock-jwt-server

This is a simple mock JWT issuer that can be used to generate valid JWTs with various algorithms and claims. It is intended for testing purposes only.

Usage

Running the server

The start script will build and run the JWKS server in a Docker container. The server will be available at http://localhost:8080, unless otherwise specified via a parameter.

# Maps port 8080 on the host
./bin/start

# Maps port 8888 on the host
./bin/start 8888

Configuration

Configurable claims can be modified by environment variables

export ISSUER="some-issuer"
export SUBJECT="some-subject"
export AUDIENCE="some-audience"
export NAME="Some Name"
export EMAIL="some-email@example.com"

./bin/start

Otherwise the claims will be set to the following defaults:

{
  "aud": "test-audience",
  "email": "test-email",
  "exp": time.Now()+24H,
  "iat": time.Now(),
  "iss": "mock-jwt-server",
  "name": "test-name",
  "sub": "test-subject"
}

Endpoints

GET /token - Issue token with default key/alg (RS256)

GET /.well-known/jwks.json - Get complete JWKS

GET /<key_id>/<algorithm> - Get/create specified JWKS

POST /<key_id>/<algorithm> - Sign existing token with specified key/alg

DELETE /<key_id> - Delete key

Supported Algorithms

  • RS256 (default)
  • RS384
  • RS512
  • ES256
  • ES384
  • ES512
  • HS256
  • HS384
  • HS512

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published