Skip to content

Latest commit

 

History

History
30 lines (23 loc) · 823 Bytes

README.md

File metadata and controls

30 lines (23 loc) · 823 Bytes

Go kit: stringsvc2 with JWT

Go kit
stringsvc2

As part of learning Go Kit, now I'm trying to add JWT to stringsvc2.

  • Use custom claims to save client ID in JWT
  • Add /auth endpoint for getting a token
  • Protect /uppercase and /count endpoints with JWT
  • Use Context to pass client ID
  • Log client ID and record client ID in metrics
  • Protect /metrics endpoint with basic auth
go build -o server
./server
curl -v -XPOST -d '{"clientId": "mobile", "clientSecret": "m_secret"}' http://localhost:8080/auth
curl -v -XPOST -d '{"s": "hello world"}' -H "Authorization: Bearer eyJhbGci..." http://localhost:8080/uppercase
curl -v --user prometheus:password http://localhost:8080/metrics