Add support for OpenID connect!!

This commit is contained in:
garrettmills
2020-08-13 01:56:33 -05:00
parent 455e78bf14
commit d75944644a
21 changed files with 1313 additions and 19 deletions

View File

@@ -67,6 +67,12 @@ export default class SideBarComponent extends Component {
type: 'resource',
resource: 'oauth/Client',
},
{
text: 'OpenID Connect Clients',
action: 'list',
type: 'resource',
resource: 'openid/Client',
},
{
text: 'SAML Service Providers',
action: 'list',

View File

@@ -101,6 +101,16 @@ class AppResource extends CRUDBase {
value: 'id',
},
},
{
name: 'Associated OpenID Connect Clients',
field: 'openid_client_ids',
type: 'select.dynamic.multiple',
options: {
resource: 'openid/Client',
display: 'client_name',
value: 'id',
},
},
{
name: 'Associated SAML Service Providers',
field: 'saml_service_provider_ids',

View File

@@ -0,0 +1,97 @@
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 }