Skip to content
This repository has been archived by the owner on Jan 19, 2023. It is now read-only.

Commit

Permalink
Merge pull request #51 from longguikeji/lh/add-saml
Browse files Browse the repository at this point in the history
feat: add saml
  • Loading branch information
amoslei authored Dec 9, 2019
2 parents b06c245 + 05576f4 commit 54c8cc1
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
9 changes: 9 additions & 0 deletions src/models/oneid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[];
Expand All @@ -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
}
Expand All @@ -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
Expand All @@ -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[] = []// 黑名单
Expand Down
26 changes: 24 additions & 2 deletions src/oneid-app/admin/apps/AddApp.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -93,6 +93,17 @@ import './AddApp.less'
</FormItem>
</div>
</TabPane>
<TabPane v-if="app.auth_protocols.includes(authTypes[3])" :label="authTypes[3]" :name="authTypes[3]">
<FormItem prop="app.saml_app.entity_id" label="entity_id">
<Input type="text" v-model="app.saml_app.entity_id" placeholder="请输入 entity_id..."></Input>
</FormItem>
<FormItem prop="app.saml_app.acs" label="acs">
<Input type="text" v-model="app.saml_app.acs" placeholder="请输入 acs..."></Input>
</FormItem>
<FormItem prop="app.saml_app.sls" label="sls">
<Input type="text" v-model="app.saml_app.sls" placeholder="请输入 sls..."></Input>
</FormItem>
</TabPane>
</Tabs>
</Form>
</div>
Expand Down Expand Up @@ -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']
Expand All @@ -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
}

Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit 54c8cc1

Please sign in to comment.