• Stars
    star
    106
  • Rank 315,508 (Top 7 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 5 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An example API for creating/verifying json web tokens

Express-JWT

An example API for creating/verifying json web tokens.

Yes, the private key is in the repo. Not secure. I know.

Usage

Install Dependencies

npm install

Start

npm start

Docker

docker run -d --name express-jwt -p 8000:8000 circa10a/express-jwt

Kubernetes

kubectl apply -f https://raw.githubusercontent.com/circa10a/express-jwt/master/k8s-deployment.yaml

Then navigate to http://localhost:8000/ to see the swagger api docs.

Configuration

Port

Default listens on port 8000, but can be changed by specifying a PORT environment variable.

Basic auth users

To obtain your JWT, you must authenticate against /login with Basic Auth.

There are 2 hardcoded sample users in config/config.js that can be used. You can also easily append to the object for more fake users.

Users

user password base64
admin admin YWRtaW46YWRtaW4=
guest password Z3Vlc3Q6cGFzc3dvcmQ=

JWT Expiration

In config/config.js the default expiration time of a JWT is 1h

Obtain token

curl -H "Authorization: Basic YWRtaW46YWRtaW4=" http://localhost:8000/login

Auth with token

You can use the token previously acquired via curl or here's a token with no expiration you can test with:

curl -H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJmb28iOiJiYXIiLCJpYXQiOjE1NjIzNDc0MzR9.g0-jxWgWVc98C6EzEWYoWxyIXVY3xmzgIZfD32PBZfrwrVrTiAqP69IrJ3DKBseeVgf2dwOm4ennwpakHXv-xxfZyMoM8-nfwJardv0Pr4bToBhGwxJhe-g1Hy7ygID5XpqQok9zY_R-0vZn-o-opi9VZYvTft9ZBAPEdj9oPZrRk_LfrrMQjO-oK9BiNQTjZm0rzFsqetk8FmqKwtb-TDPmmkgS0remsbsJzyvAi2x6r7fosljM2t0vjxdGzumbU4pxuSsQUjoRDzPG0VAH2rKNHECFqmCWJ8myIBOobYYAt7TIW0TzzJkyXb9amfDjy1IBlZyvwEznTUT_XBh6hQ" http://localhost:8000/protected

More Repositories

1

easy-soap-request

Small Node.js library to make SOAP requests easier
JavaScript
159
star
2

device-monitor-dashboard

Python script to generate html report of device online/offline status
Python
110
star
3

blockerized-dockchain

Because all problems are solvable with containers and blockchains
Python
85
star
4

k8s-label-rules-webhook

A validating admission webhook to ensure compliant labels in your k8s cluster
Go
53
star
5

terraform-provider-mcbroken

Base the count of your infrastucture resources on the current number of broken mcdonald's ice cream machines nationally or by a city of your choosing. Powered by https://mcbroken.com/
Go
29
star
6

pumpkin-pi

Raspberry pi project that controls jack-o-lantern via servo motor and PIR motion sensors
Go
18
star
7

go-aws-news

Go app + library to fetch what's new from AWS
Go
18
star
8

go-geofence

A small library to detect if an IP address is close to yours or another of your choosing using https://ipbase.com
Go
17
star
9

caddy-geofence

A caddy module for IP geofencing your caddy web server using ipbase.com
Go
15
star
10

terraform-provider-mailform

A terraform provider to send physical mail via https://mailform.io
Go
14
star
11

web-link-tester

Flask App to scrape hrefs from websites and validate links
HTML
11
star
12

cv-notifier

Easily detect objects using computer vision and call configurable webhooks
Python
9
star
13

local-puppet-dev

Docker setup for testing puppet manifests
Puppet
8
star
14

vault-plugin-secrets-jenkins

A plugin for Hashicorp Vault to create ephemeral users and API tokens for Jenkins CI
Go
7
star
15

ava

A discord implementation of the famous ava bot
JavaScript
6
star
16

react-foaas-card

The most offensive of react components
JavaScript
6
star
17

go-mailform

A small library to send physical mail from your Go applications using https://mailform.io
Go
5
star
18

mcbroken-dashboard

Entry for digitalocean app platform hackathon
Go
5
star
19

filter-object-array

Small Node.js library to filter an array of objects with an object
JavaScript
4
star
20

google-home-aws-news

A webhook for google assistance integrations to provide the latest AWS news
Go
4
star
21

github-pr-exporter

A prometheus exporter for monitoring pull requests for specified users in the last X number of days.
Go
3
star
22

packer-aws-tomcat-template

A packer template to build AMI's with apache tomcat installed and systemd enabled. Based on Amazon linux.
HCL
3
star
23

terraform-local-minio

Automatically install and create local buckets with public policies for testing
HCL
3
star
24

witchonstephendrive.com

A home automation project to control my Halloween decorations
Go
2
star
25

href-scraper

ruby CLI to scrape hrefs from single webpages
Ruby
1
star
26

prometheus

Deployment of my personal prometheus instance
HCL
1
star
27

circa10a.github.io

Hosting of Portfolio
JavaScript
1
star
28

l33tcrypto

Cryptography for the most l33t haxx0rs
Java
1
star
29

circa10a

My profile readme
1
star