Skip to content

Commit

Permalink
add protocols support to palantir
Browse files Browse the repository at this point in the history
  • Loading branch information
mmoayyed committed Aug 1, 2024
1 parent 192cad7 commit 114f6b5
Show file tree
Hide file tree
Showing 8 changed files with 150 additions and 6 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ googleZxingVersion=3.5.3
###############################
# Duo Security MFA versions
###############################
duoClientVersion=0.6.2
duoClientVersion=0.6.3
duoUniversalSdkVersion=1.1.3
###############################
# Google Cloud/Firebase versions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,15 @@ span button.toolbar {
}

.h-350px {
height: 450px;
height: 350px;
}

.h-250px {
height: 250px;
}

.h-150px {
height: 150px;
}

.h-25 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ const Tabs = {
CONFIGURATION: 7,
PERSON_DIRECTORY: 8,
AUTHENTICATION: 9,
CONSENT: 10
CONSENT: 10,
PROTOCOLS: 11
};

/**
Expand Down Expand Up @@ -2049,6 +2050,35 @@ async function initializeConfigurationOperations() {
}
}

async function initializeCasProtocolOperations() {
function buildCasProtocolPayload(endpoint,format) {
const form = document.getElementById("fmCasProtocol");
if (!form.reportValidity()) {
return false;
}
const username = $("#casProtocolUsername").val();
const password = $("#casProtocolPassword").val();
const service = $("#casProtocolService").val();

$.post(`${actuatorEndpoints.casvalidate}/${endpoint}`, {
username: username,
password: password,
service: service
}, data => {
const editor = initializeAceEditor("casProtocolEditor", format);
editor.setReadOnly(true);
editor.setValue(data);
editor.gotoLine(1);
}).fail((xhr, status, error) => {
displayErrorInBanner(xhr);
});
}

$("button[name=casProtocolV1Button]").off().on("click", () => buildCasProtocolPayload("validate", "text"));
$("button[name=casProtocolV2Button]").off().on("click", () => buildCasProtocolPayload("serviceValidate", "xml"));
$("button[name=casProtocolV3Button]").off().on("click", () => buildCasProtocolPayload("p3/serviceValidate", "xml"));
}

async function initializePalantir() {
try {
await Promise.all([
Expand All @@ -2063,7 +2093,8 @@ async function initializePalantir() {
initializeConfigurationOperations(),
initializePersonDirectoryOperations(),
initializeAuthenticationOperations(),
initializeConsentOperations()
initializeConsentOperations(),
initializeCasProtocolOperations()
]);
setTimeout(() => {
if (!actuatorEndpoints.registeredservices) {
Expand Down Expand Up @@ -2111,6 +2142,9 @@ async function initializePalantir() {
$("#consentTabButton").addClass("d-none");
$(`#attribute-tab-${Tabs.CONSENT}`).addClass("d-none");
}
if (!actuatorEndpoints.casvalidate) {
$("#casProtocolContainer").addClass("d-none");
}

let visibleCount = $("nav.sidebar-navigation ul li:visible").length;
console.log("Number of visible list items:", visibleCount);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
</head>
<body>
<span th:fragment="main">
<h3>Attribute Consent</h3>
<div class="attribute-tab w-100 d-none" id="attribute-tab-10">
<h3>Attribute Consent</h3>
<table id="consentTable" class="mdc-data-table__table table table-striped noborder">
<thead>
<tr class="mdc-data-table__header-row">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,18 @@ <h2>Something went wrong!</h2>
<span class="mdc-tab__ripple"></span>
<div class="mdc-tab__focus-ring"></div>
</button>

<button class="mdc-tab" role="tab" aria-selected="true">
<span class="mdc-tab__content">
<span class="mdc-tab__text-label">
<i class="mdc-tab__icon mdi mdi-protocol"
aria-hidden="true"></i>Protocols</span>
</span>
<span class="mdc-tab-indicator">
<span class="mdc-tab-indicator__content mdc-tab-indicator__content--underline"></span>
</span>
<span class="mdc-tab__ripple"></span>
<div class="mdc-tab__focus-ring"></div>
</button>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@
<i class="mdi mdi-checkerboard" aria-hidden="true"></i>
<span class="tooltip">Attribute Consent Decisions and Records</span>
</li>
<li id="protocolsTabButton" data-tab-index="11">
<i class="mdi mdi-protocol" aria-hidden="true"></i>
<span class="tooltip">Authentication Protocols (CAS, SAML2, OpenID Connect, etc)</span>
</li>
</ul>
</nav>
</span>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
</head>
<body>
<span th:fragment="main">
<div class="attribute-tab w-100" id="attribute-tab-11">
<section id="casProtocolContainer">
<h3>CAS Protocol</h3>
<form id="fmCasProtocol" class="d-block">
<section class="cas-field form-group my-3 mdc-input-group d-flex">
<div class="mdc-input-group-field mdc-input-group-field-append w-100">
<label for="casProtocolService"
class="mdc-text-field mdc-text-field--outlined control-label mdc-text-field--with-trailing-icon mb-2">
<span class="mdc-notched-outline">
<span class="mdc-notched-outline__leading"></span>
<span class="mdc-notched-outline__notch">
<span class="mdc-floating-label">Service</span>
</span>
<span class="mdc-notched-outline__trailing"></span>
</span>
<input class="mdc-text-field__input form-control" type="text"
name="casProtocolService" data-param-name="service" tabindex="0"
id="casProtocolService" size="50" autocomplete="off" required />
</label>
<label for="casProtocolUsername"
class="mdc-text-field mdc-text-field--outlined control-label mdc-text-field--with-trailing-icon mb-2">
<span class="mdc-notched-outline">
<span class="mdc-notched-outline__leading"></span>
<span class="mdc-notched-outline__notch">
<span class="mdc-floating-label">Username</span>
</span>
<span class="mdc-notched-outline__trailing"></span>
</span>
<input class="mdc-text-field__input form-control" type="text"
name="casProtocolUsername" data-param-name="username"
tabindex="0" id="casProtocolUsername" size="50" autocomplete="off" required/>
</label>
<label for="casProtocolPassword"
class="mdc-text-field mdc-text-field--outlined control-label mdc-text-field--with-trailing-icon mb-2">
<span class="mdc-notched-outline">
<span class="mdc-notched-outline__leading"></span>
<span class="mdc-notched-outline__notch">
<span class="mdc-floating-label">Password</span>
</span>
<span class="mdc-notched-outline__trailing"></span>
</span>
<input class="mdc-text-field__input form-control pwd" type="password"
name="casProtocolPassword" data-param-name="password" tabindex="0"
id="casProtocolPassword" size="50" autocomplete="off"/>
<button
class="reveal-password align-self-end mdc-button mdc-button--raised btn btn-primary mdc-input-group-append mdc-icon-button"
tabindex="-1"
type="button">
<i class="mdi mdi-eye fas fa-eye reveal-password-icon" style="vertical-align: middle;" aria-hidden="true"></i>
<span class="visually-hidden">Toggle Token</span>
</button>
</label>
</div>

</section>
<div class="d-flex">
<button type="button" name="casProtocolV1Button" id="casProtocolV1Button" class="mdc-button mdc-button--raised">
<span class="mdc-button__label"><i class="mdc-tab__icon mdi mdi-check-all" aria-hidden="true"></i>V1 Protocol</span>
</button>
<button type="button" name="casProtocolV2Button" id="casProtocolV2Button" class="mdc-button mdc-button--raised">
<span class="mdc-button__label"><i class="mdc-tab__icon mdi mdi-check-all" aria-hidden="true"></i>V2 Protocol</span>
</button>
<button type="button" name="casProtocolV3Button" id="casProtocolV3Button" class="mdc-button mdc-button--raised">
<span class="mdc-button__label"><i class="mdc-tab__icon mdi mdi-check-all" aria-hidden="true"></i>V3 Protocol</span>
</button>
</div>
</form>
<hr>
<section class="my-3 d-flex h-250px" id="casProtocolEditorContainer">
<pre class="ace-editor ace-relative w-100 h-100" id="casProtocolEditor"></pre>
</section>
<hr>
</section>
</div>
</span>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
<div th:replace="~{fragments/palantir/persondirectorytab :: main}"/>
<div th:replace="~{fragments/palantir/authenticationtab :: main}"/>
<div th:replace="~{fragments/palantir/consenttab :: main}"/>
<div th:replace="~{fragments/palantir/protocolstab :: main}"/>
</div>

</div>
Expand Down

0 comments on commit 114f6b5

Please sign in to comment.