Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
server
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
m-team
oidc
mytoken
server
Commits
2df6dd59
Commit
2df6dd59
authored
2 years ago
by
Gabriel Zachmann
Committed by
Gabriel Zachmann
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
add `r` parameter to mytoken creation in webinterface
parent
ba760845
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#323235
passed
2 years ago
Stage: build
Stage: test
Stage: lint
Stage: release
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CHANGELOG.md
+3
-0
3 additions, 0 deletions
CHANGELOG.md
internal/server/web/static/js/create-mt.js
+38
-1
38 additions, 1 deletion
internal/server/web/static/js/create-mt.js
with
41 additions
and
1 deletion
CHANGELOG.md
+
3
−
0
View file @
2df6dd59
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
internal/server/web/static/js/create-mt.js
+
38
−
1
View file @
2df6dd59
...
...
@@ -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
);
});
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment