https://github.com/daniilty/sharenote-auth
service for jwt authorization/user registration
https://github.com/daniilty/sharenote-auth
go golang jwt jwt-authentication rs256
Last synced: about 1 month ago
JSON representation
service for jwt authorization/user registration
- Host: GitHub
- URL: https://github.com/daniilty/sharenote-auth
- Owner: daniilty
- Created: 2022-01-02T15:18:03.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-01-21T13:41:23.000Z (over 3 years ago)
- Last Synced: 2025-01-26T01:20:28.544Z (3 months ago)
- Topics: go, golang, jwt, jwt-authentication, rs256
- Language: Go
- Homepage:
- Size: 26.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Service for jwt authorization
## How to generate OpenSSL RSA Key Pair:
```bash
$ openssl genrsa -des3 -out private.pem 2048
$ openssl rsa -in private.pem -outform PEM -pubout -out public.pem
$ openssl rsa -in private.pem -out private_unencrypted.pem -outform PEM
```## All avaliable endpoints:
* GET `/api/v1/auth/jwks` - get generated JSON Web Key Set to use it for token validation with proxy(krakend for example)
* GET `/api/v1/auth/me` - get current user info("Authorization: Bearer ..." header is required)
* POST `/api/v1/auth/login` - login user. Body:
```
{
"email": "[email protected]",
"password": "sample"
}
```
* POST `/api/v1/auth/register` - register user. Body:
```
{
"email": "[email protected]",
"password": "sample",
"name": "Biggus Dickus",
"userName": "sample"
}
```## Environment variables:
* `PUBKEY` - `export PUBKEY="$(cat public.pem)"`
* `PRIVKEY` - `export PUBKEY="$(cat private_unencrypted.pem)"`
* `USERS_GRPC_ADDR` - grpc address of sharenote-users service
* `HTTP_SERVER_ADDR` - http address of this service
* `TOKEN_EXPIRY` - authorization token expiry(in seconds)