https://github.com/monkeydioude/goauth
User + JWT Authentification micro-service, both gRPC and JSON API
https://github.com/monkeydioude/goauth
authentication grpc jwt-auth
Last synced: about 1 year ago
JSON representation
User + JWT Authentification micro-service, both gRPC and JSON API
- Host: GitHub
- URL: https://github.com/monkeydioude/goauth
- Owner: monkeydioude
- Created: 2024-09-09T22:30:40.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-03T21:47:17.000Z (about 1 year ago)
- Last Synced: 2025-03-24T05:13:07.663Z (about 1 year ago)
- Topics: authentication, grpc, jwt-auth
- Language: Go
- Homepage:
- Size: 221 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# GOAuTh
[](https://github.com/monkeydioude/GOAuTh/actions/workflows/go.yml)
Auth provider web-sevice with user creation.
## @DEVS!
`make install` once, first
## HOW TO!
The following [JSON API routes](./bin/GOAuTh/api.go) are available (details
about the payload will follow):
- /identity/v1/auth/signup (for user creation)
- /identity/v1/auth/login (for user authentification)
- /identity/v1/jwt/status (for jwt health status)
- /identity/v1/jwt/refresh (for jwt refreshing)
The following [RPCs](./proto/rpc_v1.proto) are available:
- Auth.Signup(UserRequest) returns (Response) (for user creation)
- Auth.Login(UserRequest) returns (Response) (for user authentification)
- JWT.Status(Empty) returns (Response) (for jwt health status)
- JWT.Refresh(Empty) returns (Response) (for jwt refreshing)
## CONFIG!
MANDATORY CONFIG ENV VARS:
- DB_PATH=postgres://test:tedt@0.0.0.0:5454/test
- DB_SCHEMA=users
OPTIONAL CONFIG ENV VARS:
- API_PORT=
- RPC_PORT=
DEFAULT COMFIG VARS (will be used if no env var was provided):
- API_PORT: 8100
- RPC_PORT: 9100
**env vars can be provided through a `.env` file, in GOAuTh bin's directory.**
## PAYLOADS!
As a DDDish/Clean Codeish code architecture, each group of api/rpc use the same
entity, thus have the same payload.
**API/auth**:
```go
type User struct {
Login string `json:"login"`
Password string `json:"password,omitempty"`
RealmName string `json:"realm_name"`
}
```
**RPC/auth**:
```proto
message UserRequest {
string login = 1;
string password = 2;
string realm = 3;
}
```
**API/jwt** no payload, but a `Authorization={JWT}` _cookie_.
**RPC/jwt**, no payload, but a `set-cookie` _metadata_ containing
`Authorization={JWT}`.