mirror of
https://github.com/hrfee/jfa-go.git
synced 2026-01-18 16:47:42 +01:00
auth: strip port from domain if present
app.UseProxyHost being enabled means app.ExternalDomain sometimes returns a domain/IP with a port attached. This is now removed, so the refresh cookie is set correctly.
This commit is contained in:
@@ -65,7 +65,7 @@ func (app *appContext) getUserTokenLogin(gc *gin.Context) {
|
||||
}
|
||||
|
||||
// host := gc.Request.URL.Hostname()
|
||||
host := app.ExternalDomain(gc)
|
||||
host := app.ExternalDomainNoPort(gc)
|
||||
uri := "/my"
|
||||
// FIXME: This seems like a bad idea? I think it's to deal with people having Reverse proxy subfolder/URL base set to /accounts.
|
||||
if strings.HasPrefix(gc.Request.RequestURI, PAGES.Base) {
|
||||
@@ -105,7 +105,7 @@ func (app *appContext) getUserTokenRefresh(gc *gin.Context) {
|
||||
}
|
||||
|
||||
// host := gc.Request.URL.Hostname()
|
||||
host := app.ExternalDomain(gc)
|
||||
host := app.ExternalDomainNoPort(gc)
|
||||
gc.SetCookie("user-refresh", refresh, REFRESH_TOKEN_VALIDITY_SEC, "/my", host, true, true)
|
||||
gc.JSON(200, getTokenDTO{jwt})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user