Skip to content

Commit

Permalink
Merge pull request #13 from kdesao-devops/keycloack-migration
Browse files Browse the repository at this point in the history
Keycloack migration
  • Loading branch information
wrnu authored Feb 8, 2023
2 parents 5b520ae + ff4a801 commit d60f184
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions lambda/samlpost/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,12 @@
decodedSAMLResponse
)}/protocol/saml/clients/amazon-aws`;

const logoutURL = `${getSAMLIssuer(
decodedSAMLResponse
)}/protocol/openid-connect/logout`;
const samlIssuerURL = getSAMLIssuer(decodedSAMLResponse)
const CaptureURLRegex = new RegExp(
"((http[s]):\\/?\\/?[^:\\/\\s]+)(\\/\\w+)*\\/[\\w\\-\\.]+[^#?\\s]+.*?(#[\\w\\-]+)?$"
)
let ParsedURL = samlIssuerURL.match(CaptureURLRegex)
const logoutURL = `${ParsedURL[1]}/auth/realms/standard/protocol/openid-connect/logout`

$("#logout").html(
`<a href="${logoutURL}?redirect_uri=${encodeURIComponent(
Expand Down Expand Up @@ -406,7 +409,7 @@
function parseSAMLResponse(samlResponse) {
//let capturingRegex = new RegExp(">(?<provider>arn:aws:iam::\\d+:saml-provider/\\S+),(?<role>arn:aws::iam::(?<accountid>\\d+):role/(?<rolename>\\w+))<");
let capturingRegex = new RegExp(
">(arn:aws:iam::\\d+:saml-provider/\\S+),(arn:aws:iam::(\\d+):role/(\\w+))<",
">(arn:aws:iam::\\d+:saml-provider/[a-zA-Z0-9-_@=+.]+),(arn:aws:iam::(\\d+):role/([a-zA-Z0-9-_@=+.]+))<",
"gi"
);
///>(arn:aws:iam::\d+:saml-provider\/\S+),(arn:aws:iam::(\d+):role\/(\w+))</gi
Expand Down
2 changes: 1 addition & 1 deletion lambda/samlpost/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ exports.handler = function (event, context, callback) {

function parseSAMLResponse(samlResponse) {
//let capturingRegex = new RegExp(">(?<provider>arn:aws:iam::\\d+:saml-provider/\\S+),(?<role>arn:aws::iam::(?<accountid>\\d+):role/(?<rolename>\\w+))<");
let capturingRegex = new RegExp(">(arn:aws:iam::\\d+:saml-provider/\\S+),(arn:aws:iam::(\\d+):role/(\\w+))<", "gi");
let capturingRegex = new RegExp(">(arn:aws:iam::\\d+:saml-provider/[a-zA-Z0-9-_@=+.]+),(arn:aws:iam::(\\d+):role/([a-zA-Z0-9-_@=+.]+))<", "gi");
///>(arn:aws:iam::\d+:saml-provider\/\S+),(arn:aws:iam::(\d+):role\/(\w+))</gi
let matches = samlResponse.matchAll(capturingRegex);

Expand Down

0 comments on commit d60f184

Please sign in to comment.