Skip to content

Commit

Permalink
Merge pull request #442 from ForgeRock/update-build-sdk
Browse files Browse the repository at this point in the history
build(javascript-sdk): update-build-to-vite-lib
  • Loading branch information
ryanbas21 authored May 15, 2024
2 parents 0f84909 + 20b2c00 commit 91fe493
Show file tree
Hide file tree
Showing 20 changed files with 14,651 additions and 13,805 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ ForgeRock provides these samples to help demonstrate SDK functionality/implement

To try out the ForgeRock JavaScript SDK please look at one of our samples:

- [**Embedded login - `samples/embedded-login`**](./samples/embedded-login/README.md)
- [**Embedded login - `samples/embedded-login`**](https://github.com/ForgeRock/sdk-sample-apps/blob/main/embedded-login/README.md)

- [**Central login - `samples/central-login`**](./samples/central-login/README.md)
- [**Central login - `samples/central-login`**](https://github.com/ForgeRock/sdk-sample-apps/blob/main/central-login/README.md)

- [**React Todo - `samples/reactjs-todo`**](./samples/reactjs-todo/README.md)
- [**React Todo - `samples/reactjs-todo`**](https://github.com/ForgeRock/sdk-sample-apps/blob/main/reactjs-todo/README.md)

- [**Angular Todo - `samples/angular-todo`**](./samples/angular-todo/README.md)
- [**Angular Todo - `samples/angular-todo`**](https://github.com/ForgeRock/sdk-sample-apps/blob/main/angular-todo/README.md)

<!------------------------------------------------------------------------------------------------------------------------------------>
<!-- DOCS - Link off to the AM-centric documentation at sdks.forgerock.com. -->
Expand Down
25 changes: 12 additions & 13 deletions e2e/autoscript-apps/src/authn-central-logout/autoscript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,6 @@ import * as forgerock from '@forgerock/javascript-sdk';
* of the MIT license. See the LICENSE file for details.
*/
async function autoscript() {
await forgerock.Config.setAsync({
clientId: '724ec718-c41c-4d51-98b0-84a583f450f9', // e.g. 'ForgeRockSDKClient'
redirectUri: `${window.location.origin}${window.location.pathname}`, // Redirect back to your app, e.g. 'https://sdkapp.example.com:8443'
scope: 'openid profile email name revoke', // e.g. 'openid profile email address phone me.read'
serverConfig: {
wellknown:
'https://auth.pingone.ca/02fb4743-189a-4bc7-9d6c-a919edfe6447/as/.well-known/openid-configuration',
},
realmPath: '', // e.g. 'alpha' or 'root'
});

// Show only the view for this handler
const showStep = (handler) => {
document.querySelectorAll('#steps > *').forEach((x) => x.classList.remove('active'));
Expand Down Expand Up @@ -72,7 +61,7 @@ async function autoscript() {
showUser(user);
};

document.querySelector('#loginBtn')?.addEventListener('click', async () => {
document.getElementById('loginBtn')?.addEventListener('click', async () => {
/**
* The key-value of `login: redirect` is what allows central-login.
* Passing no arguments or a key-value of `login: 'embedded'` means
Expand All @@ -83,11 +72,21 @@ async function autoscript() {
showUser(user);
});

document.querySelector('#forceRenewBtn')?.addEventListener('click', async () => {
document.getElementById('forceRenewBtn')?.addEventListener('click', async () => {
await forgerock.TokenManager.getTokens({ login: 'redirect', forceRenew: true });
const user = await forgerock.UserManager.getCurrentUser();
showUser(user);
});
await forgerock.Config.setAsync({
clientId: '724ec718-c41c-4d51-98b0-84a583f450f9', // e.g. 'ForgeRockSDKClient'
redirectUri: `${window.location.origin}${window.location.pathname}`, // Redirect back to your app, e.g. 'https://sdkapp.example.com:8443'
scope: 'openid profile email name revoke', // e.g. 'openid profile email address phone me.read'
serverConfig: {
wellknown:
'https://auth.pingone.ca/02fb4743-189a-4bc7-9d6c-a919edfe6447/as/.well-known/openid-configuration',
},
realmPath: '', // e.g. 'alpha' or 'root'
});

/**
* Check URL for query parameters
Expand Down
2 changes: 1 addition & 1 deletion e2e/autoscript-apps/src/authn-central-logout/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
/>
</head>
<script type="module" src="autoscript.ts"></script>
<body>
<div id="steps">
<div class="active">
Expand All @@ -32,6 +33,5 @@
<p><a href="">Start over</a></p>
</div>
</div>
<script type="module" src="autoscript.ts"></script>
</body>
</html>
3 changes: 2 additions & 1 deletion e2e/autoscript-suites/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
},
"configurations": {
"ui": {
"ui": true
"ui": true,
"headed": true
}
}
},
Expand Down
9 changes: 6 additions & 3 deletions e2e/autoscript-suites/src/suites/authn-central-logout.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ import { test, expect } from '@playwright/test';
test('should login and logout with pingone', async ({ page }) => {
await page.goto('http://localhost:8443/');
await page.getByRole('link', { name: 'AuthN: Central Logout Ping' }).click();
const btn = page.getByRole('button', { name: 'Login' });
await btn.isVisible();
await btn.click({ clickCount: 1, delay: 300 });
await expect(page).toHaveURL('http://localhost:8443/src/authn-central-logout/index.html');
await expect(page.getByRole('button', { name: /Force Renew/ })).toBeVisible();
const btn = page.getByRole('button', { name: /Login/ });
await expect(btn).toBeVisible();
await btn.click({ delay: 1000 });
await page.waitForURL(/ping/);
await page.getByRole('textbox', { name: 'Username' }).click();
await page.getByPlaceholder('Username').fill('sdk.user');
await page.getByRole('textbox', { name: 'Password' }).click();
Expand Down
1 change: 1 addition & 0 deletions e2e/autoscript-suites/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"types": ["jest", "node"],
"outDir": "dist",
"module": "ES2015",
"moduleResolution": "NodeNext",
"allowUmdGlobalAccess": true,
"target": "ES2015"
},
Expand Down
6 changes: 6 additions & 0 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
"packageRoot": "dist/packages/{projectName}"
}
},
"docs": {
"cache": true
},
"packagejson": {
"cache": true
},
"e2e": {
"cache": true
},
Expand Down
Loading

0 comments on commit 91fe493

Please sign in to comment.