mirror of
https://github.com/hrfee/jfa-go.git
synced 2024-12-22 17:10:10 +00:00
userpage: make refresh token work w/ reverse proxy
potentially for #290.
This commit is contained in:
parent
f6fdd41b35
commit
543f23c8ef
12
user-auth.go
12
user-auth.go
@ -1,6 +1,10 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import "github.com/gin-gonic/gin"
|
import (
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
)
|
||||||
|
|
||||||
func (app *appContext) userAuth() gin.HandlerFunc {
|
func (app *appContext) userAuth() gin.HandlerFunc {
|
||||||
return app.userAuthenticate
|
return app.userAuthenticate
|
||||||
@ -60,7 +64,11 @@ func (app *appContext) getUserTokenLogin(gc *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
app.debug.Printf("Token generated for non-admin user \"%s\"", username)
|
app.debug.Printf("Token generated for non-admin user \"%s\"", username)
|
||||||
gc.SetCookie("user-refresh", refresh, REFRESH_TOKEN_VALIDITY_SEC, "/my", gc.Request.URL.Hostname(), true, true)
|
uri := "/my"
|
||||||
|
if strings.HasPrefix(gc.Request.RequestURI, app.URLBase) {
|
||||||
|
uri = "/accounts/my"
|
||||||
|
}
|
||||||
|
gc.SetCookie("user-refresh", refresh, REFRESH_TOKEN_VALIDITY_SEC, uri, gc.Request.URL.Hostname(), true, true)
|
||||||
gc.JSON(200, getTokenDTO{token})
|
gc.JSON(200, getTokenDTO{token})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user