-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: OIDC authentication flow v2 (#3527)
* wip back port oidc login flow Signed-off-by: Pablo Hernán Carle <[email protected]> * add fixes Signed-off-by: Pablo Hernán Carle <[email protected]> * fix build issues Signed-off-by: Pablo Hernán Carle <[email protected]> * wip fix Signed-off-by: Pablo Hernán Carle <[email protected]> * add cloud gateway to local npm startup script Signed-off-by: Pablo Hernán Carle <[email protected]> * use compatible spring security version (local) Signed-off-by: Pablo Hernán Carle <[email protected]> --------- Signed-off-by: Pablo Hernán Carle <[email protected]> Co-authored-by: Pablo Hernán Carle <[email protected]>
- Loading branch information
1 parent
da29403
commit 4c81a7c
Showing
17 changed files
with
923 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,37 @@ | ||
const { defineConfig } = require('cypress') | ||
/* | ||
* This program and the accompanying materials are made available under the terms of the | ||
* Eclipse Public License v2.0 which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-v20.html | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Copyright Contributors to the Zowe Project. | ||
*/ | ||
|
||
const { defineConfig } = require('cypress'); | ||
|
||
module.exports = defineConfig({ | ||
env: { | ||
catalogHomePage: 'https://localhost:10010/apicatalog/ui/v1', | ||
viewportWidth: 1400, | ||
viewportHeight: 980, | ||
username: 'USER', | ||
password: 'validPassword', | ||
}, | ||
reporter: 'junit', | ||
defaultCommandTimeout: 30000, | ||
reporterOptions: { | ||
mochaFile: 'test-results/e2e/output-[hash].xml', | ||
}, | ||
video: false, | ||
e2e: { | ||
// We've imported your old cypress plugins here. | ||
// You may want to clean this up later by importing these. | ||
setupNodeEvents(on, config) { | ||
return require('./cypress/plugins/index.js')(on, config) | ||
env: { | ||
catalogHomePage: 'https://localhost:10010/apicatalog/ui/v1', | ||
gatewayOktaRedirect: | ||
'https://localhost:10023/cloud-gateway/oauth2/authorization/okta?returnUrl=https%3A%2F%2Flocalhost%3A10023%2Fapplication', | ||
viewportWidth: 1400, | ||
viewportHeight: 980, | ||
username: 'USER', | ||
password: 'validPassword', | ||
}, | ||
chromeWebSecurity: false, | ||
reporter: 'junit', | ||
defaultCommandTimeout: 30000, | ||
reporterOptions: { | ||
mochaFile: 'test-results/e2e/output-[hash].xml', | ||
}, | ||
video: false, | ||
e2e: { | ||
// We've imported your old cypress plugins here. | ||
// You may want to clean this up later by importing these. | ||
setupNodeEvents(on, config) { | ||
return require('./cypress/plugins/index.js')(on, config); | ||
}, | ||
}, | ||
}, | ||
}) | ||
}); |
38 changes: 38 additions & 0 deletions
38
api-catalog-ui/frontend/cypress/e2e/login/login-oauth.cy.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* This program and the accompanying materials are made available under the terms of the | ||
* Eclipse Public License v2.0 which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-v20.html | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Copyright Contributors to the Zowe Project. | ||
*/ | ||
/* eslint-disable spaced-comment */ | ||
|
||
describe('>>> Login through Okta OK', () => { | ||
it('should log in user and check session cookie', () => { | ||
cy.visit(`${Cypress.env('gatewayOktaRedirect')}`); | ||
|
||
const username = Cypress.env('OKTA_USERNAME'); | ||
if (!username) { | ||
cy.log('System env CYPRESS_OKTA_USERNAME is not set'); | ||
} | ||
|
||
const password = Cypress.env('OKTA_PASSWORD'); | ||
if (!password) { | ||
cy.log('System env CYPRESS_OKTA_PASSWORD is not set'); | ||
} | ||
|
||
cy.get('form span.o-form-input-name-identifier input').type(username); | ||
cy.get('form input[type="password"]').type(password); | ||
|
||
cy.get('form input.button-primary').should('not.be.disabled'); | ||
cy.get('form input.button-primary').click(); | ||
|
||
cy.location('href').should('contain', '/oauth2/v1/authorize'); | ||
|
||
cy.url().should('contain', '/application'); | ||
|
||
cy.getCookie('apimlAuthenticationToken').should('exist'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.