Documentation ¶
Overview ¶
Package auth is for authenticating web based users and sessions
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateSchema ¶
CreateSchema will create the auth schema and associated tables needed for this package to run
Types ¶
type Auth ¶
type Auth struct {
// contains filtered or unexported fields
}
Auth contains the config
func (*Auth) AuthHandler ¶
func (a *Auth) AuthHandler(access string, f http.HandlerFunc) http.HandlerFunc
AuthHandler wraps functions that need authentication before executing. If authentication fails, we return status 401 NotAuthorized.
type Config ¶
type Config struct { Issuer string // what authority will be issuing the jwt tokens SecretPath string // path to the file with the secrets Router *httprouter.Router // router used to add auth http endpoints AccessExpire time.Duration // how long before the access tokens will expire RefreshExpire time.Duration // how long before the refresh tokens will expire UserRate time.Duration // max rate that a user can make any auth request GlobalRate time.Duration // max rate that all users can make any auth request LimiterLogger *logging.Logger // the rate limiter logger DB *pgxpool.Pool // database connection to retrieve stored auth data Log *logging.Logger // logger for logging auth state changes EnableRegistration bool // feature flag to enable or disable new registration }
Config stores the settings used for all auth requests
Click to show internal directories.
Click to hide internal directories.