How long the amazon Connect & Hubspot session cookie last in visitor browser? - hubspot

I have got to know that Amazon Connect sessions (cookies) expire 10 hours after a user logs in form Here I just want to know the exact duration of expiration from my browser's cookies e.g. max-age of my cookie!! as if i look at the cookies of my browser it is telling that the JSESSIONID ends when the browsing session ends
The question is when browsing session ends? at the time of closing the browser?
The same with hubspot:
if we look at browser's cookies it shows 90 days but Here i have found that i lasts only for 14 days.

Related

How to find session cookie when not found in the developer tools?

I want to automate requests on a website and when doing so, I need a session cookie in order to identify myself.
When checking the network tab, I can clearly see the session cookie, but when checking the Application tab, this cookie is not shown. After accessing this website with selenium and calling driver.get_cookies() with Python, I only get the cookies shown in the Application tab.
I need to do this with selenium because this way it's possible to login. Only using requests will not work.
I do not have many clues on how to get that cookie and have almost 0 experience in this field, hence my question.

How to make selenium cookies not expire? (python)

I'm using Selenium on Python 3, to perform automated actions on an internal webpage on Chrome v81 browser, where google authentication (logging into gmail) is required.
Getting cookies (after manually logging in):
pickle.dump(driver.get_cookies(), open(path_to_cookie, 'wb'))
Using cookies:
driver.get(url)
cookies = pickle.load(open(path_to_cookie, "rb"))
for cookie in cookies:
if 'expiry' in cookie:
del cookie['expiry']
driver.add_cookie(cookie)
time.sleep(2)
driver.get(url)
Problem:
The cookies are stored in a pickle file. There are 2 types of cookies - csrftoken and sessionid.
The sessionid one typically expires in 2 weeks, and even if i change the expiry date of the cookies in the json (in the cookies.pkl file), it will still expire after 2 weeks (and when i run the script it shows the gmail login page).
I've tried using user-data-dir and chrome profile (a duplicate of my existing chrome profile). It works, but the same problem still happens and i need to relogin again after 2 weeks. Any idea how i can make the cookies last for e.g months / a year instead of 2 weeks?

Ephemeral & MaxAge for express-session

I am trying to use the express-session package for session management in an express-js application.
I have the following requirements:
Cookie is destroyed client-side when browser is closed.
Cookie is destroyed after 15 minutes idle time.
Cookie is destroyed after 3 hours since creation (regardless of activity).
(Numbers are just examples).
I can deal with the idle time by manipulating the cookie maxAge up to a maximum. However, when I read the express-session documentation, I see:
By default cookie.maxAge is null, meaning no "expires" parameter is
set so the cookie becomes a browser-session cookie. When the user
closes the browser the cookie (and session) will be removed.
So, how do I create a "browser-session" cookie that also has a maxAge (used for idle/absolute timeout)?
I have also investigated using node-client-session package, but it does not allow for ephemeral and maxAge.
I have done an implementation of this after finding this question and wanting to have both a session timeout and ephemeral sessions. Here is what I have done to make this work in an actual application.
I use maxAge in my express-session configuration, and then in my client / web app code I hook the browser event "onbeforeunload". onbeforeunload info
It's not foolproof, and has some browser quirks, but when onbeforeunload fires, I use it to send an ajax request to the server to "logout" and kill the session.
It's important to now ask yourself what doing this does to the user experience (UX) and expected behavior of the session experience. If you want an ephemeral session, then it would be for a specific application in which you want something to be available as long as the browser is open. This could be accomplished with a short session age as well. We have to think about what the purpose of implementing this would be.

User is not forced to reauthenticate in ADFS 2.0 after Sharepoint 2010 session expires

