@@ -106,9 +106,9 @@ getClientIp(headers: object) {
106106 }
107107
108108 setCustomCookie ( { response, payload } : {
109- response : any , payload : { name : string , value : string , expiry ?: number | undefined , expirySeconds : number | undefined , httpOnly : boolean }
109+ response : any , payload : { name : string , value : string , expiry ?: number | undefined , expirySeconds : number | undefined , httpOnly : boolean , sessionBased ?: boolean | undefined }
110110 } ) {
111- const { name, value, expiry, httpOnly, expirySeconds } = payload ;
111+ const { name, value, expiry, httpOnly, expirySeconds, sessionBased } = payload ;
112112
113113 let expiryMs = 24 * 60 * 60 * 1000 ; // default 1 day
114114 if ( expirySeconds !== undefined ) {
@@ -117,11 +117,14 @@ getClientIp(headers: object) {
117117 afLogger . warn ( `setCustomCookie: expiry(in ms) is deprecated, use expirySeconds instead (seconds), traceback: ${ new Error ( ) . stack } ` ) ;
118118 expiryMs = expiry ;
119119 }
120-
121120 const brandSlug = this . adminforth . config . customization . brandNameSlug ;
122- response . setHeader ( 'Set-Cookie' , `adminforth_${ brandSlug } _${ name } =${ value } ; Path=${ this . adminforth . config . baseUrl || '/' } ;${
123- httpOnly ? ' HttpOnly;' : ''
124- } SameSite=Strict; Expires=${ new Date ( Date . now ( ) + expiryMs ) . toUTCString ( ) } `) ;
121+ response . setHeader ( 'Set-Cookie' ,
122+ `adminforth_${ brandSlug } _${ name } =${ value } ; Path=${ this . adminforth . config . baseUrl || '/' } ;${
123+ httpOnly ? ' HttpOnly;' : ''
124+ } SameSite=Strict;${
125+ sessionBased ? '' : `Expires=${ new Date ( Date . now ( ) + expiryMs ) . toUTCString ( ) } `
126+ } `
127+ ) ;
125128 }
126129
127130 getCustomCookie ( { cookies, name } : {
0 commit comments