Skip to content

Commit

Permalink
test(saml): fix test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
kdhttps committed Nov 22, 2023
1 parent ac45306 commit 7ec9342
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 13 deletions.
20 changes: 10 additions & 10 deletions config/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ const passportConfigAuthorizedResponse = {
displayName: 'saml only 1',
type: 'saml',
mapping: 'saml_ldap_profile',
passportStrategyId: 'passport-saml',
passportStrategyId: '@node-saml/passport-saml',
enabled: true,
callbackUrl:
'https://chris.gluuthree.org/passport/auth/saml' +
'/saml-only-1/callback',
requestForEmail: false,
emailLinkingSafe: false,
options: {
skipRequestCompression: 'True',
skipRequestCompression: true,
authnRequestBinding: 'HTTP-POST',
identifierFormat:
'urn:oasis:names:tc:SAML:2.0:nameid-format:transient',
Expand All @@ -84,13 +84,13 @@ const passportConfigAuthorizedResponse = {
displayName: 'saml-emailreq',
type: 'saml',
mapping: 'saml_ldap_profile',
passportStrategyId: 'passport-saml',
passportStrategyId: '@node-saml/passport-saml',
enabled: true,
callbackUrl: 'https://chris.gluuthree.org/passport/auth/saml/saml-emailreq/callback',
requestForEmail: true,
emailLinkingSafe: false,
options: {
skipRequestCompression: 'True',
skipRequestCompression: true,
authnRequestBinding: 'HTTP-POST',
identifierFormat: 'urn:oasis:names:tc:SAML:2.0:nameid-format:transient',
cert: 'MIIDlzCCAn8CFBgf85Th/k9LW/WX1Tm2K8L46XFKMA0GCSqGSIb3DQEBCwUAMIGHMQswCQYDVQQGEwJCUjELMAkGA1UECAwCU1AxEjAQBgNVBAcMCVNhbyBQYXVsbzEZMBcGA1UECgwQQ2hyaXMgVGVzdGluZyBuQzEaMBgGA1UEAwwRY2hyaXMuZ2x1dXR3by5vcmcxIDAeBgkqhkiG9w0BCQEWEWNocmlzQHRlc3RpbmcuY29tMB4XDTIwMDYyMzE0NDU1M1oXDTIxMDYyMzE0NDU1M1owgYcxCzAJBgNVBAYTAkJSMQswCQYDVQQIDAJTUDESMBAGA1UEBwwJU2FvIFBhdWxvMRkwFwYDVQQKDBBDaHJpcyBUZXN0aW5nIG5DMRowGAYDVQQDDBFjaHJpcy5nbHV1dHdvLm9yZzEgMB4GCSqGSIb3DQEJARYRY2hyaXNAdGVzdGluZy5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDIaxbLrWDti7ZLAU4YVxNR6bkjt/HDfczBNF5ULlqttTbP65HgOMAl9eI8Sg+vPN2y7lk7ogQW4bJ3gcBfiBjanU8jrVMntXB8VwhZ8YYThkg1NBb9KPf9sW6FsOz+LDKNxJQeXu7jbKtb7KZvAQiFWCLil6VuKgvmjcDSnRARkSSacqVs7vM/OH9t+zRdeLA2LFEfUIW1GoOi66Tmt6hnVIhIm9I6vJOE+ym0HnyqPUQy6ZEWGbVbJ4Fn9JJmoZ3jJ1v9ZxfKJt2ZCz2HydOWJHXyg2fZwCBVdoJcydtVWQFNVJMEvQUCZNofyiJsCu+rQ033NWyhtrjlYL2fEqRnAgMBAAEwDQYJKoZIhvcNAQELBQADggEBABDbtviA7rVkg/8wPRYPgi07jCoR9x7ZnJjMB4xHFgwIKRF7FKapUBOvqzSmYbNm3JotAdq6o9gPD3rEjQh4Sy2fptA64fquY6Fo5paVTL5AECdumv67+ziB5mtYE0iabY+QHcLHpy6kqJvFpaeUeBNypvx6SaZ3BM/9Q5VwEmmuuf+VAnY/7Q/BHVUhUBeNs9G1LOtqLTr56QyOO4ET1NKihAeE8A/R05O7fELlB2HJ4LxhMLfzwQwQIzAg5fxYrZLtjGu524SSL7Xb6BuLIitwZVAYBcXS2Up37NGHdQu9c2uHFQoxk+ZNKO1ZRUl7IE/8c6DjMTRXRpZqqRaUBco=',
Expand All @@ -102,13 +102,13 @@ const passportConfigAuthorizedResponse = {
displayName: 'saml-emaillink',
type: 'saml',
mapping: 'saml_ldap_profile',
passportStrategyId: 'passport-saml',
passportStrategyId: '@node-saml/passport-saml',
enabled: true,
callbackUrl: 'https://chris.gluuthree.org/passport/auth/saml/saml-emaillink/callback',
requestForEmail: false,
emailLinkingSafe: true,
options: {
skipRequestCompression: 'True',
skipRequestCompression: true,
authnRequestBinding: 'HTTP-POST',
identifierFormat: 'urn:oasis:names:tc:SAML:2.0:nameid-format:transient',
cert: 'MIIDlzCCAn8CFBgf85Th/k9LW/WX1Tm2K8L46XFKMA0GCSqGSIb3DQEBCwUAMIGHMQswCQYDVQQGEwJCUjELMAkGA1UECAwCU1AxEjAQBgNVBAcMCVNhbyBQYXVsbzEZMBcGA1UECgwQQ2hyaXMgVGVzdGluZyBuQzEaMBgGA1UEAwwRY2hyaXMuZ2x1dXR3by5vcmcxIDAeBgkqhkiG9w0BCQEWEWNocmlzQHRlc3RpbmcuY29tMB4XDTIwMDYyMzE0NDU1M1oXDTIxMDYyMzE0NDU1M1owgYcxCzAJBgNVBAYTAkJSMQswCQYDVQQIDAJTUDESMBAGA1UEBwwJU2FvIFBhdWxvMRkwFwYDVQQKDBBDaHJpcyBUZXN0aW5nIG5DMRowGAYDVQQDDBFjaHJpcy5nbHV1dHdvLm9yZzEgMB4GCSqGSIb3DQEJARYRY2hyaXNAdGVzdGluZy5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDIaxbLrWDti7ZLAU4YVxNR6bkjt/HDfczBNF5ULlqttTbP65HgOMAl9eI8Sg+vPN2y7lk7ogQW4bJ3gcBfiBjanU8jrVMntXB8VwhZ8YYThkg1NBb9KPf9sW6FsOz+LDKNxJQeXu7jbKtb7KZvAQiFWCLil6VuKgvmjcDSnRARkSSacqVs7vM/OH9t+zRdeLA2LFEfUIW1GoOi66Tmt6hnVIhIm9I6vJOE+ym0HnyqPUQy6ZEWGbVbJ4Fn9JJmoZ3jJ1v9ZxfKJt2ZCz2HydOWJHXyg2fZwCBVdoJcydtVWQFNVJMEvQUCZNofyiJsCu+rQ033NWyhtrjlYL2fEqRnAgMBAAEwDQYJKoZIhvcNAQELBQADggEBABDbtviA7rVkg/8wPRYPgi07jCoR9x7ZnJjMB4xHFgwIKRF7FKapUBOvqzSmYbNm3JotAdq6o9gPD3rEjQh4Sy2fptA64fquY6Fo5paVTL5AECdumv67+ziB5mtYE0iabY+QHcLHpy6kqJvFpaeUeBNypvx6SaZ3BM/9Q5VwEmmuuf+VAnY/7Q/BHVUhUBeNs9G1LOtqLTr56QyOO4ET1NKihAeE8A/R05O7fELlB2HJ4LxhMLfzwQwQIzAg5fxYrZLtjGu524SSL7Xb6BuLIitwZVAYBcXS2Up37NGHdQu9c2uHFQoxk+ZNKO1ZRUl7IE/8c6DjMTRXRpZqqRaUBco=',
Expand All @@ -120,13 +120,13 @@ const passportConfigAuthorizedResponse = {
displayName: 'saml-yidpinitiated',
type: 'saml',
mapping: 'saml_ldap_profile',
passportStrategyId: 'passport-saml',
passportStrategyId: '@node-saml/passport-saml',
enabled: true,
callbackUrl: 'https://chris.gluuthree.org/passport/auth/saml/saml-yidpinitiated/callback',
requestForEmail: false,
emailLinkingSafe: false,
options: {
skipRequestCompression: 'true',
skipRequestCompression: true,
authnRequestBinding: 'HTTP-POST',
validateInResponseTo: 'false',
identifierFormat: 'urn:oasis:names:tc:SAML:2.0:nameid-format:transient',
Expand Down Expand Up @@ -157,15 +157,15 @@ const passportConfigAuthorizedResponse = {
displayName: 'saml redis',
type: 'saml',
mapping: 'saml_ldap_profile',
passportStrategyId: 'passport-saml',
passportStrategyId: '@node-saml/passport-saml',
enabled: true,
callbackUrl:
'https://chris.gluuthree.org/passport/auth/saml' +
'/saml-redis-test/callback',
requestForEmail: false,
emailLinkingSafe: false,
options: {
skipRequestCompression: 'True',
skipRequestCompression: true,
authnRequestBinding: 'HTTP-POST',
identifierFormat:
'urn:oasis:names:tc:SAML:2.0:nameid-format:transient',
Expand Down
1 change: 1 addition & 0 deletions server/providers.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ async function setupStrategy (provider) {
Strategy = Strategy.Strategy
}

logger.log2('info', `Adding to list of known strategies ${id} ${Strategy}`)
logger.log2('verbose', 'Adding to list of known strategies')
passportStrategies.push({ id, Strategy })
}
Expand Down
2 changes: 1 addition & 1 deletion test/cache-provider.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('cache provider test', () => {
assert.fail('redis connection should not work')
})
client.on('error', actualError => {
const expectedError = new Error('Redis connection in broken state: retry aborted.')
const expectedError = new Error('Ready check failed: NOAUTH Authentication required.')
assert.equal(actualError.message, expectedError.message)
})
})
Expand Down
2 changes: 1 addition & 1 deletion test/providers.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const chai = require('chai')
const rewire = require('rewire')
const providers = rewire('../server/providers.js')
const config = require('config')
const PassportSAMLStrategy = require('passport-saml').Strategy
const PassportSAMLStrategy = require('@node-saml/passport-saml').Strategy
const helper = require('./helper')
const fs = require('fs').promises
const path = require('path')
Expand Down
2 changes: 1 addition & 1 deletion test/sp-meta.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const chai = require('chai')
const rewire = require('rewire')
const PassportSAMLStrategy = require('passport-saml').Strategy
const PassportSAMLStrategy = require('@node-saml/passport-saml').Strategy
const rewireSPMeta = rewire('../server/sp-meta')
const config = require('config')

Expand Down

0 comments on commit 7ec9342

Please sign in to comment.