Basic but complete authentication flow

This commit is contained in:
2020-05-20 11:13:14 +02:00
parent 81778121fb
commit 61aae078b5
32 changed files with 626 additions and 442 deletions

View File

@ -11,10 +11,9 @@ import (
)
type Config struct {
HTTP HTTPConfig `yaml:"http"`
TestApp TestAppConfig `yaml:"testApp"`
SMTP SMTPConfig `yaml:"smtp"`
Hydra HydraConfig `yaml:"hydra"`
HTTP HTTPConfig `yaml:"http"`
SMTP SMTPConfig `yaml:"smtp"`
Hydra HydraConfig `yaml:"hydra"`
}
// NewFromFile retrieves the configuration from the given file
@ -37,17 +36,14 @@ type HTTPConfig struct {
Address string `yaml:"address"`
CookieAuthenticationKey string `yaml:"cookieAuthenticationKey"`
CookieEncryptionKey string `yaml:"cookieEncryptionKey"`
TokenSigningKey string `yaml:"tokenSigningKey"`
TokenEncryptionKey string `yaml:"tokenEncryptionKey"`
BasePublicURL string `yaml:"basePublicUrl"`
CookieMaxAge int `yaml:"cookieMaxAge"`
TemplateDir string `yaml:"templateDir"`
PublicDir string `yaml:"publicDir"`
}
type TestAppConfig struct {
Enabled bool `yaml:"enabled"`
ClientID string `yaml:"clientId"`
ClientSecret string `yaml:"clientSecret"`
IssuerURL string `ymal:"issuerUrl"`
RedirectURL string `yaml:"redirectUrl"`
PublicAddress string `yaml:"publicAddress"`
PublicScheme string `yaml:"publicScheme"`
}
type SMTPConfig struct {
@ -76,14 +72,13 @@ func NewDefault() *Config {
Address: ":3000",
CookieAuthenticationKey: "",
CookieEncryptionKey: "",
TokenEncryptionKey: "",
TokenSigningKey: "",
CookieMaxAge: int((time.Hour * 1).Seconds()), // 1 hour
TemplateDir: "template",
PublicDir: "public",
},
TestApp: TestAppConfig{
Enabled: false,
IssuerURL: "http://localhost:4444/",
RedirectURL: "http://localhost:3000/test/oauth2/callback",
PublicAddress: "",
PublicScheme: "",
},
SMTP: SMTPConfig{
Host: "localhost",