diff --git a/e2e/mock-api/src/app/routes.auth.js b/e2e/mock-api/src/app/routes.auth.js index 3337f22b3..cc6499c7c 100644 --- a/e2e/mock-api/src/app/routes.auth.js +++ b/e2e/mock-api/src/app/routes.auth.js @@ -440,7 +440,7 @@ export default function (app) { app.get('/login', async (req, res) => { const domain = req.url.includes('localhost') ? 'localhost' : 'example.com'; - res.cookie('iPlanetDirectoryPro', 'abcd1234', { domain }); + res.cookie('iPlanetDirectoryPro', 'abcd1234', { domain, sameSite: 'none', secure: true }); const url = new URL(`${req.protocol}://${req.headers.host}${authPaths.authorize[1]}`); url.searchParams.set('client_id', req.query.client_id); diff --git a/e2e/token-vault-app/index.html b/e2e/token-vault-app/index.html index 228359bb8..ee6442c91 100644 --- a/e2e/token-vault-app/index.html +++ b/e2e/token-vault-app/index.html @@ -51,6 +51,7 @@ +
Don’t have an account? @@ -26,3 +27,7 @@
Already have an account? @@ -26,3 +28,7 @@
OK
+ diff --git a/samples/angular-todo/src/environments/environment.ts b/samples/angular-todo/src/environments/environment.ts index 76a568c75..d4799a922 100644 --- a/samples/angular-todo/src/environments/environment.ts +++ b/samples/angular-todo/src/environments/environment.ts @@ -1,5 +1,5 @@ export const environment = { - AM_URL: 'https://openam-crbrl-01.forgeblocks.com/am', + AM_URL: 'https://openam-sdks.forgeblocks.com/am/', REALM_PATH: 'alpha', WEB_OAUTH_CLIENT: 'WebOAuthClient', JOURNEY_LOGIN: 'Login', diff --git a/samples/angular-todo/src/styles/_custom-styles.scss b/samples/angular-todo/src/styles/_custom-styles.scss index 38c6b537a..601f82b38 100644 --- a/samples/angular-todo/src/styles/_custom-styles.scss +++ b/samples/angular-todo/src/styles/_custom-styles.scss @@ -1,8 +1,8 @@ /* * angular-todo-prototype - * + * * _custom-styles.scss - * + * * Copyright (c) 2021 ForgeRock. All rights reserved. * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. @@ -226,6 +226,15 @@ body { button[type='submit'] { padding: 0.75rem 1.25rem; } + + button { + padding: 0.75rem 0.75rem; + } +} + +.cstm_form-confirmation-select { + margin-bottom: 0.5rem; + transition: background-color 0.5s; } .cstm_form-floating > .cstm_form-select { padding-bottom: $form-select-padding-y; @@ -411,3 +420,49 @@ body { .text-white .cstm_dropdown-actions:focus { fill: $gray-200; } + +/** ********************************************* + * Identity provider styling + */ + +.google-login { + background-color: #fff; + color: #757575; + border-color: #ddd; + + &:hover { + color: #6d6d6d; + background-color: #eee; + border-color: #ccc; + } +} + +.apple-login { + background-color: #000000; + color: #ffffff; + border-color: #000000; + + &:hover { + background-color: #000000; + color: #ffffff; + border-color: #000000; + } +} +.facebook-login { + background-color: #3b5998; + border-color: #3b5998; + color: white; + + &:hover { + background-color: #334b7d; + border-color: #334b7d; + color: white; + } +} +app-identity-provider button { + border-radius: 8px; + width: 100%; + margin-top: 10px; + margin-bottom: 10px; + height: 3rem; +} diff --git a/samples/angular-todo/tsconfig.editor.json b/samples/angular-todo/tsconfig.editor.json index 1bf3c0a74..acab8eff1 100644 --- a/samples/angular-todo/tsconfig.editor.json +++ b/samples/angular-todo/tsconfig.editor.json @@ -2,7 +2,8 @@ "extends": "./tsconfig.json", "include": ["**/*.ts"], "compilerOptions": { - "types": ["jest", "node"] + "types": ["jest", "node"], + "moduleResolution": "node" }, "exclude": ["jest.config.ts"] } diff --git a/samples/angular-todo/tsconfig.json b/samples/angular-todo/tsconfig.json index baf0ad97d..3550ee568 100644 --- a/samples/angular-todo/tsconfig.json +++ b/samples/angular-todo/tsconfig.json @@ -25,7 +25,8 @@ "noUnusedParameters": false, "target": "es2017", "module": "es2020", - "lib": ["es2018", "dom"] + "lib": ["es2018", "dom"], + "moduleResolution": "node" }, "angularCompilerOptions": { "strictInjectionParameters": true, diff --git a/shared/network/src/lib/network.utilities.test.ts b/shared/network/src/lib/network.utilities.test.ts index fd65dce04..8d3eebb2e 100644 --- a/shared/network/src/lib/network.utilities.test.ts +++ b/shared/network/src/lib/network.utilities.test.ts @@ -1,6 +1,7 @@ import { createErrorResponse, evaluateUrlForInterception, + extractOrigins, generateAmUrls, getBaseUrl, getEndpointPath, @@ -17,12 +18,14 @@ describe('Test network utility functions', () => { const url = 'https://example.com'; expect(evaluateUrlForInterception(url, urls)).toBe(true); }); + // Test evaluateUrlForInterception with non-matching URL it('evaluateUrlForInterception should return false for non-matching URLs', () => { const urls = ['https://example.com', 'https://example.com/*']; const url = 'https://example.org'; expect(evaluateUrlForInterception(url, urls)).toBe(false); }); + // Test evaluateUrlForInterception with matching URL containing blob it('evaluateUrlForInterception should return true for matching URLs with blob', () => { const urls = ['https://example.com', 'https://example.com/*']; @@ -30,6 +33,25 @@ describe('Test network utility functions', () => { expect(evaluateUrlForInterception(url, urls)).toBe(true); }); + // Test extractOrigins + it('extractOrigins should return an array of unique origins from array of URLs', () => { + const expected = [ + 'https://example.com', + 'http://example.com', + 'https://example.com:8443', + 'https://my.forgeblocks.com', + ]; + const urls = [ + 'https://example.com/a', + 'http://example.com/b', + 'https://example.com:8443/c', + 'https://example.com/d', + 'http://example.com/e', + 'https://my.forgeblocks.com/am', + ]; + expect(extractOrigins(urls)).toStrictEqual(expected); + }); + // Test createErrorResponse with `fetch_error` type it('createErrorResponse should return error response', () => { const error = new Error('Test error'); @@ -142,7 +164,7 @@ describe('Test network utility functions', () => { expect(realmUrlPath).toBe('realms/root/realms/alpha'); }); // Test getRealmUrlPath with /alpha with trailing slash - it('getRealmUrlPath should return realm URL path without being affected by trailing slash', () => { + it('getRealmUrlPath should return realm URL path w/o being affected by trailing slash', () => { const realmUrlPath = getRealmUrlPath('alpha/'); expect(realmUrlPath).toBe('realms/root/realms/alpha'); }); diff --git a/shared/network/src/lib/network.utilities.ts b/shared/network/src/lib/network.utilities.ts index e39ba1d6a..d5b59c67b 100644 --- a/shared/network/src/lib/network.utilities.ts +++ b/shared/network/src/lib/network.utilities.ts @@ -103,6 +103,22 @@ export function evaluateUrlForInterception(url: string, urls: string[]) { return false; } +/** **************************************************************** + * @function extractOrigins - Extract a set of origins from URLs + * @param {string[]} urls - array of urls + * @returns {string[]} - array of origins + */ +export function extractOrigins(urls: string[]): string[] { + const origins: Set