-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
331 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,17 @@ | ||
# User Authentification and role management REST Webservice | ||
|
||
## Description | ||
|
||
Usr provides you a webservice to authenticate and manage your users with a REST API : | ||
|
||
- Using EveryAuth to enable your users to login with any credentials | ||
- Using REST to be shared within multiples service. | ||
|
||
## Authentification of a user : | ||
|
||
1/ You deploy your service to auth.yourdomain.com | ||
2/ On your application, to authentificate a user, just need to : | ||
- redirect the user to http://auth.yourdomain.com/login/http://mynewapp.com/loguedId/ | ||
- The user will come back to http://mynewapp.com/loguedId/SUPERTOKEN with a token | ||
- Send a request to get all the details about your user. | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
express = require 'express' | ||
$ = require 'jquery' | ||
|
||
app = express.createServer( | ||
express.bodyParser(), | ||
express.favicon(), | ||
express.cookieParser(), | ||
express.session({ secret: 'supersecret'}), | ||
) | ||
|
||
myAppUrl = 'http://127.0.0.1:3001' | ||
usrAppToken = 'lalalal' | ||
usrUrl = "http://local.host:3000" | ||
|
||
|
||
app.get('/', (req, res)-> | ||
if req.session.user | ||
user = req.session.user | ||
res.send("Welcome : #{user.id}, you are in the groups : #{user.groups.join(',')}<a href='/logout/'>logout</a>") | ||
else | ||
res.send("<a href='#{usrUrl}/login/#{myAppUrl}/logguedIn/'>login</a>") | ||
) | ||
|
||
app.get('/logout', (req, res)-> | ||
delete(req.session.user) | ||
res.redirect(usrUrl+"/logout/#{myAppUrl}") | ||
) | ||
|
||
app.get('/logguedIn/:token', (req, res)-> | ||
url = usrUrl+"/info/#{req.params.token}/#{usrAppToken}" | ||
$.getJSON(url,(datas)-> | ||
req.session.user = datas | ||
res.redirect('/') | ||
) | ||
) | ||
|
||
app.listen(3001) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
require('coffee-script') | ||
module.exports = require('./lib/exec.coffee'); | ||
module.exports = require('./lib/app'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.