-
Notifications
You must be signed in to change notification settings - Fork 164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SAML Integration Tests #1088
SAML Integration Tests #1088
Changes from 44 commits
861c909
c42dacc
7415746
a1afaa5
381de0c
69c765f
2234f77
776e134
4e73818
d68808a
1a641ba
016087c
4c3561a
5c486b4
fc133ae
a39fa6f
15f7483
07688fa
a0338d4
ad54b42
abff13a
60f97f4
85492d9
6423819
11dbee5
8062541
dc52652
e07ffb9
9fa7fbf
edf19e3
73d5251
ce0708b
ae2f818
9b45c10
22a1ac2
cd10d35
89950cc
4c696e4
8253163
51ad38a
847bc2d
c10cf2c
9af274a
f6d8032
f247dbb
fba014d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,19 +17,23 @@ | |
"lint:es": "node ../../scripts/eslint", | ||
"lint:style": "node ../../scripts/stylelint", | ||
"lint": "yarn run lint:es && yarn run lint:style", | ||
"pretest:jest_server": "node ./test/jest_integration/runIdpServer.js &", | ||
"test:jest_server": "node ./test/run_jest_tests.js --config ./test/jest.config.server.js", | ||
"test:jest_ui": "node ./test/run_jest_tests.js --config ./test/jest.config.ui.js" | ||
}, | ||
"devDependencies": { | ||
"@elastic/eslint-import-resolver-kibana": "link:../../packages/osd-eslint-import-resolver-opensearch-dashboards", | ||
"typescript": "4.0.2", | ||
"gulp-rename": "2.0.0", | ||
"@testing-library/react-hooks": "^7.0.2", | ||
"@types/hapi__wreck": "^15.0.1" | ||
"@types/hapi__wreck": "^15.0.1", | ||
"gulp-rename": "2.0.0", | ||
"saml-idp": "^1.2.1", | ||
"selenium-webdriver": "^4.0.0-alpha.7", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @peterzhuamazon @bbarani Are there any concerns on building selenium into release? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @anijain-Amazon Would it be possible to add these tests in opensearch-dashboards-functional-test and implement with Cypress? There has already been a well-automated workflow in place where developers can easily implement tests and the tests run with each build. With the workflow, developers do not have to worry about setting up clusters and configurations. They can just focus on implementing tests and the workflow takes care of everything else. In comparison, Selenium would be a brand new test framework that would require some changes in Infra for release build. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @cliu123 currently cypress does not support saml auth workflow cypress-io/cypress#5397, so we went with selenium There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see. Thanks for the information! |
||
"selfsigned": "^2.0.1", | ||
"typescript": "4.0.2" | ||
}, | ||
"dependencies": { | ||
"@hapi/wreck": "^17.1.0", | ||
"@hapi/cryptiles": "5.0.0", | ||
"@hapi/wreck": "^17.1.0", | ||
"html-entities": "1.3.1" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ import { AUTHORIZATION_HEADER_NAME } from '../constant'; | |
|
||
export function extractAuthCookie(response: Response) { | ||
const setCookieHeaders = response.header['set-cookie'] as string[]; | ||
let securityAuthCookie: string; | ||
let securityAuthCookie: string | null = null; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, since null can valid value for securityAuthCookie |
||
for (const setCookie of setCookieHeaders) { | ||
if (setCookie.startsWith('security_authentication=')) { | ||
securityAuthCookie = setCookie.split(';')[0]; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* A copy of the License is located at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed | ||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
* express or implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
*/ | ||
|
||
const { runServer } = require('saml-idp'); | ||
|
||
const { generate } = require('selfsigned'); | ||
|
||
const pems = generate(null, { | ||
keySize: 2048, | ||
clientCertificateCN: '/C=US/ST=California/L=San Francisco/O=JankyCo/CN=Test Identity Provider', | ||
days: 7300, | ||
}); | ||
|
||
// Create certificate pair on the fly and pass it to runServer | ||
runServer({ | ||
acsUrl: 'http://localhost:5601/_opendistro/_security/saml/acs', | ||
audience: 'https://localhost:9200', | ||
cert: pems.cert, | ||
key: pems.private.toString().replace(/\r\n/, '\n'), | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this start the IDP before all jest tests, could we start it in the setup for the
saml_auth.tests.ts
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious as well, can we spin this up and tear it down as needed for a test or suite of tests?