Set fake domain for temp
This commit is contained in:
parent
1a2cb93540
commit
0ce261d9bd
2 changed files with 5 additions and 5 deletions
4
main.go
4
main.go
|
@ -56,8 +56,8 @@ func Routes() *chi.Mux {
|
|||
// LOCK THIS DOWN FOR PRODUCTION
|
||||
cors := cors.New(cors.Options{
|
||||
AllowedOrigins: []string{"*"},
|
||||
AllowedMethods: []string{"GET", "POST"},
|
||||
ExposedHeaders: []string{"Link"},
|
||||
AllowedMethods: []string{"GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS"},
|
||||
AllowedHeaders: []string{"Accept", "Authorization", "Content-Type", "X-CSRF-Token"},
|
||||
AllowCredentials: true,
|
||||
MaxAge: 360,
|
||||
})
|
||||
|
|
|
@ -171,9 +171,9 @@ func refresh(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
func setCookies(w http.ResponseWriter, jwt string, expiration time.Time) string {
|
||||
splitToken := strings.Split(jwt, ".")
|
||||
dataCookie := http.Cookie{Name: "DataCookie", Value: strings.Join(splitToken[:2], "."), Expires: expiration, HttpOnly: false, Path: "/", Domain: "sudosci.test", MaxAge: 360, Secure: false}
|
||||
dataCookie := http.Cookie{Name: "DataCookie", Value: strings.Join(splitToken[:2], "."), Expires: expiration, HttpOnly: false, Path: "/", Domain: ".sudosci.test", MaxAge: 360, Secure: false}
|
||||
http.SetCookie(w, &dataCookie)
|
||||
signatureCookie := http.Cookie{Name: "SignatureCookie", Value: splitToken[2], Expires: expiration, HttpOnly: true, Path: "/", Domain: "sudosci.test", MaxAge: 360, Secure: false}
|
||||
signatureCookie := http.Cookie{Name: "SignatureCookie", Value: splitToken[2], Expires: expiration, HttpOnly: true, Path: "/", Domain: ".sudosci.test", MaxAge: 360, Secure: false}
|
||||
http.SetCookie(w, &signatureCookie)
|
||||
return strings.Join(splitToken[:2], ".")
|
||||
}
|
||||
|
|
Reference in a new issue