import CRUDBase from '../CRUDBase.js' import { session } from '../../service/Session.service.js' class ClientResource extends CRUDBase { endpoint = '/openid/clients' required_fields = ['client_name', 'grant_types', 'redirect_uri'] permission_base = 'v1:openid:clients' item = 'OpenID Connect Client' plural = 'OpenID Connect Clients' listing_definition = { display: ` OpenID Connect clients are applications that support authentication over the OpenID Connect protocol. This allows you to add a "Sign-In with XXX" button for ${session.get('app.name')} to the application in question. To do this, the application need only comply with the OpenID standards. `, columns: [ { name: 'Client Name', field: 'client_name', }, { name: 'Redirect URI', field: 'redirect_uri', }, ], actions: [ { type: 'resource', position: 'main', action: 'insert', text: 'Create New', color: 'success', }, { type: 'resource', position: 'row', action: 'update', icon: 'fa fa-edit', color: 'primary', }, { type: 'resource', position: 'row', action: 'delete', icon: 'fa fa-times', color: 'danger', confirm: true, }, ], } form_definition = { fields: [ { name: 'Client Name', field: 'client_name', placeholder: 'Awesome External App', required: true, type: 'text', }, { name: 'Redirect URI', field: 'redirect_uri', placeholder: 'https://awesome.app/oauth2/callback', required: true, type: 'text', }, { name: 'Grant Types', field: 'grant_types', type: 'select.multiple', options: [ { display: 'Refresh Token', value: 'refresh_token' }, { display: 'Authorization Code', value: 'authorization_code' }, ], required: true, }, { name: 'Client ID', field: 'client_id', type: 'text', readonly: true, hidden: ['insert'], }, { name: 'Client Secret', field: 'client_secret', type: 'text', readonly: true, hidden: ['insert'], }, ], } } const openid_client = new ClientResource() export { openid_client }