mirror of
https://github.com/swissmakers/swiss-datashare.git
synced 2026-04-09 09:37:01 +02:00
feat: add 'secureCookies' configuration variable to explicitly set the secure flag and prevent confusion
This commit is contained in:
@@ -20,6 +20,10 @@ const configVariables: ConfigVariables = {
|
||||
defaultValue: "http://localhost:3000",
|
||||
secret: false,
|
||||
},
|
||||
secureCookies: {
|
||||
type: "boolean",
|
||||
defaultValue: "false",
|
||||
},
|
||||
showHomePage: {
|
||||
type: "boolean",
|
||||
defaultValue: "true",
|
||||
|
||||
@@ -176,7 +176,7 @@ export class AuthController {
|
||||
request.cookies.access_token,
|
||||
);
|
||||
|
||||
const isSecure = this.config.get("general.appUrl").startsWith("https");
|
||||
const isSecure = this.config.get("general.secureCookies");
|
||||
response.cookie("access_token", "", {
|
||||
maxAge: -1,
|
||||
secure: isSecure,
|
||||
|
||||
@@ -334,7 +334,7 @@ export class AuthService {
|
||||
refreshToken?: string,
|
||||
accessToken?: string,
|
||||
) {
|
||||
const isSecure = this.config.get("general.appUrl").startsWith("https");
|
||||
const isSecure = this.config.get("general.secureCookies");
|
||||
if (accessToken)
|
||||
response.cookie("access_token", accessToken, {
|
||||
sameSite: "lax",
|
||||
|
||||
@@ -53,7 +53,7 @@ export class UserController {
|
||||
@GetUser() user: User,
|
||||
@Res({ passthrough: true }) response: Response,
|
||||
) {
|
||||
const isSecure = this.config.get("general.appUrl").startsWith("https");
|
||||
const isSecure = this.config.get("general.secureCookies");
|
||||
|
||||
response.cookie("access_token", "accessToken", {
|
||||
maxAge: -1,
|
||||
|
||||
Reference in New Issue
Block a user