@boxyhq/saml-jackson 0.1.5-beta.91 → 0.1.5-beta.93

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/saml/saml.js +15 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boxyhq/saml-jackson",
3
- "version": "0.1.5-beta.91",
3
+ "version": "0.1.5-beta.93",
4
4
  "license": "Apache 2.0",
5
5
  "description": "SAML 2.0 service",
6
6
  "main": "src/index.js",
package/src/saml/saml.js CHANGED
@@ -141,12 +141,20 @@ module.exports = {
141
141
  let X509Certificate = null;
142
142
  let ssoPostUrl = null;
143
143
  let ssoRedirectUrl = null;
144
+ let loginType = 'idp';
144
145
 
145
- const ssoDes = rambda.pathOr(
146
- [],
146
+ let ssoDes = rambda.pathOr(
147
+ null,
147
148
  'EntityDescriptor.IDPSSODescriptor',
148
149
  res
149
150
  );
151
+ if (!ssoDes) {
152
+ ssoDes = rambda.pathOr([], 'EntityDescriptor.SPSSODescriptor', res);
153
+ if (!ssoDes) {
154
+ loginType = 'sp';
155
+ }
156
+ }
157
+
150
158
  for (const ssoDesRec of ssoDes) {
151
159
  const keyDes = ssoDesRec['KeyDescriptor'];
152
160
  for (const keyDesRec of keyDes) {
@@ -157,7 +165,10 @@ module.exports = {
157
165
  }
158
166
  }
159
167
 
160
- const ssoSvc = ssoDesRec['SingleSignOnService'] || [];
168
+ const ssoSvc =
169
+ ssoDesRec['SingleSignOnService'] ||
170
+ ssoDesRec['AssertionConsumerService'] ||
171
+ [];
161
172
  for (const ssoSvcRec of ssoSvc) {
162
173
  if (
163
174
  rambda.pathOr('', '$.Binding', ssoSvcRec).endsWith('HTTP-POST')
@@ -188,6 +199,7 @@ module.exports = {
188
199
  if (ssoRedirectUrl) {
189
200
  ret.sso.redirectUrl = ssoRedirectUrl;
190
201
  }
202
+ ret.loginType = loginType;
191
203
 
192
204
  resolve(ret);
193
205
  }