-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Configured local keycloak with realm provisioning * Installation and first configuration of pow-assent * Keycloak provisioned realm confidential * frontend wip * oidc callback as conf parameter * locked users could not login through IDP * Delete user deletes user identities * User identity changeset to map oidc standard to user schema * Add session controller callback test * Disable and update user forms if OIDC is enabled (#2859) * Send oicd is enabled value to frontend * Create users function to check sso is enabled * Add sso differences in the users views * Add sso differences in profile views * Disable password update requested notification * Correct typo and remove test debug * Move sso auth logic to auth folder * Format mix.exs file * Disable oidc by default in dev * Disable actions when external idp is enabled (#2863) * Add external idp guard plug * Prevent write profile operations when external idp is configured * Prevent traditional login operation when external idp is configured * Disable create user endpoint when external idp is configured * fix controller tests env * mix credo * Addressing review feedback * dialyzer fix * View field for idp users (#2865) * Listing and getting users returns also the user identities * User controller returns idp_user field in response * profile controller returning idp_user field * Create user adds empty user_identities * User identities context assigns global abilities to a oidc user (#2868) * Single sign on login view (#2866) * Load oidc url in frontend * Create SSO login view * Improve frontend OIDC callback (#2871) * Send oidc callback url to frontend * Get oidc callback url in frontend functions * Refactor and test oidc enrollment saga * Refactor and test oidc callback component * Allow only abilities update with OIDC (#2879) * User update endpoint only updates abilities when oidc enabled * User update skips password changeset if the user comes from idp * Allow enable field in users update when oidc is enabled * mix credo * Add option to load oidc variables in runtime (#2874) * Existing user is recovered when login with oidc (#2880) * Existing user is recovered when login with oidc * Addressing review feedbacks * Fix fullname entry in trento console for a new created user by idp provider (#2883) * fix typo * Use name to display the full name in trento not only the first name * fix oidc callback url parameter in oidc runtime (#2906) * OIDC integration E2E tests (#2908) * Add admin user to keycloak trento realm * Add OIDC integration e2e tests * Run integration test conditionally * Add github action to run integration test --------- Co-authored-by: Carmine Di Monaco <[email protected]> Co-authored-by: Carmine Di Monaco <[email protected]> Co-authored-by: Eugen Maksymenko <[email protected]>
- Loading branch information
1 parent
5e143d4
commit b6be998
Showing
66 changed files
with
2,249 additions
and
282 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ env: | |
NODE_VERSION: "20" | ||
MANTAINERS: '["cdimonaco", "dottorblaster", "janvhs", "rtorrero", "nelsonkopliku", "arbulu89","jagabomb","emaksy","jamie-suse"]' | ||
RG_TEST_LABEL: regression | ||
INTEGRATION_TEST_LABEL: integration | ||
|
||
jobs: | ||
elixir-deps: | ||
|
@@ -562,6 +563,108 @@ jobs: | |
name: regression-${{ matrix.test }}-e2e-screenshots | ||
path: test/e2e/cypress/screenshots/ | ||
|
||
check-integration-tests-label: | ||
name: Check if the integration test criteria are met, store in the job output | ||
runs-on: ubuntu-22.04 | ||
outputs: | ||
run_integration_test: ${{ steps.check.outputs.run_integration_test }} | ||
steps: | ||
- id: check | ||
run: echo "run_integration_test=${{ contains(fromJson(env.MANTAINERS), github.event.sender.login) && contains(github.event.pull_request.labels.*.name, env.INTEGRATION_TEST_LABEL) }}" >> "$GITHUB_OUTPUT" | ||
|
||
integration-test-e2e: | ||
name: Integration tests | ||
needs: [check-integration-tests-label, elixir-deps, npm-deps, npm-e2e-deps] | ||
runs-on: ubuntu-22.04 | ||
if: needs.check-integration-tests-label.outputs.run_integration_test == 'true' | ||
strategy: | ||
matrix: | ||
include: | ||
- test: oidc | ||
cypress_spec: | | ||
cypress/e2e/oidc_integration.cy.js | ||
config_file_content: | | ||
import Config | ||
config :trento, :oidc, enabled: true | ||
env: | ||
MIX_ENV: dev | ||
CYPRESS_OIDC_INTEGRATION_TESTS: true | ||
env: ${{ matrix.env }} | ||
steps: | ||
- name: Cancel Previous Runs | ||
uses: styfle/[email protected] | ||
with: | ||
access_token: ${{ github.token }} | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Setup | ||
id: setup-elixir | ||
uses: erlef/setup-beam@v1 | ||
with: | ||
version-file: .tool-versions | ||
version-type: strict | ||
env: | ||
ImageOS: ubuntu20 | ||
- name: Setup Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
- name: Retrieve Cached Dependencies | ||
uses: actions/cache@v4 | ||
id: mix-cache | ||
with: | ||
path: | | ||
deps | ||
_build/dev | ||
priv/plts | ||
key: ${{ runner.os }}-${{ steps.setup-elixir.outputs.otp-version }}-${{ steps.setup-elixir.outputs.elixir-version }}-${{ hashFiles('mix.lock') }} | ||
- name: Retrieve NPM Cached Dependencies | ||
uses: actions/cache@v4 | ||
id: npm-cache | ||
with: | ||
path: | | ||
assets/node_modules | ||
key: ${{ runner.os }}-${{ env.NODE_VERSION }}-${{ hashFiles('assets/package-lock.json') }} | ||
- name: Retrieve E2E NPM Cached Dependencies | ||
uses: actions/cache@v4 | ||
id: npm-e2e-cache | ||
with: | ||
path: | | ||
test/e2e/node_modules | ||
key: ${{ runner.os }}-${{ env.NODE_VERSION }}-${{ hashFiles('test/e2e/package-lock.json') }} | ||
- name: "Docker compose dependencies" | ||
uses: isbang/[email protected] | ||
with: | ||
compose-file: "./docker-compose.yaml" | ||
compose-flags: "--profile idp" | ||
down-flags: "--volumes" | ||
- name: Create dev.local.exs file | ||
run: echo "${{ matrix.config_file_content }}" > config/dev.local.exs | ||
- name: Mix setup | ||
run: mix setup | ||
- name: Run trento detached | ||
run: mix phx.server & | ||
- name: Cypress run | ||
uses: cypress-io/github-action@v6 | ||
env: | ||
cypress_video: false | ||
cypress_db_host: postgres | ||
cypress_db_port: 5432 | ||
with: | ||
working-directory: test/e2e | ||
spec: ${{ matrix.cypress_spec }} | ||
wait-on-timeout: 30 | ||
config: baseUrl=http://localhost:4000 | ||
- name: Upload cypress test screenshots | ||
uses: actions/upload-artifact@v4 | ||
if: failure() | ||
with: | ||
name: integration-${{ matrix.test }}-e2e-screenshots | ||
path: test/e2e/cypress/screenshots/ | ||
|
||
target-branch-deps: | ||
name: Rebuild target branch dependencies | ||
runs-on: ubuntu-20.04 | ||
|
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { getFromConfig } from '@lib/config'; | ||
|
||
const OIDC_ENABLED = getFromConfig('oidcEnabled') || false; | ||
const OIDC_LOGIN_URL = getFromConfig('oidcLoginUrl') || ''; | ||
const OIDC_CALLBACK_URL = getFromConfig('oidcCallbackUrl') || ''; | ||
|
||
export const isSingleSignOnEnabled = () => OIDC_ENABLED; | ||
|
||
export const getSingleSignOnLoginUrl = () => { | ||
if (OIDC_ENABLED) { | ||
return OIDC_LOGIN_URL; | ||
} | ||
|
||
return ''; | ||
}; | ||
|
||
export const getSingleSignOnCallbackUrl = () => { | ||
if (OIDC_ENABLED) { | ||
return OIDC_CALLBACK_URL; | ||
} | ||
|
||
return ''; | ||
}; |
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,35 @@ | ||
import { isSingleSignOnEnabled } from './config'; | ||
|
||
describe('auth config', () => { | ||
beforeEach(() => { | ||
jest.resetModules(); | ||
}); | ||
|
||
it('should check if single sign on is enabled', () => { | ||
expect(isSingleSignOnEnabled()).toBeFalsy(); | ||
|
||
global.config.oidcEnabled = true; | ||
|
||
return import('./config').then((config) => { | ||
expect(config.isSingleSignOnEnabled()).toBeTruthy(); | ||
}); | ||
}); | ||
|
||
it('should get OIDC login url if OIDC is enabled', async () => { | ||
global.config.oidcEnabled = true; | ||
|
||
return import('./config').then((config) => { | ||
expect(config.getSingleSignOnLoginUrl()).toBe( | ||
'http://localhost:4000/auth/oidc_callback' | ||
); | ||
}); | ||
}); | ||
|
||
it('should get OIDC callback url if OIDC is enabled', async () => { | ||
global.config.oidcEnabled = true; | ||
|
||
return import('./config').then((config) => { | ||
expect(config.getSingleSignOnCallbackUrl()).toBe('/auth/oidc_callback'); | ||
}); | ||
}); | ||
}); |
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
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.