mirror of
https://github.com/steveiliop56/tinyauth.git
synced 2025-11-03 07:35:44 +00:00
Compare commits
2 Commits
v1.0.0-bet
...
v1.0.0-bet
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e8d2e059a9 | ||
|
|
2c7a3fc801 |
@@ -94,6 +94,7 @@ var rootCmd = &cobra.Command{
|
|||||||
AppURL: config.AppURL,
|
AppURL: config.AppURL,
|
||||||
CookieSecure: config.CookieSecure,
|
CookieSecure: config.CookieSecure,
|
||||||
DisableContinue: config.DisableContinue,
|
DisableContinue: config.DisableContinue,
|
||||||
|
CookieExpiry: config.CookieExpiry,
|
||||||
}, hooks, auth, providers)
|
}, hooks, auth, providers)
|
||||||
|
|
||||||
// Setup routes
|
// Setup routes
|
||||||
|
|||||||
@@ -55,20 +55,12 @@ func (api *API) Init() {
|
|||||||
|
|
||||||
domain, domainErr := utils.GetRootURL(api.Config.AppURL)
|
domain, domainErr := utils.GetRootURL(api.Config.AppURL)
|
||||||
|
|
||||||
log.Info().Str("domain", domain).Msg("Using domain for cookies")
|
|
||||||
|
|
||||||
if domainErr != nil {
|
if domainErr != nil {
|
||||||
log.Fatal().Err(domainErr).Msg("Failed to get domain")
|
log.Fatal().Err(domainErr).Msg("Failed to get domain")
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
var isSecure bool
|
log.Info().Str("domain", domain).Msg("Using domain for cookies")
|
||||||
|
|
||||||
if api.Config.CookieSecure {
|
|
||||||
isSecure = true
|
|
||||||
} else {
|
|
||||||
isSecure = false
|
|
||||||
}
|
|
||||||
|
|
||||||
api.Domain = fmt.Sprintf(".%s", domain)
|
api.Domain = fmt.Sprintf(".%s", domain)
|
||||||
|
|
||||||
@@ -76,7 +68,7 @@ func (api *API) Init() {
|
|||||||
Domain: api.Domain,
|
Domain: api.Domain,
|
||||||
Path: "/",
|
Path: "/",
|
||||||
HttpOnly: true,
|
HttpOnly: true,
|
||||||
Secure: isSecure,
|
Secure: api.Config.CookieSecure,
|
||||||
MaxAge: api.Config.CookieExpiry,
|
MaxAge: api.Config.CookieExpiry,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user