Skip to content
Snippets Groups Projects
Commit 2df6dd59 authored by Gabriel Zachmann's avatar Gabriel Zachmann Committed by Gabriel Zachmann
Browse files

add `r` parameter to mytoken creation in webinterface

parent ba760845
No related branches found
No related tags found
No related merge requests found
Pipeline #323235 passed
......@@ -33,6 +33,9 @@
- Mytokens are still directly deleted when revoked.
- Requests from private IPs (e.g. from within the same entwork where the server is located) are now geolocated to
the country where the server stands.
- The 'Create Mytoken' tab in the webitnerface now supports an `r` query parameter that takes a base64 encoded
request from which the form is prefilled.
- This allows 'create-a-mytoken-with-these-properties' links.
### API
......
......@@ -22,11 +22,48 @@ function initCreateMT(...next) {
initCapabilities(mtPrefix);
checkCapability("tokeninfo", mtPrefix);
checkCapability("AT", mtPrefix);
updateRotationIcon(mtPrefix);
initRestr(mtPrefix);
fillPropertiesFromQuery();
updateRotationIcon(mtPrefix);
doNext(...next);
}
function fillPropertiesFromQuery() {
const params = new Proxy(new URLSearchParams(window.location.search), {
get: (searchParams, prop) => searchParams.get(prop),
});
const base64 = params.r;
const req_str = window.atob(base64);
console.log(req_str);
const req = JSON.parse(req_str);
if (req.name !== undefined) {
$('#tokenName').val(req.name);
}
if (req.oidc_issuer !== undefined) {
$mtOIDCIss.val(req.oidc_issuer);
}
if (req.restrictions !== undefined) {
setRestrictionsData(req.restrictions, mtPrefix);
RestrToGUI(mtPrefix);
}
if (req.response_type !== undefined) {
$('#select-token-type').val(req.response_type);
}
if (req.rotation !== undefined) {
rotationAT(mtPrefix).prop("checked", req.rotation.on_AT || false);
rotationOther(mtPrefix).prop("checked", req.rotation.on_other || false);
rotationLifetime(mtPrefix).val(req.rotation.lifetime);
rotationAutoRevoke(mtPrefix).prop("checked", req.rotation.auto_revoke || false);
}
if (req.capabilities !== undefined) {
capabilityChecks(mtPrefix).prop("checked", false);
req.capabilities.forEach(function (c) {
checkCapability(c, mtPrefix);
});
}
}
$mtOIDCIss.on('change', function () {
initRestrGUI(mtPrefix);
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment