REST API server using gin-gonic to check "Authorization: Bearer" header.
4.8K
REST API server using gin-gonic to check "Authorization: Bearer" header.
This REST API Server receives any path and any methods, and checks Bearer Token ("Authorization: Bearer TOKEN" Request Header).
401 Unauhtorized always.AUTH_TOKENS JSON which is given from the environment variable, respond 401 Unauthorized.403 Forbidden200 OKThis REST API is assumed to use with Ambassador on Kubernetes.
AUTH_TOKENS JSON template{
"<token1>": ["<allowed path regex>", "<allowed path regex>"...],
"<token2>": [...],
...
}
example)
{
"Znda7iglaqdoltsp7kDl60TvkkszcEGU": ["^/path1/.*$", "^/path2/path2-2/.*$"],
"fANtLRTszYAayjtmLFllSHBrt2zRyoqV": ["^/path2/.*$"]
}
Pull container nmatsui/bearer-auth-api from DockerHub
$ docker pull nmatsui/bearer-auth-api
Run Container
LISTEN_PORT environment variable.$ docker run -d -p 3000:3000 nmatsui/bearer-auth-api
go get
$ go get -u github.com/nmatsui/bearer-auth-api
go install
$ go install github.com/nmatsui/bearer-auth-api
Copyright (c) 2018 Nobuyuki Matsui [email protected]
Content type
Image
Digest
Size
8.2 MB
Last updated
over 8 years ago
docker pull nmatsui/bearer-auth-api