auth
Authentification for apps in microservices.
Getting Started
You can use GitHub OAuth Provider or a simple username/password file for
authentication.
GitHub OAuth Provider
Create your OAuth app on
GitHub interface. The authorization
callback URL must be set for pointing your app. The OAuth State is a random
string use for verification by OAuth Provider,
see manual.
Basic Username/Password
Write user's credentials with the following format :
[id]:[username]:[bcrypt password],[id2]:[username2]:[bcrypt password2]
You can generate bcrypted password using go run bcrypt/bcrypt.go "password"
.
Build
In order to build the server stuff, run the following command.
make
It will compile both auth API server and password encrypter.
Usage of auth:
-authRedirect string
[auth] Redirect URL on Auth Success
-basicUsers id:username:password,id2:username2:password2
[basic] Users in the form id:username:password,id2:username2:password2
-cert string
[http] Certificate file
-cookieDomain string
[auth] Cookie Domain to Store Authentification
-corsCredentials
[cors] Access-Control-Allow-Credentials
-corsExpose string
[cors] Access-Control-Expose-Headers
-corsHeaders string
[cors] Access-Control-Allow-Headers (default "Content-Type")
-corsMethods string
[cors] Access-Control-Allow-Methods (default "GET")
-corsOrigin string
[cors] Access-Control-Allow-Origin (default "*")
-csp string
[owasp] Content-Security-Policy (default "default-src 'self'; base-uri 'self'")
-frameOptions string
[owasp] X-Frame-Options (default "deny")
-githubClientId string
[github] OAuth Client ID
-githubClientSecret string
[github] OAuth Client Secret
-githubScopes string
[github] OAuth Scopes, comma separated
-hsts
[owasp] Indicate Strict Transport Security (default true)
-key string
[http] Key file
-port int
[http] Listen port (default 1080)
-prometheusPath string
[prometheus] Path for exposing metrics (default "/metrics")
-tracingAgent string
[tracing] Jaeger Agent (e.g. host:port) (default "jaeger:6831")
-tracingName string
[tracing] Service name
-url string
[alcotest] URL to check
-userAgent string
[alcotest] User-Agent for check (default "Golang alcotest")
Password encrypter accepts one argument, the password, and output the bcrypted one.