Stephan Richter
4 months ago
7 changed files with 103 additions and 37 deletions
@ -1,8 +1,9 @@
@@ -1,8 +1,9 @@
|
||||
/* © SRSoftware 2024 */ |
||||
package de.srsoftware.oidc.api; |
||||
|
||||
public class Constants { |
||||
public static final String CLIENT_ID = "client_id"; |
||||
public static final String NAME = "name"; |
||||
public static final String REDIRECT_URI = "redirect_uri"; |
||||
public static final String SECRET = "secret"; |
||||
public static final String CLIENT_ID = "client_id"; |
||||
public static final String NAME = "name"; |
||||
public static final String REDIRECT_URI = "redirect_uri"; |
||||
public static final String SECRET = "secret"; |
||||
} |
||||
|
@ -1,11 +1,30 @@
@@ -1,11 +1,30 @@
|
||||
|
||||
async function handleClients(response){ |
||||
if (response.status == UNAUTHORIZED) { |
||||
redirect('login.html?return_to='+encodeURI(window.location.href)) |
||||
return; |
||||
} |
||||
var clients = await response.json(); |
||||
get() |
||||
var bottom = document.getElementById('bottom'); |
||||
for (let id in clients){ |
||||
var row = document.createElement("tr"); |
||||
var client = clients[id]; |
||||
row.innerHTML = "<td>"+client.name+"</td>\n<td>"+id+"</td>\n<td>"+client.redirect_uris.join("<br/>")+'</td>\n<td><button onclick="remove(\''+id+'\')" type="button">remove '+client.name+'</button></td>'; |
||||
bottom.parentNode.insertBefore(row,bottom); |
||||
} |
||||
} |
||||
|
||||
function handleRemove(response){ |
||||
redirect("clients.html"); |
||||
} |
||||
|
||||
function remove(clientId){ |
||||
var message = document.getElementById('message').innerHTML; |
||||
if (confirm(message.replace("{}",clientId))) { |
||||
fetch(api+"/client",{ |
||||
method: 'DELETE', |
||||
body : JSON.stringify({ client_id : clientId }) |
||||
}).then(handleRemove); |
||||
} |
||||
} |
||||
|
||||
fetch(api+"/clients",{method:'POST'}).then(handleClients); |
Loading…
Reference in new issue