-
Notifications
You must be signed in to change notification settings - Fork 62
/
test_ui.html
42 lines (35 loc) · 902 Bytes
/
test_ui.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<!--
Copyright (c) HashiCorp, Inc.
SPDX-License-Identifier: MPL-2.0
-->
<!-- A minimal HTML page for simple testing via a UI without vault. -->
<html>
<body>
Role:<br>
<input id="role" type="text" value="test"/><br>
<button id="login">Login</button>
<script>
document.getElementById("login").addEventListener("click", doLogin);
function doLogin() {
role = document.getElementById("role").value;
fetch(`${window.location.origin}/v1/auth/jwt/oidc/auth_url`, {
method: "POST",
body: JSON.stringify({
role: role,
redirect_uri: `${window.location.origin}/v1/auth/jwt/oidc/callback`
})
}).then(function(response) {
return response.json();
}).then(function(myJSON) {
oidcAuth(myJSON.data.auth_url);
});
}
function oidcAuth(url) {
console.log(url);
url = url.replace("vaultserver", window.location.origin);
console.log(url);
location.replace(url);
}
</script>
</body>
</html>