grnet/agora — pull request #51 by skanct (2014-10-26 12:21:57+00:00)
Title: Edugain integration

# WARNING: It should not be merged yet

## Current status:

- passport-saml has been installed as a library and has been modified to use the IdP that is returned from DiscoJuice discovery service
- basic model for the IdPs, using only the entityId and entryPoint. Given an entityId, we find the proper entry point for the SAML2 HTTP-Redirect binding
- The SP has been registered in the Feide OpenIdp with ```entityID: https://127.0.0.1:8081/saml2/entityid```

## Flow:

1. User selects eduGain Sign In
2. User selects one of the IdP in the list
3. User is redirected to the ```redirecturl``` of the SP with the ```idp``` query string parameter set to the entityId of the chosen IdP
4. The SP finds the SAML2 HTTP-Redirect entryPoint, prepares the SAML request and redirects the user to the entry point of the selected IdP with the query string parameter ```SAMLRequest```(GET request)
5. User authenticates on the IdP and is redirected to the SP ```responseurl``` with the ```SAMLResponse``` form data (POST request)
6. The SP decodes the SAML response, prepares a JSON web token and redirects the user to /

## local.json

```
{
"mongo_server": "127.0.0.1",
"mongo_options": {
"db": { "native_parser": true}
},
"mongo_db": "agora_dev",
"ssl_options": {
"ssl_key": "ssl/server.key",
"ssl_cert": "ssl/server.crt",
"secureProtocol": "TLSv1_method"
},
"passport": {
"saml": {
"path": "/saml/login/callback",
"entryPoint": "https://openidp.feide.no/simplesaml/saml2/idp/SSOService.php",
"issuer": "https://127.0.0.1:8081/saml2/entityid"
}
},
"nodejs_port": 8081
}
```

## TODO:

- AngularJS is not aware yet that the user has logged in, when the eduGAIN sign in is used. We need to create a proper user session and pass the information back to angular.
- Check if the user we has an entry in the mongo db. If not, we should add one, if yes we should link the account with the one in the mongodb