This case is very much similar to question by Wiktor Zychla, see How to set the timeout properly when federating with the ADFS 2.0
We are experiencing the same behavior, ADFS happily redirects the user back to Sharepoint site and FedAuth cookie is recreated, even though ADFS should prompt for credentials - we want the user to reauthenticate after some period of idle time. Basically it looks like the session is always sliding.
We have disabled persistent cookies, so the FedAuth cookie is removed when session is ended by closing the browser, so the user is forced to reauthenticate after all browser windows are closed and a new session is started, so that works.
As far as I understand the Web SSO lifetime setting in ADFS Snap-in controls the time after which the user should need to re-authenticate on AD FS (enter his credentials again). Tokenlifetime and LogonTokenCacheExpirationWindow together control, when Sharepoint should redirect back to AD FS to in order to renew FedAuth cookie.
Following is a quote from http://msdn.microsoft.com/en-us/library/hh446526.aspx :
To force users to re-enter their credentials whenever they are redirected back to ADFS, you should set the web SSO lifetime in ADFS to be less than or equal to SAMLtokenlifetime minus the value of LogonTokenCacheExpirationWindow.
So, we have done following:
1. Setting the lifetime of SAML token
Add-PSSnapin Microsoft.ADFS.PowerShell
Set-AdfsRelyingPartyTrust –TargetName "[ourrelayingpartytrustreference]" –TokenLifeTime 7
2. Setting LogonTokenCacheExpirationWindow (and disabling persistent cookies)
Add-PSSnapin Microsoft.SharePoint.Powershell -EA 0
$sts = Get-SPSecurityTokenServiceConfig
$sts.UseSessionCookies = $true
$sts.LogonTokenCacheExpirationWindow = (New-Timespan -Minutes 1)
$sts.Update()
iisreset
3. Adjusted Web SSO lifetime: 5 minutes in AD FS 2.0 Management console snapin (running Get-ADFSProperties in Powershell correctly returns SsoLifetime: 5)
Thus the expected outcome is:
User starts a fresh new session, requests the web site
Browser is redirected to AD FS, user enter credentials, and browser is redirected back to Sharepoint site, FedAuth cookie is generated
User remains idle for 10 minutes (to make sure that session sliding period has passed)
User requests another page in Sharepoint, browser is redirected to AD FS
Since Web SSO lifetime was 5 minutes, and it was, as in msdn documentation instructs, less than SAMLtokenlifetime minus the value
of LogonTokenCacheExpirationWindow (SAMLtokenlifetime -
LogontokenCacheExpirationWindow = 6 minutes), AD FS prompts the user
for credentials, user enters credentials, and browser is redirected
to Sharepoint page requested and FedAuth cookie is recreated.
Current actual behavior (steps 1-4 similar):
(5.) AD FS does not prompt for credentials, browser is redirected to Sharepoint page and FedAuth cookie is recreated.
So - for us it looks like AD FS session never expires, no matter what we do.
If we create a false configuration of setting LogonTokenCacheExpirationWindow value higher than SAMLtokenlifetime (e.g. LogonTokecacheExpirationWindow = 8 and SAMLtokenlifetime = 7), we get the expected behavior of loop between Sharepoint and AD FS.
We are desperately seeking for a solution to properly expire the session, if user has remained idle for some period of time.
We also tried following configuration change (as per the guidance at http://social.msdn.microsoft.com/Forums/en-US/Geneva/thread/802b1bb6-cda3-4470-a0d1-ee709d5c4b7c/):
Set-ADFSProperties -SsoLifetime 1
Set-ADFSProperties -ReplayCacheExpirationInterval 1
Set-ADFSProperties -SamlMessageDeliveryWindow 1
No Global.asax changes yet made.
As far as I understand, we have configured everything according to the documentation, however we cannot force the user to reauthenticate. Any help pointing out the error in configuration is appreciated.
Apologies if you have already done this, but be sure you have restarted AD FS after making the websso changes. We did not get our expected results until we restarted the services. Also, if you have a proxy, may want to restart that as well.
Do you have any pieces of infrastructure that are rewriting the cookies?

Cookie based authentication across subdomains

I'm building a central authentication service(auth.xyz.com), similar to what Google has on accounts.google.com. I have multiple applications, each running on a different subdomain(app1.xyz.com, app2.xyz.com) which will be integrating with my auth service.
I am currently following a cookie based system, written on ".xyz.com" domain, so that it is readable by all the subdomains.
My problem is that I cant figure how to handle the cookie expiry. If the user logs in at time t, and spends 45 mins on app1.xyz.com, and then goes to app2.xyz.com, I dont want him to have to login again. Also, if the user logs in on app1.xyz.com and is then idle for 45 mins, and then hits app2.xyz.com, I want him to have to relogin. How can I achieve this?
I dont want to touch the auth server on every request I get on app1 or app2.
I do not think that is really possible.If that is the case, there will be a security hole in the entire flows of the applications.An cookie expired user can still access the resources on server app1 and app2 without authentication or some other trusted mechanism!.