Skip to content
GitLab
    • Explore Projects Groups Snippets
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
  • S Spacedeck-open-SAML
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
    • Requirements
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Wolfgang Knopki
  • Spacedeck-open-SAML
  • Merge requests
  • !3

Saml integration

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Wolfgang Knopki requested to merge saml-integration into master 4 years ago
  • Overview 0
  • Commits 4
  • Pipelines 0
  • Changes 7

Add prefix functionality for deployment behind reverse proxy

  • Wolfgang Knopki @knopkiwg mentioned in commit 75b5f79c 4 years ago

    mentioned in commit 75b5f79c

  • Wolfgang Knopki @knopkiwg merged 4 years ago

    merged

  • Loading
  • You're only seeing other activity in the feed. To add a comment, switch to one of the following options.
Please register or sign in to reply
Compare
  • master (base)

and
  • latest version
    a0fb802f
    4 commits, 4 years ago

7 files
+ 99
- 50

    Preferences

    File browser
    Compare changes
con‎fig‎
defaul‎t.json‎ +4 -3
middl‎ewares‎
sessi‎on.js‎ +1 -1
rou‎tes‎
roo‎t.js‎ +51 -2
vi‎ews‎
lay‎outs‎
outer-he‎ader.ejs‎ +6 -7
part‎ials‎
folder‎s.html‎ +4 -4
inde‎x.ejs‎ +1 -1
spaced‎eck.ejs‎ +32 -32
config/default.json
+ 4
- 3
  • View file @ a0fb802f

  • Edit in single-file editor

  • Open in Web IDE


@@ -4,7 +4,7 @@
"host": "::",
"port": 9666,
"endpoint": "http://localhost:9666",
"endpoint": "http://localhost/spacedeck/",
"invite_code": "top-sekrit",
"storage_region": "eu-central-1",
@@ -32,6 +32,7 @@
"mail_smtp_pass": "your.secret.smtp.password",
"path" : "http://localhost:9666/saml/SSO",
"entryPoint" : "https://m4lab.hft-stuttgart.de/idp/saml2/idp/SSOService.php",
"issuer" : "spacedeck.m4lab.hft-stuttgart.de"
"entryPoint" : "https://transfer.hft-stuttgart.de/idp2/saml2/idp/SSOService.php",
"issuer" : "spacedeck_local.m4lab.hft-stuttgart.de",
"logoutUrl": "https://transfer.hft-stuttgart.de/idp2/saml2/idp/SingleLogoutService.php"
}
middlewares/session.js
+ 1
- 1
  • View file @ a0fb802f

  • Edit in single-file editor

  • Open in Web IDE


