Skip to content

Commit

Permalink
Merge branch 'master' of github.com:apereo/cas
Browse files Browse the repository at this point in the history
  • Loading branch information
mmoayyed committed Dec 3, 2021
2 parents aba7a20 + bb3d7c9 commit 07308f4
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 19 deletions.
23 changes: 23 additions & 0 deletions ci/tests/puppeteer/scenarios/pac4j-delegated-concurrency/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const assert = require('assert');
const fs = require('fs');
const {JSONPath} = require('jsonpath-plus');

const startPuppeteerLoadTest = require('puppeteer-loadtest');
let args = process.argv.slice(2);
const config = JSON.parse(fs.readFileSync(args[0]));
assert(config != null)

const paramOptions = {
file: config.loadScript,
samplesRequested: config.samplesRequested,
concurrencyRequested: config.concurrencyRequested
}
const loadtest = async () => {
return await startPuppeteerLoadTest(paramOptions);
}

loadtest().then(results => {
console.log(JSON.stringify(results, null, 2))
const samples = JSONPath({path: '$..sample', json: results })
assert(samples.length === parseInt(config.samplesRequested))
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"dependencies": "pac4j-webflow",
"properties": [
"--cas.authn.pac4j.github.client-name=GitHubClient",
"--cas.authn.pac4j.github.id=84cfb715b8237728e567",
"--cas.authn.pac4j.github.secret=71a294b6c9f5b00333f4bfb369bbbafa36a86bad",

"--cas.authn.pac4j.twitter.client-name=TwitterClient",
"--cas.authn.pac4j.twitter.id=Dsw8eftYNLXM0tjsxC06dEjGS",
"--cas.authn.pac4j.twitter.secret=aYNpkBbvK7lGnFY4BTQqaX2bEqygCHiN825erOBXkXT0pINBUy",

"--logging.level.org.apereo.cas=info"
],
"loadScript": "./ci/tests/puppeteer/scenarios/pac4j-delegated-concurrency/test.js",
"samplesRequested": 1,
"concurrencyRequested": 50
}
20 changes: 20 additions & 0 deletions ci/tests/puppeteer/scenarios/pac4j-delegated-concurrency/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const puppeteer = require('puppeteer');
const cas = require('../../cas.js');

(async () => {
const browser = await puppeteer.launch(cas.browserOptions());
const page = await cas.newPage(browser);
await page.goto("https://localhost:8443/cas/login");
await page.waitForTimeout(3000);

await cas.assertVisibility(page, '#loginProviders')
await cas.assertVisibility(page, 'li #TwitterClient')
await cas.assertVisibility(page, 'li #GitHubClient')

await page.goto("https://localhost:8443/cas/clientredirect?client_name=GithubClient");
await page.waitForTimeout(3000);

await cas.assertVisibility(page, '#login_field')

await browser.close();
})();
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public class DefaultDelegatedClientFactory implements DelegatedClientFactory<Ind

private final Collection<DelegatedClientFactoryCustomizer> customizers;

private final Set<IndirectClient> clients = new LinkedHashSet<>();
private Set<IndirectClient> clients = new LinkedHashSet<>();

private final CasSSLContext casSSLContext;

Expand Down Expand Up @@ -137,24 +137,25 @@ private static <T extends OidcConfiguration> T getOidcConfigurationForClient(fin
@Synchronized
public Collection<IndirectClient> build() {
if (this.clients.isEmpty() || !casProperties.getAuthn().getPac4j().getCore().isLazyInit()) {
this.clients.clear();
configureCasClient(clients);
configureFacebookClient(clients);
configureOidcClient(clients);
configureOAuth20Client(clients);
configureSamlClient(clients);
configureTwitterClient(clients);
configureDropBoxClient(clients);
configureFoursquareClient(clients);
configureGitHubClient(clients);
configureGoogleClient(clients);
configureWindowsLiveClient(clients);
configureYahooClient(clients);
configureLinkedInClient(clients);
configurePayPalClient(clients);
configureWordPressClient(clients);
configureBitBucketClient(clients);
configureHiOrgServerClient(clients);
val newClients = new LinkedHashSet<IndirectClient>();
configureCasClient(newClients);
configureFacebookClient(newClients);
configureOidcClient(newClients);
configureOAuth20Client(newClients);
configureSamlClient(newClients);
configureTwitterClient(newClients);
configureDropBoxClient(newClients);
configureFoursquareClient(newClients);
configureGitHubClient(newClients);
configureGoogleClient(newClients);
configureWindowsLiveClient(newClients);
configureYahooClient(newClients);
configureLinkedInClient(newClients);
configurePayPalClient(newClients);
configureWordPressClient(newClients);
configureBitBucketClient(newClients);
configureHiOrgServerClient(newClients);
this.clients = newClients;
}
return clients;
}
Expand Down

0 comments on commit 07308f4

Please sign in to comment.