1.1.9 • Published 6 months ago

uconn-sso-client v1.1.9

Weekly downloads
-
License
ISC
Repository
-
Last release
6 months ago

uconn-sso-client

by Matt Beauvais

Installation

Install the package via npm: npm install uconn-sso-client

Then import it in your code:

import  UconnCasClient  from  'uconn-sso-client';

Usage

const casClient = new UconnCasClient
casClient.auth()
  .then(async (netID: string) => {
    // success!
    console.log(netID)
    // do whatever you need to do
 })
  .catch((error: any) => {
    // failure!
    console.log("NetID Auth Failed")
    // handle error
})

You wil need to run the auth function twice. The first call to auth will redirect the user to the NetID sign in page to enter their credentials (or, if the person already has signed into NetID before, this will be skipped). They will then be redirected back to your app with a service and ticket parameter in the url. The second time should be run after the redirect when the ticket and service and supplied in your URL, this time the function will validate the ticket with UCONN's server. An example of this is with a useEffect in react to automatically run the function again if the ticket and service params are supplied on whatever page you handle logging in on:

useEffect(() => {
    // code to run after render goes here
    const queryParameters = new URLSearchParams(window.location.search);
    if (queryParameters.get("ticket") && queryParameters.get("status")) {
      // call your auth function
    }
  }

Notes

This is still a very early version, so I will work to improve this to make it easier to use and also better handle any sort of failures. I am also open to any PR's

Resources

See: https://iam.uconn.edu/the-cas-protocol-for-application-owners/ for UCONN's overview of CAS. You should have a basic understanding on how this works before using this module

1.1.9

6 months ago

1.1.8

6 months ago

1.1.7

6 months ago

1.1.6

6 months ago

1.1.5

6 months ago

1.1.4

6 months ago

1.1.3

7 months ago

1.1.2

7 months ago

1.1.1

7 months ago

1.1.0

7 months ago

1.0.9

7 months ago

1.0.7

7 months ago

1.0.6

7 months ago

1.0.5

7 months ago

1.0.4

7 months ago

1.0.3

7 months ago

1.0.2

7 months ago

1.0.1

7 months ago

1.0.0

7 months ago