Skip to content

Commit 5da0e54

Browse files
committed
add provider specefic metadata
1 parent ea30a01 commit 5da0e54

6 files changed

Lines changed: 24 additions & 6 deletions

File tree

OpenFlow/src/LoginProvider.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import * as bodyParser from "body-parser";
77
import * as SAMLStrategy from "passport-saml";
88
import * as GoogleStrategy from "passport-google-oauth20";
99
import * as LocalStrategy from "passport-local";
10+
import * as wsfed from "wsfed";
1011

1112
import * as passport from "passport";
1213
import { Config } from "./Config";
@@ -249,6 +250,11 @@ export class LoginProvider {
249250
strategy.name = key;
250251
this._logger.info(options.callbackUrl);
251252

253+
app.get("/" + key + "/FederationMetadata/2007-06/FederationMetadata.xml",
254+
wsfed.metadata({
255+
cert: Buffer.from(Config.signing_crt, "base64").toString("ascii"),
256+
issuer: Config.saml_issuer + ":" + key
257+
}));
252258
app.use("/" + key,
253259
bodyParser.urlencoded({ extended: false }),
254260
passport.authenticate(key, { failureRedirect: "/" + key, failureFlash: true }),
@@ -262,6 +268,7 @@ export class LoginProvider {
262268
}
263269
}
264270
);
271+
265272
return strategy;
266273
}
267274

OpenFlow/src/SamlProvider.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as winston from "winston";
22
import * as express from "express";
3-
import * as passport from "passport";
3+
// import * as passport from "passport";
44

55
import * as samlp from "samlp";
66
import { Config } from "./Config";
@@ -113,7 +113,7 @@ export class SamlProvider {
113113
issuer: Config.saml_issuer,
114114
cert: cert,
115115
}));
116-
var SessionParticipants = require('samlp/lib/sessionParticipants');
116+
// var SessionParticipants = require('samlp/lib/sessionParticipants');
117117

118118
// https://github.com/mcguinness/saml-idp/blob/master/app.js
119119
// https://www.diycode.cc/projects/auth0/node-samlp
@@ -154,7 +154,5 @@ export class SamlProvider {
154154

155155
});
156156

157-
158-
159157
}
160158
}

OpenFlow/src/public/Controllers.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,7 @@ module openflow {
630630
super($scope, $location, $routeParams, $interval, WebSocketClient, api);
631631
console.debug("ProviderCtrl");
632632
this.collection = "config";
633+
console.log(WebSocketClient);
633634
WebSocketClient.onSignedin((user: TokenUser) => {
634635
if (this.id !== null && this.id !== undefined) {
635636
this.loadData();

OpenFlow/src/public/Provider.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,15 @@ <h1 class="pagetitle" translate lib="web">provider</h1>
6464
</div>
6565
</div>
6666

67+
<div class="form-group" ng-show="ctrl.model.provider=='saml'">
68+
<label for="saml_federation_metadata" class="col-sm-2 control-label" translate lib="web">metadataurl</label>
69+
<div class="col-sm-4">
70+
<pre>https://{{ctrl.WebSocketClient.domain}}/{{ctrl.model.id}}/FederationMetadata/2007-06/FederationMetadata.xml</pre>
71+
<a ng-href="https://{{ctrl.WebSocketClient.domain}}/{{ctrl.model.id}}/FederationMetadata/2007-06/FederationMetadata.xml"
72+
target="_blank">test</a>
73+
</div>
74+
</div>
75+
76+
{{ctrl.WebSocketClient.url}}
6777

6878
</form>

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.0.283
1+
0.0.284

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@
5151
"samlp": "^3.4.0",
5252
"ssl-root-cas": "^1.3.1",
5353
"winston": "^3.2.1",
54-
"ws": "^6.2.1"
54+
"ws": "^6.2.1",
55+
"wsfed": "^4.0.0",
56+
"x509": "^0.3.4"
5557
}
5658
}

0 commit comments

Comments
 (0)