Abstract OAuth signing and make credentials extendable

This commit is contained in:
Jan Oberhauser
2020-01-13 20:46:58 -06:00
parent 740cb8a6fc
commit 8228b8505f
13 changed files with 283 additions and 15 deletions

View File

@@ -169,13 +169,21 @@ export default mixins(
},
methods: {
getCredentialTypeData (name: string): ICredentialType | null {
for (const credentialData of this.credentialTypes) {
if (credentialData.name === name) {
return credentialData;
}
let credentialData = this.$store.getters.credentialType(name);
if (credentialData === null || credentialData.extends === undefined) {
return credentialData;
}
return null;
// Credentials extends another one. So get the properties of the one it
// extends and add them.
credentialData = JSON.parse(JSON.stringify(credentialData));
for (const credentialTypeName of credentialData.extends) {
const data = this.$store.getters.credentialType(credentialTypeName);
credentialData.properties.push.apply(credentialData.properties, data.properties);
}
return credentialData;
},
credentialsCreated (data: ICredentialsDecryptedResponse): void {
this.$emit('credentialsCreated', data);