diff --git a/bin/config.js b/bin/config.js index 9426beb..ac95805 100644 --- a/bin/config.js +++ b/bin/config.js @@ -19,7 +19,7 @@ module.exports = { }, sso: { authenticator: "http://localhost:8080/api/authenticate", // redirect back to this url; - redirectUser: "https://auth.rxbn.de/authenticate", // sso service + provider: "https://auth.rxbn.de/authenticate", // sso service appId: process.env.APP_ID, // app id appSecret: process.env.APP_SECRET // random token }, diff --git a/bin/sso/module.js b/bin/sso/module.js index 6dda955..cd043ff 100644 --- a/bin/sso/module.js +++ b/bin/sso/module.js @@ -21,7 +21,7 @@ functions.authenticateUser = (obj, callback) => { request({ method: 'POST', - uri: global['gds'].cfg.sso.authenticator, + uri: global['gds'].cfg.sso.provider, headers: { 'Content-Type': 'application/json' }, @@ -55,7 +55,7 @@ functions.createAuthentication = (obj) => { redirectUrl: obj.url, appId: obj.appId }; - return global['gds'].cfg.sso.redirectUser+"?"+querystring.stringify(nUrl); + return global['gds'].cfg.sso.provider+"?"+querystring.stringify(nUrl); }; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/bin/web/auth/routes/api.js b/bin/web/auth/routes/api.js index 91405f9..c8f6cd5 100644 --- a/bin/web/auth/routes/api.js +++ b/bin/web/auth/routes/api.js @@ -1,25 +1,18 @@ var express = require('express'); var route = express.Router(); -route.get('/register', (req, res) => { - if(!global['gds'].cfg.web.registration) { - return res.type('json').status(400).end(JSON.stringify({status: 400, message: "msg.auth.registration.deactivated"})); - } - // TODO: register -}); - route.get('/login', (req, res) => { // TODO: login let a = global['modules'].sso.createAuthentication({ url: global['gds'].cfg.sso.authenticator, appId: global['gds'].cfg.sso.appId - }) - console.log(a); - res.end('login'); + }); + res.redirect(a); }); -route.post('/authenticate', (req, res) => { +route.get('/authenticate', (req, res) => { // TODO: authenticate + res.end(); }); route.get('/logout', (req, res) => {