diff --git a/dashboard/src/components/ExternalLdap.vue b/dashboard/src/components/ExternalLdap.vue index dec51f7c7..76797c7d3 100644 --- a/dashboard/src/components/ExternalLdap.vue +++ b/dashboard/src/components/ExternalLdap.vue @@ -387,24 +387,3 @@ onMounted(async () => { - - diff --git a/dashboard/src/components/OpenIdClients.vue b/dashboard/src/components/OpenIdClients.vue new file mode 100644 index 000000000..79a7db24b --- /dev/null +++ b/dashboard/src/components/OpenIdClients.vue @@ -0,0 +1,104 @@ + + + + + + + + + {{ $t('oidc.env.discoveryUrl') }} + https://{{ adminFqdn }}/.well-known/openid-configuration + + + + {{ $t('oidc.clients.title') }} + {{ $t('oidc.clients.newClient') }} + + + + + + + + + + + + + + + diff --git a/dashboard/src/components/UserDirectoryView.vue b/dashboard/src/components/UserDirectoryView.vue index 92976259e..03446206b 100644 --- a/dashboard/src/components/UserDirectoryView.vue +++ b/dashboard/src/components/UserDirectoryView.vue @@ -7,6 +7,7 @@ import { Button, Checkbox } from 'pankow'; import Section from './Section.vue'; import ExternalLdap from './ExternalLdap.vue'; import ExposedLdap from './ExposedLdap.vue'; +import OpenIdClients from './OpenIdClients.vue'; import UserDirectoryModel from '../models/UserDirectoryModel.js'; const userDirectoryModel = UserDirectoryModel.create(API_ORIGIN, localStorage.token); @@ -55,6 +56,6 @@ onMounted(async () => { - + diff --git a/dashboard/src/models/UserDirectoryModel.js b/dashboard/src/models/UserDirectoryModel.js index e7b7f41f9..35147d87b 100644 --- a/dashboard/src/models/UserDirectoryModel.js +++ b/dashboard/src/models/UserDirectoryModel.js @@ -86,6 +86,50 @@ function create(origin, accessToken) { if (error || result.status !== 202) return [error || result]; return [null]; }, + async getOpenIdClients() { + let error, result; + try { + result = await fetcher.get(`${origin}/api/v1/oidc/clients`, { access_token: accessToken }); + } catch (e) { + error = e; + } + + if (error || result.status !== 200) return [error || result]; + return [null, result.body.clients]; + }, + async addOpenIdClient(name, loginRedirectUri, tokenSignatureAlgorithm) { + let error, result; + try { + result = await fetcher.post(`${origin}/api/v1/oidc/clients`, { name, loginRedirectUri, tokenSignatureAlgorithm }, { access_token: accessToken }); + } catch (e) { + error = e; + } + + if (error || result.status !== 201) return [error || result]; + return [null]; + }, + async updateOpenIdClient(id, name, loginRedirectUri, tokenSignatureAlgorithm) { + let error, result; + try { + result = await fetcher.post(`${origin}/api/v1/oidc/clients/${id}`, { name, loginRedirectUri, tokenSignatureAlgorithm }, { access_token: accessToken }); + } catch (e) { + error = e; + } + + if (error || result.status !== 201) return [error || result]; + return [null]; + }, + async removeOpenIdClient(id) { + let error, result; + try { + result = await fetcher.del(`${origin}/api/v1/oidc/clients/${id}`, { access_token: accessToken }); + } catch (e) { + error = e; + } + + if (error || result.status !== 204) return [error || result]; + return [null]; + }, }; } diff --git a/dashboard/src/style.css b/dashboard/src/style.css index 71c388873..9b787b173 100644 --- a/dashboard/src/style.css +++ b/dashboard/src/style.css @@ -128,3 +128,21 @@ tr:hover .table-actions { .text-small { font-size: 12px; } + +/* info table label:value in Sections */ +.info-row { + display: flex; +} + +.info-label { + font-weight: bold; + flex-basis: 50%; +} + +.info-value { + flex-basis: 50%; + text-align: right; + text-overflow: ellipsis; + overflow: hidden; + text-wrap: nowrap; +} \ No newline at end of file