# @maderaunified/musd-saml

> Madera Unified SAML Implementation

Latest version **3.0.2** (published 2019-10-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @maderaunified/musd-saml
pnpm add @maderaunified/musd-saml
yarn add @maderaunified/musd-saml
bun add @maderaunified/musd-saml
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.2 |
| Published | 2019-10-07 |
| First published | 2019-05-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 10 |
| Unpacked size | 38.9 KB |
| Known vulnerabilities | 0 (+7 in 3 direct dependencies) |
| Install scripts | no |
| Maintainers | maderaunified |
| Keywords | musd, musd-saml, package, adrianoceguera |

## Links

- npm: https://www.npmjs.com/package/@maderaunified/musd-saml
- Repository: https://github.com/adrianoceguera/musd-saml
- Homepage: https://github.com/adrianoceguera/musd-saml#readme
- Issues: https://github.com/adrianoceguera/musd-saml/issues
- npm.io page: https://npm.io/package/@maderaunified/musd-saml

## Dependencies (10)

- [mssql](https://npm.io/package/mssql.md) ^5.1.0
- [dotenv](https://npm.io/package/dotenv.md) ^8.1.0
- [cookies](https://npm.io/package/cookies.md) ^0.7.3
- [express](https://npm.io/package/express.md) ^4.17.0
- [passport](https://npm.io/package/passport.md) 0.3.2
- [jsonwebtoken](https://npm.io/package/jsonwebtoken.md) ^8.5.1
- [passport-saml](https://npm.io/package/passport-saml.md) 0.15.0
- [activedirectory](https://npm.io/package/activedirectory.md) ^0.7.2
- [express-session](https://npm.io/package/express-session.md) 1.13.0
- [passport-google-oauth](https://npm.io/package/passport-google-oauth.md) ^2.0.0

## Recent versions

- 3.0.2 (latest) — 2019-10-07
- 3.0.1 — 2019-10-07
- 3.0.0 — 2019-10-03
- 2.1.6 — 2019-08-27
- 2.1.5 — 2019-08-27
- 2.1.4 — 2019-08-27
- 2.1.3 — 2019-08-27
- 2.1.2 — 2019-08-27
- 2.0.3 — 2019-08-26
- 2.0.2 — 2019-08-23
- 2.0.1 — 2019-08-23
- 2.0.0 — 2019-06-13
- 1.1.2 — 2019-06-13
- 1.1.1 — 2019-06-13
- 1.1.0 — 2019-06-13
- … 19 more at https://npm.io/package/@maderaunified/musd-saml/versions

## README

# @maderaunified/musd-saml

Madera Unified SAML Implementation

## Install

```
$ npm install @maderaunified/musd-saml
```

## Usage

```js
const musdSAML = require("@maderaunified/musd-saml");

const app = express();

// Express Setup

musdSAML.init( app );

// Create Server, etc.
```

## Methods
### init( app, [userModel] )
Use init to instantiate all routes and initiate SAML strategies. Profile is object returned to service provider. Application can define it's own object to send to the client

```js
const userModel = ( profile, done ) => 
    done( null, {
        email          : profile.nameID,
        employeeType   : profile.employeeType,
        employeeNumber : profile.employeeNumber
    } );

musdSAML.init( app, userModel );
```

### isAuth( req )
Returns boolean value as to whether the user is logged in
```js
router.get(
    '/route',
    ( req, res ) => {
        if ( isAuth( req ) ) {
            res.render(
                config.routes.appView,
                {
                    user : req.user
                }
            );
        }
        else {
            res.render(
                config.routes.appView,
                {
                    user : null
                }
            );
        }
    }
);
```

## Environment Variables
#### Required
- APP_ROUTE - Home page route for application ( Can be url if API and Client are separate )
    - default : '/'
- SAML_ISSUER - Accessing URL. Change to be application specific
    - default : 'https://localhost.madera.k12.ca.us:3000'
- HOST - URL for callback
    - default : 'localhost.madera.k12.ca.us:3000'
- PROTOCOL - Protocol for callback
    - default - http://
- KEY_PATH - local path to Madera Certificate Key 
- PUB_KEY_PATH - local path to Madera Public Certificate
- LDAP_PATH - URL to Madera AD Server
- LDAP_BASEDN - BASE DN for Madera LDAP Server
- LDAP_USERNAME - User with access to Madera LDAP Server
- LDAP_PASSWORD - Password for user to Madera LDAP Server
    
#### Optional
- APP_VIEW - view to load for app route
    - default : 'index'
- LOGIN_ROUTE - Route for login. Recommend not change
    - default : '/login'
- LOGOUT_ROUTE - Route used for logout. Recommend not change
    - default : '/logout'
- USER_ROUTE - Route to access user information
    - default : '/user'
- USER_VIEW - View to load for user route
    - default : 'user'

- SAML_PATH - Callback point for SAML provider. Recommend not change
    - default : '/login/callback'
- SAML_ENTRY_POINT - Identity Provider Entry Point. Recommend not change
    - default : 'https://selfservice.madera.k12.ca.us/idp/profile/SAML2/Redirect/SSO'
- SAML_LOGOUT_URL - Identity Provider Logout Point. Recommend not change
    - default : 'https://selfservice.madera.k12.ca.us/idp/logout'
- IDENTIFIER_FORMAT - nameID format. Recommend not change
    - default : 'urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified'

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