top of page
Search
bahobmata1988

Session sync between two web apps on the same domain: Challenges and solutions for cross-application



I have two web applications in an app suite, both running NodeJs on the same server. I want a user to log into one and be automatically signed in on the other. I recognize that I could send a GET request with all necessary data, but I would rather just automatically sync cookies. If I use express-session to give cookies the same secret key on both apps, can they share cookies? If not, what is the best and most secure way to transfer cookies from one site to another?




Session sync between two web apps on the same domain



Two separate node.js apps would have two separate express-session instances. You would have to store session data in a common, shared database for two separate servers to be able to access the same session data.


Laravel could load a Drupal page such as /session-check?token=12345. Drupal would recognise this token (using a shared db value, shared app secret, or private SSL key perhaps?) and log the user into Drupal, if not already. Otherwise it would just refresh the (Drupal) session lifetime. Thus sessions in both systems would initiate at pretty much the same moment, and stay fresh for the same timeframe. In all other respects the sessions would be independent, and entirely native to their original system.


I was originally under the impression a small token lifetime was 5-10 seconds, and I used that range for testing my synchronization code originally. After reading the Auth0 docs again, I raised the token lifetime and instead, posted this question. It makes sense to use checkSession when the session expires, just not when synchronizing authentications.


Single sign-on (SSO) provides a more seamless experience by reducing the number of times a user is asked for credentials. Users enter their credentials once, and the established session can be reused by other applications on the same device without further prompting.


In this case, application instances in different browser tabs make use of the same MSAL cache, thus sharing the authentication state between them. You can also use MSAL events for updating application instances when a user logs in from another browser tab or window. For more information, see: Syncing logged in state across tabs and windows


When a user authenticates, a session cookie is set on the Azure AD domain in the browser. MSAL.js relies on this session cookie to provide SSO for the user between different applications. In particular, MSAL.js offers the ssoSilent method to sign-in the user and obtain tokens without an interaction. However, if the user has multiple user accounts in a session with Azure AD, they're then prompted to pick an account to sign in with. As such, there are two ways to achieve SSO using ssoSilent method.


By default, ChromeOS Certificate Authority (CA) certificates are not synchronized to Android apps. To make them available to Android apps, select Enable usage of ChromeOS CA certificates in Android apps.


This setting has no effect on the Google Drive Android app on ChromeOS. To completely disable any syncing to Google Drive, configure this policy and do not allow the Google Drive Android app to be installed on supported ChromeOS devices. For details, see Deploy Android apps to managed users on ChromeOS devices.


