Skip to content

Commit

Permalink
Merge pull request #334 from vscheuber/main
Browse files Browse the repository at this point in the history
fixes #331 - additional fixes to properly filter and added unit tests
  • Loading branch information
vscheuber authored Oct 21, 2023
2 parents 8864bb6 + 197a3ac commit 17b2561
Show file tree
Hide file tree
Showing 37 changed files with 11,408 additions and 59 deletions.
587 changes: 587 additions & 0 deletions src/ops/CirclesOfTrustOps.test.ts

Large diffs are not rendered by default.

318 changes: 261 additions & 57 deletions src/ops/CirclesOfTrustOps.ts

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions src/ops/Saml2Ops.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,20 @@ export async function readSaml2ProviderStubs({
return result;
}

/**
* Get all SAML2 entity ids
* @returns {Promise<string[]>} a promise that resolves to an array of saml2 entity ids
*/
export async function readSaml2EntityIds({
state,
}: {
state: State;
}): Promise<string[]> {
const { result } = await _getProviderStubs({ state });
const entityIds = result.map((stub) => stub.entityId);
return entityIds;
}

/**
* Get a SAML2 entity provider's metadata URL by entity id
* @param {string} entityId SAML2 entity id
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,319 @@
{
"log": {
"_recordingName": "CirclesOfTrustOps/createCircleOfTrust()/1: Create circle of trust 'AzureCOT'",
"creator": {
"comment": "persister:fs",
"name": "Polly.JS",
"version": "6.0.6"
},
"entries": [
{
"_id": "b99c0b053badc3bee559d76455d722b9",
"_order": 0,
"cache": {},
"request": {
"bodySize": 325,
"cookies": [],
"headers": [
{
"name": "accept",
"value": "application/json, text/plain, */*"
},
{
"name": "content-type",
"value": "application/json"
},
{
"name": "user-agent",
"value": "@rockcarver/frodo-lib/2.0.0-43"
},
{
"name": "x-forgerock-transactionid",
"value": "frodo-1e60c1eb-7aa7-492d-88d9-925aab33fd54"
},
{
"name": "accept-api-version",
"value": "protocol=2.1,resource=1.0"
},
{
"name": "authorization",
"value": "Bearer <bearer token>"
},
{
"name": "content-length",
"value": 325
},
{
"name": "host",
"value": "openam-frodo-dev.forgeblocks.com"
}
],
"headersSize": 1646,
"httpVersion": "HTTP/1.1",
"method": "POST",
"postData": {
"mimeType": "application/json",
"params": [],
"text": "{\"_id\":\"AzureCOT\",\"_type\":{\"_id\":\"circlesoftrust\",\"collection\":true,\"name\":\"Circle of Trust\"},\"status\":\"active\",\"trustedProviders\":[\"iSPAzure|saml2\",\"urn:federation:MicrosoftOnline|saml2\",\"https://sts.windows.net/711ffa9c-5972-4713-ace3-688c9732614a/|saml2\",\"SPAzure|saml2\",\"https://idc.scheuber.io/am/saml2/IDPAzure|saml2\"]}"
},
"queryString": [
{
"name": "_action",
"value": "create"
}
],
"url": "https://openam-frodo-dev.forgeblocks.com/am/json/realms/root/realms/alpha/realm-config/federation/circlesoftrust/?_action=create"
},
"response": {
"bodySize": 108,
"content": {
"mimeType": "application/json;charset=UTF-8",
"size": 108,
"text": "{\"code\":500,\"reason\":\"Internal Server Error\",\"message\":\"Unable to update entity provider's circle of trust\"}"
},
"cookies": [],
"headers": [
{
"name": "x-frame-options",
"value": "SAMEORIGIN"
},
{
"name": "content-security-policy-report-only",
"value": "frame-ancestors 'self'; script-src 'self' 'unsafe-eval' 'unsafe-inline'"
},
{
"name": "x-content-type-options",
"value": "nosniff"
},
{
"name": "cache-control",
"value": "private"
},
{
"name": "content-api-version",
"value": "resource=1.0"
},
{
"name": "content-security-policy",
"value": "default-src 'none';frame-ancestors 'none';sandbox"
},
{
"name": "cross-origin-opener-policy",
"value": "same-origin"
},
{
"name": "cross-origin-resource-policy",
"value": "same-origin"
},
{
"name": "expires",
"value": "0"
},
{
"name": "pragma",
"value": "no-cache"
},
{
"name": "content-type",
"value": "application/json;charset=UTF-8"
},
{
"name": "content-length",
"value": "108"
},
{
"name": "date",
"value": "Sat, 21 Oct 2023 20:02:27 GMT"
},
{
"name": "x-forgerock-transactionid",
"value": "frodo-1e60c1eb-7aa7-492d-88d9-925aab33fd54"
},
{
"name": "strict-transport-security",
"value": "max-age=31536000; includeSubDomains; preload;"
},
{
"name": "via",
"value": "1.1 google"
},
{
"name": "alt-svc",
"value": "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000"
}
],
"headersSize": 746,
"httpVersion": "HTTP/1.1",
"redirectURL": "",
"status": 500,
"statusText": "Internal Server Error"
},
"startedDateTime": "2023-10-21T20:02:28.044Z",
"time": 182,
"timings": {
"blocked": -1,
"connect": -1,
"dns": -1,
"receive": 0,
"send": 0,
"ssl": -1,
"wait": 182
}
},
{
"_id": "29dcbb0bbcfb291f6bfae08d5712cf33",
"_order": 0,
"cache": {},
"request": {
"bodySize": 325,
"cookies": [],
"headers": [
{
"name": "accept",
"value": "application/json, text/plain, */*"
},
{
"name": "content-type",
"value": "application/json"
},
{
"name": "user-agent",
"value": "@rockcarver/frodo-lib/2.0.0-43"
},
{
"name": "x-forgerock-transactionid",
"value": "frodo-1e60c1eb-7aa7-492d-88d9-925aab33fd54"
},
{
"name": "accept-api-version",
"value": "protocol=2.1,resource=1.0"
},
{
"name": "authorization",
"value": "Bearer <bearer token>"
},
{
"name": "content-length",
"value": 325
},
{
"name": "host",
"value": "openam-frodo-dev.forgeblocks.com"
}
],
"headersSize": 1638,
"httpVersion": "HTTP/1.1",
"method": "PUT",
"postData": {
"mimeType": "application/json",
"params": [],
"text": "{\"_id\":\"AzureCOT\",\"_type\":{\"_id\":\"circlesoftrust\",\"collection\":true,\"name\":\"Circle of Trust\"},\"status\":\"active\",\"trustedProviders\":[\"iSPAzure|saml2\",\"urn:federation:MicrosoftOnline|saml2\",\"https://sts.windows.net/711ffa9c-5972-4713-ace3-688c9732614a/|saml2\",\"SPAzure|saml2\",\"https://idc.scheuber.io/am/saml2/IDPAzure|saml2\"]}"
},
"queryString": [],
"url": "https://openam-frodo-dev.forgeblocks.com/am/json/realms/root/realms/alpha/realm-config/federation/circlesoftrust/AzureCOT"
},
"response": {
"bodySize": 345,
"content": {
"mimeType": "application/json;charset=UTF-8",
"size": 345,
"text": "{\"_id\":\"AzureCOT\",\"_rev\":\"-954827061\",\"trustedProviders\":[\"iSPAzure|saml2\",\"urn:federation:MicrosoftOnline|saml2\",\"https://sts.windows.net/711ffa9c-5972-4713-ace3-688c9732614a/|saml2\",\"SPAzure|saml2\",\"https://idc.scheuber.io/am/saml2/IDPAzure|saml2\"],\"status\":\"active\",\"_type\":{\"_id\":\"circlesoftrust\",\"name\":\"Circle of Trust\",\"collection\":true}}"
},
"cookies": [],
"headers": [
{
"name": "x-frame-options",
"value": "SAMEORIGIN"
},
{
"name": "content-security-policy-report-only",
"value": "frame-ancestors 'self'; script-src 'self' 'unsafe-eval' 'unsafe-inline'"
},
{
"name": "x-content-type-options",
"value": "nosniff"
},
{
"name": "cache-control",
"value": "private"
},
{
"name": "content-api-version",
"value": "resource=1.0"
},
{
"name": "content-security-policy",
"value": "default-src 'none';frame-ancestors 'none';sandbox"
},
{
"name": "cross-origin-opener-policy",
"value": "same-origin"
},
{
"name": "cross-origin-resource-policy",
"value": "same-origin"
},
{
"name": "etag",
"value": "\"-954827061\""
},
{
"name": "expires",
"value": "0"
},
{
"name": "pragma",
"value": "no-cache"
},
{
"name": "content-type",
"value": "application/json;charset=UTF-8"
},
{
"name": "content-length",
"value": "345"
},
{
"name": "date",
"value": "Sat, 21 Oct 2023 20:02:27 GMT"
},
{
"name": "x-forgerock-transactionid",
"value": "frodo-1e60c1eb-7aa7-492d-88d9-925aab33fd54"
},
{
"name": "strict-transport-security",
"value": "max-age=31536000; includeSubDomains; preload;"
},
{
"name": "via",
"value": "1.1 google"
},
{
"name": "alt-svc",
"value": "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000"
}
],
"headersSize": 766,
"httpVersion": "HTTP/1.1",
"redirectURL": "",
"status": 200,
"statusText": "OK"
},
"startedDateTime": "2023-10-21T20:02:28.233Z",
"time": 84,
"timings": {
"blocked": -1,
"connect": -1,
"dns": -1,
"receive": 0,
"send": 0,
"ssl": -1,
"wait": 84
}
}
],
"pages": [],
"version": "1.2"
}
}
Loading

0 comments on commit 17b2561

Please sign in to comment.