npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

unfuck-spa-shibboleth-session

v4.1.0

Published

Fixes common shibboleth session related issues for SPAs

Downloads

3,615

Readme

unfuck-spa-shibboleth-session

Fixes common issues related to Shibboleth login in single page applications.

Resolves three types of issues:

  1. User is reading a page, the session expires behind the scenes. Now when the user wants to continue using the site, there will be silent network errors in the console - leaving the user to wonder "why is this not working?"

  2. User is filling out important data to a long form and the session expires. This again, causes a silent failure, which the user might not notice - causing hours of work to be wasted.

  3. User logs out of another Shibboleth service, causing the session to expire. This again, causes a silent error.

How this package fixes these issues:

  1. The session is kept alive by pinging a specific URL behind Shibboleth on a set interval. The session is no longer kept alive, when user leaves the browser tab containing the SPA on the background.

  2. The status of the Shibboleth session is checked regularly. When the session expires, a prompt is displayed and the page gets overlapped by an overlay. Both indicate that the login session has expired. In order to continue working, the user must log back in a new browser window. Successful login is detected automatically, and no progress will be lost. Is the user wishes to actually logout and lose all unsaved progress, he/she is free to do so.

  3. Once again, the status of the Shibboleth session is checked regularly. Importantly, the status of the session is checked immediately, when user re-opens the tab with the single page application.

How to use this package:

  1. Install the package to the frontend of your web-application npm i unfuck-spa-shibboleth-session@latest

  2. Import the initShibbolethPinger -function import { initShibbolethPinger } from 'unfuck-spa-shibboleth-session'

  3. Use the imported function in a useEffect -hook, inside of your root container (App.js).

The initShibbolethPinger -function should be called only once!

Example (App.js):


import { initShibbolethPinger } from  'unfuck-spa-shibboleth-session'

useEffect(() => {
    initShibbolethPinger() // Uses default values, which are typically fine.
}, [])
...

Parameters for initShibbolethPinger

| name | defaultValue | required? | | ------------ | -------------------- | --------- | | pingInterval | 60000 (1 minute) | false | | urlToPing | window.location.href | false |

  • pingInterval - determines how often urlToPing is pinged in order to keep the session alive. Since session validity is also checked while pinging, this also determines how of the session is validated.

  • urlToPing - an URL address in your application, that should be pinged. This parameters needs to be set if your frontend is not located behind Shibboleth.