fix: add valid origin check for cors (#83)

Resolves #72
This commit is contained in:
Lakhan Samani
2021-12-21 18:46:54 +05:30
committed by GitHub
parent bdbbe4adee
commit 8f7582e1ec
12 changed files with 180 additions and 59 deletions

View File

@@ -10,7 +10,7 @@ import (
func SetCookie(gc *gin.Context, token string) {
secure := true
httpOnly := true
host := GetHostName(constants.AUTHORIZER_URL)
host, _ := GetHostParts(constants.AUTHORIZER_URL)
domain := GetDomainName(constants.AUTHORIZER_URL)
if domain != "localhost" {
domain = "." + domain
@@ -37,7 +37,7 @@ func DeleteCookie(gc *gin.Context) {
secure := true
httpOnly := true
host := GetDomainName(constants.AUTHORIZER_URL)
host, _ := GetHostParts(constants.AUTHORIZER_URL)
domain := GetDomainName(constants.AUTHORIZER_URL)
if domain != "localhost" {
domain = "." + domain