# @psu/sso

> > *[View Change Log](changelog.md)*

Latest version **0.8.2** (published 2021-02-09) · 0 weekly downloads

## Install

```sh
npm install @psu/sso
pnpm add @psu/sso
yarn add @psu/sso
bun add @psu/sso
```

## Health

**Score 10/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.8.2 |
| Published | 2021-02-09 |
| First published | 2018-11-27 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 49.4 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | mjg, bbras |

## Links

- npm: https://www.npmjs.com/package/@psu/sso
- npm.io page: https://npm.io/package/@psu/sso

## Dependencies (2)

- [vue](https://npm.io/package/vue.md) ^2.5.17
- [vuex](https://npm.io/package/vuex.md) ^3.1.0

## Recent versions

- 0.8.2 (latest) — 2021-02-09
- 0.8.1 — 2020-02-12
- 0.8.0 — 2020-02-12
- 0.7.12 — 2019-11-19
- 0.7.11 — 2019-11-05
- 0.7.10 — 2019-10-15
- 0.7.9 — 2019-10-14
- 0.7.8 — 2019-10-14
- 0.7.7 — 2019-10-08
- 0.7.6 — 2019-09-04
- 0.7.5 — 2019-05-29
- 0.7.4 — 2019-05-29
- 0.7.3 — 2019-05-17
- 0.7.2 — 2019-04-29
- 0.7.1 — 2019-04-16
- … 46 more at https://npm.io/package/@psu/sso/versions

## README

# Single Sign On Plugin for PSU

> *[View Change Log](changelog.md)*

## Installation
```
npm install --save @psu/sso
```

## Requirements
**Vuex**
Identity data is stored in the Vuex state. Your app *must* have Vuex installed, and the store made globally available. 
See "Usage" section for details

**Optional**
There are no additional dependencies for the SSO component, ***However***: 
> *  SSO's auto-refresh of JWT expiration only works when making your AJAX requests via jQuery.  Therefore, I recommend using a recent version of jQuery from the Static Content Server:
`https://content.oit.pdx.edu[/nonprod]/wdt/jquery/jquery-3.3.1.js`
> *  When Font-Awesome is available, the development toolbar and the proxy features will look nicer.  I recommend using FontAwesome:
`https://content.oit.pdx.edu[/nonprod]/font-awesome/css/font-awesome.min.css`  

## Usage
1. In `public/index.html` add the ***optional*** jQuery and FontAwesome references:
```
    <script src="https://content.oit.pdx.edu[/nonprod]/wdt/jquery/jquery-3.3.1.js"></script>
    <link rel="stylesheet" href="https://content.oit.pdx.edu/nonprod/font-awesome/css/font-awesome.min.css">
```

2. Create `/src/store` and `/src/store/modules` directories

3. Create `/src/store/index.js` with the following content:
```
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex);
export const store = new Vuex.Store({
	strict: true,
	modules: { }
});
```

4. In `main.js` add/include the following lines:
```
    import { store } from './store'
    import ssoPlugin from '@psu/sso'
    Vue.use(ssoPlugin, {store: store});

    Vue.prototype.$appName = "MY_APP_NAME";  // Your unique app identifier
    Vue.prototype.$envName = "test";         // {local, dev, test, prod}
    
    new Vue({
        store,
        render: h => h(App),
    }).$mount('#app');
```
5. In `App.vue` add the sso component.  ```<sso />```
   >Optional properties:
   >- The title of your application: ```title="My Awesome App"```
   >- Fetch the user's roles?: ```appRoles="Y" ```
   >- Get identity data: ```additionalIdentity="Y" ```
### Environment Names
**`$envName`**: Determines which Finti and SSO environments to use  
   - `prod`: Production instances
   - `test`: Deployed non-production instances
   - `dev`:  Local Finti with deployed non-production SSO-Proxy
   - `local`: Locally-run instances of Finti and SSO-Proxy

## Accessing identity info
Identity info is stored in the Vuex store as "identity".  Use the Vue Devtools browser plugin to see all the available data.

A good way to access the values is to create a computed property to access these values:
```
computed{
    name: function(){
        return this.$store.state.identity.name
    }
},
```

If you need access to other data, checkout the $jwt module with functions that interact directly with the JWT.

## Publishing Changes
To publish changes to this plugin on NPM, you must first have an [NPM account](https://www.npmjs.com/signup).  You must sign into your account on the command line using `npm login`.  You can check to see if you are logged in via `npm whoami`.  You will also need to be added to the @psu scope.

Once you have you npm account in order and you have made your changes to the sso plugin:
1. Be sure to **update the version** in package.json
2. Run the following two commands:
```
cd <rootDirectory>
npm run build-bundle
npm publish --access public
```

## Updating the Installed Plugin
```
npm update @psu/sso
```

---
_Source: https://npm.io/package/@psu/sso · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