In the case of Android apps running on ChromeOS, even if you choose Unrestricted user access (allow any user to be added to any other user's session), only the primary user can use Android apps. If you choose Managed user must be the primary user (secondary users are allowed), Android apps can be used in the primary user as long as the device supports Android apps and you have enabled them in your organization.


If a policy is on the list and there is conflict between sources with the same scope and level, the values merge into a new policy. If there is conflict between sources with different scopes or levels, the policy with the highest priority applies.


If the policy is enabled, when Chrome Browser is closed background apps and the current browsing session remain active, including any session cookies. The user can close it at any time using the icon displayed in the system tray.


If you select Allow Wi-Fi network configurations to be synced across Google Chrome OS devices and a connected Android phone, users can sync Wi-Fi network configurations between their Chrome OS devices and a connected Android phone. However, users must first explicitly opt-in to this feature by completing a setup flow.


Web applications can query the system for the size of the storage space currently used and available for applications. Google Chrome maintains separation between temporary and persistent storage and allows Web apps to request more storage space, if needed.


Turning Chrome management off and on again might cause some users to experience changes to their account. Before you turn it on again, inform your users. While Chrome management was turned off, users might have signed in as unmanaged users. When the setting is turned back on again, Android apps might be removed or users might no longer be able to sign in multiple people at the same time on ChromeOS devices.


If you have created multiple domains, each domain must reference its own database schema. You cannot share a configured resource or subsystem between domains. For example, if you create a JDBC data source in one domain, you cannot use it with a Managed Server or cluster in another domain. Instead, you must create a similar data source in the second domain. Furthermore, two or more system resources cannot have the same name.


Policy responses provide the ability to insert information into a session and pull it back out at any later point. This is more robust and flexible than Oracle Access Manager 12c, which provided data passage to (and between) applications by redirecting to URLs in a specific sequence.


Implementing sticky sessions is up to the underlying router configuration. Thedefault HAProxy template implements sticky sessions using the balance sourcedirective, which balances based on the source IP. In addition, the templaterouter plug-in provides the service name and namespace to the underlyingimplementation. This can be used for more advanced configuration, such asimplementing stick-tables that synchronize between a set of peers.


In addition, the templaterouter plug-in provides the service name and namespace to the underlyingimplementation. This can be used for more advanced configuration such asimplementing stick-tables that synchronize between a set of peers.


The source load balancing strategy does not distinguishbetween external client IPaddresses; because of the NAT configuration, the originating IP address(HAProxy remote) is the same. Unless the HAProxy router is running withhostNetwork: true, all external clients will be routed to a single pod.


leastconn: The endpoint with the lowest number of connections receives therequest. Round-robin is performed when multiple endpoints have the same lowestnumber of connections. Use this algorithm when very long sessions areexpected, such as LDAP, SQL, TSE, or others. Not intended to be usedwith protocols that typically use short sessions such as HTTP.


A consequence of this behavior is that if you have two routes for a host name: anolder one and a newer one. If someone else has a route for the same host namethat they created between when you created the other two routes, then if youdelete your older route, your claim to the host name will no longer be in effect.The other namespace now claims the host name and your claim is lost.


What is important to mention here, is that session replication is only the beginning of clustering. Another popular concept used to implement clusters is farming, i.e., you deploy your apps only to one server, and the cluster will distribute the deployments across the entire cluster. This is all capabilities that can go into with the FarmWarDeployer (s. cluster example at server.xml)


One of the most important performance considerations is the synchronous versus asynchronous replication. In a synchronous replication mode the request doesn't return until the replicated session has been sent over the wire and reinstantiated on all the other cluster nodes. Synchronous vs. asynchronous is configured using the channelSendOptions flag and is an integer value. The default value for the SimpleTcpCluster/DeltaManager combo is 8, which is asynchronous. See the configuration reference for more discussion on the various channelSendOptions values.


You can read more on the send flag(overview) or the send flag(javadoc). During async replication, the request is returned before the data has been replicated. async replication yields shorter request times, and synchronous replication guarantees the session to be replicated before the request returns.


The JvmRouteBinderValve rewrites the session id to ensure that the next request will remain sticky (and not fall back to go to random nodes since the worker is no longer available) after a fail over. The valve rewrites the JSESSIONID value in the cookie with the same name. Not having this valve in place, will make it harder to ensure stickiness in case of a failure for the mod_jk module.


The default tomcat cluster supports farmed deployment, ie, the cluster can deploy and undeploy applications on the other nodes. The state of this component is currently in flux but will be addressed soon. There was a change in the deployment algorithm between Tomcat 5.0 and 5.5 and at that point, the logic of this component changed to where the deploy dir has to match the webapps directory. For more info, Please visit the reference documentation


When TomcatB starts up, it follows the same sequence as TomcatA did with one exception. The cluster is started and will establish a membership (TomcatA, TomcatB). TomcatB will now request the session state from a server that already exists in the cluster, in this case TomcatA. TomcatA responds to the request, and before TomcatB starts listening for HTTP requests, the state has been transferred from TomcatA to TomcatB. In case TomcatA doesn't respond, TomcatB will time out after 60 seconds, issue a log entry, and continue starting. The session state gets transferred for each web application that has distributable in its web.xml. (Note: To use session replication efficiently, all your tomcat instances should be configured the same.) 2ff7e9595c


1 view0 comments

Recent Posts

See All

コメント


bottom of page