Skip to content

cristosal/auth

Repository files navigation

Auth

Go Reference

Easy to use postgres backed authentication service for go.

Features

  • Authentication
  • Users
  • Groups
  • Permissions
  • Sessions
  • Rate limiting (with redis)
  • Password Resets
  • Registration Confirmations

Installation

go get -u github.com/cristosal/auth

Documentation

View the godoc documentation here

https://pkg.go.dev/github.com/cristosal/auth

Usage

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)

About

easy to use local authentication with groups and permissions

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages