Easy to use postgres backed authentication service for go.
- Authentication
- Users
- Groups
- Permissions
- Sessions
- Rate limiting (with redis)
- Password Resets
- Registration Confirmations
go get -u github.com/cristosal/auth
View the godoc documentation here
https://pkg.go.dev/github.com/cristosal/auth
Create a new service using an existing *sql.DB
db, _ := sql.Open("pgx", os.Getenv("CONNECTION_STRING"))
authService := auth.NewService(db)
You now have access to the various underlying apis
// users api
authService.Users()
// permissions api
authService.Permissions()
// groups api
authService.Groups()
// sessions api
authService.Sessions()
If you want to use rate limiting, pass in a redis client
rcl := redis.NewClient(&redis.Options{Addr: os.Getenv("REDIS_ADDR")})
limiter := auth.NewRedisRateLimiter(rcl)