15 changed files with 209 additions and 57 deletions
@ -1,7 +1,13 @@
@@ -1,7 +1,13 @@
|
||||
/* © SRSoftware 2024 */ |
||||
package de.srsoftware.oidc.api; |
||||
|
||||
import static de.srsoftware.oidc.api.Constants.*; |
||||
|
||||
import java.util.Map; |
||||
import java.util.Set; |
||||
|
||||
public record Client(String id, String name, String secret, Set<String> redirectUris) { |
||||
public Map<String, Object> map() { |
||||
return Map.of(CLIENT_ID, id, NAME, name, SECRET, secret, REDIRECT_URIS, redirectUris); |
||||
} |
||||
} |
||||
|
@ -0,0 +1,41 @@
@@ -0,0 +1,41 @@
|
||||
<html> |
||||
<head> |
||||
<meta charset="utf-8"> |
||||
<title>Light OIDC</title> |
||||
<script src="common.js"></script> |
||||
<script src="user.js"></script> |
||||
<script src="edit_client.js"></script> |
||||
<link rel="stylesheet" href="style.css" /> |
||||
</head> |
||||
<body> |
||||
<nav></nav> |
||||
<h1>Edit client</h1> |
||||
<fieldset> |
||||
<legend>Data</legend> |
||||
<table> |
||||
<tr> |
||||
<th>ID</th> |
||||
<td><input type="text" disabled="true" id="client_id" /></td> |
||||
</tr> |
||||
<tr> |
||||
<th>Name</th> |
||||
<td><input type="text" id="name" /></td> |
||||
</tr> |
||||
<tr> |
||||
<th>Secret</th> |
||||
<td><input type="text" id="secret" /></td> |
||||
</tr> |
||||
<tr> |
||||
<th>Redirect URIs</th> |
||||
<td> |
||||
<textarea id="redirects"></textarea> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td></td> |
||||
<td><button type="button" id="button">Update</button></td> |
||||
</tr> |
||||
</table> |
||||
</fieldset> |
||||
</body> |
||||
</html> |
@ -0,0 +1,20 @@
@@ -0,0 +1,20 @@
|
||||
var params = new URLSearchParams(window.location.search); |
||||
var id = params.get('id'); |
||||
|
||||
fetch(api+'/client', |
||||
{ |
||||
method: 'POST', |
||||
body: JSON.stringify({ |
||||
client_id : id |
||||
}) |
||||
}).then(handleResponse); |
||||
|
||||
async function handleResponse(response){ |
||||
if (response.ok){ |
||||
var json = await response.json(); |
||||
get('client_id').value = json.client_id; |
||||
get('name').value = json.name; |
||||
get('secret').value = json.secret; |
||||
get('redirects').value = json.redirect_uris.join("\n"); |
||||
} |
||||
} |
Loading…
Reference in new issue