@@ -35,7 +35,7 @@ module.exports = (req, res, next) => {
else db.User.findOne({where: {_id: session.user_id}})
.then(user => {
if (!user) {
var domain = (process.env.NODE_ENV == "production") ? new URL(config.get('endpoint')).hostname : req.headers.hostname;
var domain = (process.env.NODE_ENV == "production") ? new URL(config.get("endpoint")).hostname : req.headers.hostname;
res.clearCookie('sdsession', { domain: domain });
if (req.accepts("text/html")) {
routes/root.js
+ 51
- 2
  • View file @ a0fb802f

  • Edit in single-file editor

  • Open in Web IDE


@@ -32,6 +32,7 @@ const uuidv4 = require('uuid/v4');
var samlStrategy = new SamlStrategy({
// URL that goes from the Identity Provider -> Service Provider
callbackUrl: config.path,
logoutUrl: config.logoutUrl,
entryPoint: config.entryPoint,
issuer: config.issuer,
@@ -148,7 +149,7 @@ router.post('/saml/SSO', passport.authenticate('saml', { failureRedirect: '/logi
res.redirect(500, "/");
})
.then(() => {
var domain = (process.env.NODE_ENV == "production") ? new URL(config.get('endpoint')).hostname : req.headers.hostname;
var domain = (process.env.NODE_ENV == "production") ? new URL(config.get("endpoint")).hostname : req.headers.hostname;
console.log("session set successfully");
res.cookie('sdsession', token, { domain: domain, httpOnly: true });
res.redirect(302, "/")
@@ -245,10 +246,58 @@ router.get('/login', passport.authenticate('saml',
// res.render('spacedeck', { config:config, user:req.user });
//});
function samlLogout(req,res){
console.log("enter samlLogout")
try{
samlStrategy.logout(req, function(err,uri){
if(err) console.log("can't generate logout URL: ${err}");
req.logout();
var token = req.cookies['sdsession'];
db.Session.findOne({where: {token: token}})
.then(session => {
session.destroy();
});
var domain = (process.env.NODE_ENV == "production") ? new URL(config.get("endpoint")).hostname : req.headers.hostname;
res.clearCookie('sdsession', { domain: domain });
console.log("clear Cookie")
res.redirect(uri);
});
}catch(err){
if(err) console.log(`Exception on URL: ${err}`);
req.logout();
var token = req.cookies['sdsession'];
db.Session.findOne({where: {token: token}})
.then(session => {
session.destroy();
});
var domain = (process.env.NODE_ENV == "production") ? new URL(config.get("endpoint")).hostname : req.headers.hostname;
res.clearCookie('sdsession', { domain: domain });
console.log("clear Cookie on error")
res.redirect("/login");
}
}
router.get('/logout', (req, res) => {
res.render('spacedeck', { config:config, user:req.user });
console.log("logout pressed")
if (req.user == null) {
console.log("req.user == null");
return res.redirect('/');
}
samlLogout(req,res);
});
router.get('/saml/SLO', (req, res, next) => {
console.log("received logout request");
var token=req.cookies['sdsession'];
if(token) {
return next();
} else {
return res.redirect('/'); //best be landing page of everything
}
},
samlLogout
);
router.get('/t/:id', (req, res) => {
res.cookie('spacedeck_locale', req.params.id, { maxAge: 900000, httpOnly: true });
var path = "/";
views/layouts/outer-header.ejs
+ 6
- 7
  • View file @ a0fb802f

  • Edit in single-file editor

  • Open in Web IDE


@@ -7,22 +7,21 @@
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<link href="/images/favicon.png" rel="icon" type="image/x-icon" />
<link rel="stylesheet" href="/stylesheets/style.css">
<link href="<%= config.endpoint %>/images/favicon.png" rel="icon" type="image/x-icon" />
<link rel="stylesheet" href="<%= config.endpoint %>/stylesheets/style.css">
</head>
<body>
<header id="landing-header" class="header">
<div class="header-left">
<a class="btn btn-transparent btn-nude" href="<%= config.endpoint %>/"><img src="/images/sd6-logo-black.svg" width="190"></a>
<a class="btn btn-transparent btn-nude" href="<%= config.endpoint %>/"><img src="<%= config.endpoint %>/images/sd6-logo-black.svg" width="190"></a>
</div>
<div class="header-right pull-right">
<% if (!user) { %>
<a class="btn btn-md btn-dark btn-round" href="/login"><%=__("login")%></a>
<a class="btn btn-md btn-dark btn-round" href="/signup"><%=__("signup")%></a>
<a class="btn btn-md btn-dark btn-round" href="<%= config.endpoint %>/login"><%=__("login")%></a>
<% } else { %>
<a class="btn btn-md btn-dark btn-round" href="/spaces"><%=__("spaces")%></a>
<a class="btn btn-md btn-dark btn-round" href="/logout"><%=__("logout")%></a>
<a class="btn btn-md btn-dark btn-round" href="<%= config.endpoint %>/spaces"><%=__("spaces")%></a>
<a class="btn btn-md btn-dark btn-round" href="<%= config.endpoint %>/logout"><%=__("logout")%></a>
<% } %>
</div>
views/partials/folders.html
+ 4
- 4
  • View file @ a0fb802f

  • Edit in single-file editor

  • Open in Web IDE


@@ -71,11 +71,11 @@
</a>
</li>
<li v-on:click="logout()">
<span>
<li>
<a href="/">
<span class="icon icon-sm icon-logout"></span>
<span><%= __('log_out') %></span>
</span>
<span>Start</span>
</a>
</li>
</ul>
</div>
Assignee
Wolfgang Knopki's avatar
Wolfgang Knopki
Assign to
0 Reviewers
None
Request review from
Labels
0
None
0
None
    Assign labels
  • Manage project labels

Milestone
No milestone
None
None
Time tracking
No estimate or time spent
Lock merge request
Unlocked
1
1 participant
Wolfgang Knopki
Reference: knopkiwg/spacedeck-open-saml!3
Source branch: saml-integration

Menu

Explore Projects Groups Snippets

Dies ist die Gitlab-Instanz des Transferportals der Hochschule für Technik Stuttgart. Hier geht es zurück zum Portal