Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mattapperson/hapi-saml
https://github.com/mattapperson/hapi-saml
Last synced: 7 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/mattapperson/hapi-saml
- Owner: mattapperson
- Created: 2017-07-19T20:17:42.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-07-19T20:18:04.000Z (over 7 years ago)
- Last Synced: 2024-11-07T16:18:36.669Z (about 2 months ago)
- Language: JavaScript
- Size: 28.3 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# hapi-saml-sso
![Logo](https://bytebucket.org/archik/hapi-saml-sso/raw/7a19b50d275bf1fb85499f67f5b913ba6e4f76aa/media/logo.png)
> hapi-saml-sso is a [hapi.js](https://hapijs.com/) plugin, it will use the [passport-saml](https://github.com/bergie/passport-saml) library and provide possibility to implement Single Sign On in your app using SAML protocol
## Notes
This plugin based on [passport-saml](https://github.com/bergie/passport-saml).
Please, check original repository and specs for clear understanding.
## Getting Started
```
npm install hapi-saml-sso --save
```Add the plugin into your app and set following options:
```javascript
const Hapi = require('hapi');
const server = new Hapi.Server();const plugins = [
{
register: require('hapi-saml-sso'),
options: {
callbackUrl: 'https://your-app.com/callback',
host: 'your-app.com',
protocol: 'https',
path: '/callback',
signatureAlgorithm: 'sha1',
entryPoint: 'https://your-saml-identity-provider',
issuer: 'https://your-saml-service-provider',
cert: 'yourCertificate',
decryptionCert: 'test',
decryptionPvk: true}
}
];server.connection({ port: 8000 });
server.register(plugins, (err) => {
if (err) {
throw err;
}
server.start((err) => {if (err) {
throw err;
}
console.log(`Server running at: ${server.info.uri}`);
});
});```
Plugin provide following SSO API:
```
GET /saml/metadata.xml
GET /saml/login
GET /saml/logout
```Also plugin has already implemented SSO callback
```
POST /saml/callback
```For correct work you have to implement on your side [hapi server method](https://hapijs.com/tutorials/server-methods)
that called `request.server.methods.login`, it will use `Profile.nameID` for identify specific user.
On client side you can check local storage variable `SAMLLoggedIn` for auth detecting.Otherwise You can use your callback implementation.
For understanding options check following links:
+ [SAML](https://en.wikipedia.org/wiki/Security_Assertion_Markup_Language)
+ [IDP](https://en.wikipedia.org/wiki/Identity_provider)
+ [Web Browser SSO](https://en.wikipedia.org/wiki/Single_sign-on)## Credits
+ [Peter Loer](https://github.com/ploer/passport-saml)
## Spec references
* [OASIS](http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html)
* [SAML](http://saml.xml.org)## License
Copyright (c) 2016 archik
Licensed under the MIT license.