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 #52 from longguikeji/lh/saml-file-upload
Browse files Browse the repository at this point in the history
feat: saml支持文件上传
  • Loading branch information
amoslei authored Dec 11, 2019
2 parents 54c8cc1 + 2f7cb16 commit f437af7
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/models/oneid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,8 @@ export class SamlData {
entity_id = ''
acs = ''
sls = ''
cert = ''
xmldata = ''
}

export interface AccessPermData {
Expand Down
32 changes: 29 additions & 3 deletions src/oneid-app/admin/apps/AddApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,30 @@ import './AddApp.less'
</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">
<FormItem prop="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">
<FormItem prop="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">
<FormItem prop="saml_app.sls" label="sls:">
<Input type="text" v-model="app.saml_app.sls" placeholder="请输入 sls..."></Input>
</FormItem>
<FormItem prop="saml_app.cert" label="证书(x509):">
<Input type="textarea" v-model="app.saml_app.cert" placeholder="请输入 证书内容..."></Input>
</FormItem>
<FormItem prop="saml_app.xmldata" label="上传元数据文档:">
<Upload
name="xmlFile"
action=""
accept=".xml"
:show-upload-list="false"
:before-upload="handleBeforeUpload"
:max-size="100"
>
<Button>上传文件</Button>
</Upload>
</FormItem>
</TabPane>
</Tabs>
</Form>
Expand Down Expand Up @@ -235,6 +250,8 @@ export default class AddApp extends Vue {
entity_id: this.app!.saml_app!.entity_id,
acs: this.app!.saml_app!.acs,
sls: this.app!.saml_app!.sls,
cert: this.app!.saml_app!.cert,
xmldata: this.app!.saml_app!.xmldata,
}
} else {
params.saml_app = null
Expand Down Expand Up @@ -286,4 +303,13 @@ export default class AddApp extends Vue {
this.showAdd = false
this.$emit('on-change')
}

handleBeforeUpload(file: File) {
const reader = new FileReader()
reader.readAsText(file)
reader.onload = (e) => {
this.app!.saml_app!.xmldata = e.target!.result as string
}
return false
}
}

0 comments on commit f437af7

Please sign in to comment.