-
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
only use
__Host
prefix if https is enabled
- Loading branch information
1 parent
d34f8b4
commit 186e2fb
Showing
9 changed files
with
55 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package cookie | ||
|
||
import ( | ||
"github.com/gin-gonic/gin" | ||
) | ||
|
||
func AddAccessTokenCookie(c *gin.Context, maxAgeInSeconds int, token string) { | ||
c.SetCookie(AccessTokenCookieName, token, maxAgeInSeconds, "/", "", true, true) | ||
} | ||
|
||
func AddSessionIdCookie(c *gin.Context, maxAgeInSeconds int, sessionID string) { | ||
c.SetCookie(SessionIdCookieName, sessionID, maxAgeInSeconds, "/", "", true, true) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package cookie | ||
|
||
import ( | ||
"github.com/stonith404/pocket-id/backend/internal/common" | ||
"strings" | ||
) | ||
|
||
var AccessTokenCookieName = "__Host-access_token" | ||
var SessionIdCookieName = "__Host-session" | ||
|
||
func init() { | ||
if strings.HasPrefix(common.EnvConfig.AppURL, "http://") { | ||
AccessTokenCookieName = "access_token" | ||
SessionIdCookieName = "session" | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
export const ACCESS_TOKEN_COOKIE_NAME = '__Host-access_token'; | ||
export const ACCESS_TOKEN_COOKIE_NAME = process.env.PUBLIC_APP_URL?.startsWith('http://') | ||
? 'access_token' | ||
: '__Host-access_token'; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters