https://github.com/suyashkumar/auth-grpc
Authentication gRPC microservice with batteries included (db, hashing, validation, etc)
https://github.com/suyashkumar/auth-grpc
authentication authentication-grpc-microservice authentication-service grpc hashing-passwords microservice service
Last synced: about 1 year ago
JSON representation
Authentication gRPC microservice with batteries included (db, hashing, validation, etc)
- Host: GitHub
- URL: https://github.com/suyashkumar/auth-grpc
- Owner: suyashkumar
- Created: 2018-02-09T07:05:21.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-04-06T05:29:36.000Z (about 8 years ago)
- Last Synced: 2025-02-10T05:13:17.315Z (about 1 year ago)
- Topics: authentication, authentication-grpc-microservice, authentication-service, grpc, hashing-passwords, microservice, service
- Language: Go
- Homepage:
- Size: 22.5 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# auth-grpc [WIP]
A simple (but opinionated) Golang authentication gRPC microservice that implements very simple interface (below) that comes with batteries included (permissions, hashing, validation, etc). This is a gRPC wrapper around my core [suyashkumar/auth](https://github.com/suyashkumar/auth) Go authentication library.
```go
type Auth interface {
Register(user User, password string) error
GetToken(email string, password string, reqPermissions Permissions) (token string, err error)
Validate(token string) (*Claims, error)
}
```
You only need to set a database `DbConnString` and `SigningKey` environment variables, and everything else is taken care of for you including:
* table and database setup (including uniqueness constraints and useful indicies)
* hashing passwords using `bcrypt` on register
* comparing hashed passwords on login
* validation of new user fields like "Email" (TBD)
* encoding and extraction of key fields stored in the JSON Web Token (JWT)
* ensuring that a token's requested permissions does not exceed the user's maximum permission level