From 05576f49fc889f058d32aa05f32685c31cbd25a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E9=9F=A9?= Date: Sat, 7 Dec 2019 12:10:41 +0800 Subject: [PATCH] feat: add saml --- src/models/oneid.ts | 9 +++++++++ src/oneid-app/admin/apps/AddApp.ts | 26 ++++++++++++++++++++++++-- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/src/models/oneid.ts b/src/models/oneid.ts index 413b5fb8..8acd5208 100644 --- a/src/models/oneid.ts +++ b/src/models/oneid.ts @@ -567,6 +567,12 @@ export class OAuthData { authorization_grant_type = 'authorization-code' } +export class SamlData { + entity_id = '' + acs = '' + sls = '' +} + export interface AccessPermData { permit_owners: { results: PermOwnerData[]; @@ -585,6 +591,7 @@ export interface AppData { oauth_app: OAuthData|null ldap_app?: object|null http_app?: object|null + saml_app?: SamlData|null auth_protocols: string[] access_perm: AccessPermData } @@ -603,6 +610,7 @@ export class App { obj.index = data.index obj.ldap_app = data.ldap_app obj.http_app = data.http_app + obj.saml_app = data.saml_app obj.auth_protocols = data.auth_protocols if (data.access_perm) { obj.permit_owners = data.access_perm.permit_owners.results @@ -619,6 +627,7 @@ export class App { oauth_app?: OAuthData|null = null ldap_app?: object|null = null http_app?: object|null = null + saml_app?: SamlData|null = null auth_protocols: string[] = [] permit_owners: PermOwnerData[] = []// 白名单 reject_owners: PermOwnerData[] = []// 黑名单 diff --git a/src/oneid-app/admin/apps/AddApp.ts b/src/oneid-app/admin/apps/AddApp.ts index f30b867f..73e054e1 100644 --- a/src/oneid-app/admin/apps/AddApp.ts +++ b/src/oneid-app/admin/apps/AddApp.ts @@ -1,4 +1,4 @@ -import {App, OAuthData} from '@/models/oneid' +import {App, OAuthData, SamlData} from '@/models/oneid' import * as api from '@/services/oneid' import { Component, Vue, Watch } from 'vue-property-decorator' import './AddApp.less' @@ -93,6 +93,17 @@ import './AddApp.less' + + + + + + + + + + + @@ -122,7 +133,7 @@ export default class AddApp extends Vue { 'oauth_app.redirect_uris': [required], } } - authTypes = ['OAuth 2.0', 'LDAP', 'HTTP'] + authTypes = ['OAuth 2.0', 'LDAP', 'HTTP', 'SAML2'] selectedAuthTypes?: string[] = [] clientTypes = ['confidential', 'public'] grantTypes = ['authorization-code', 'implicit', 'password', 'client'] @@ -132,6 +143,7 @@ export default class AddApp extends Vue { super() const newApp = new App() newApp.oauth_app = new OAuthData() + newApp.saml_app = new SamlData() this.app = newApp } @@ -218,6 +230,16 @@ export default class AddApp extends Vue { params.http_app = null } + if (this.app!.auth_protocols.includes(this.authTypes[3])) { + params.saml_app = { + entity_id: this.app!.saml_app!.entity_id, + acs: this.app!.saml_app!.acs, + sls: this.app!.saml_app!.sls, + } + } else { + params.saml_app = null + } + return params }