Icu 5578 - introduce injected application credential on the api (#1269)

* chore: 🤖 include injected cred sources to the target model
This commit is contained in:
Dharini Jeeva authored and GitHub committed 2022-09-01 10:07:36 -07:00
1 parent bd0854b0f6
commit 2614b311a1
11 files changed
+395 -171

No files matched your search

+36 -7
View File
@@ -21,11 +21,20 @@ export default class TargetSerializer extends ApplicationSerializer {
if (hostSourceIDs) {
serialized = this.serializeWithHostSources(snapshot, hostSourceIDs);
}
const credentialSourceIDs = snapshot?.adapterOptions?.credentialSourceIDs;
if (credentialSourceIDs)
serialized = this.serializeWithCredentialSources(
const brokeredCredentialSourceIDs =
snapshot?.adapterOptions?.brokeredCredentialSourceIDs;
const injectedApplicationCredentialSourceIDs =
snapshot?.adapterOptions?.injectedApplicationCredentialSourceIDs;
if (brokeredCredentialSourceIDs)
serialized = this.serializeWithBrokeredCredentialSources(
snapshot,
credentialSourceIDs
brokeredCredentialSourceIDs
);
if (injectedApplicationCredentialSourceIDs)
serialized = this.serializeWithInjectedApplicationCredentialSources(
snapshot,
injectedApplicationCredentialSourceIDs
);
return serialized;
}
@@ -48,13 +57,33 @@ export default class TargetSerializer extends ApplicationSerializer {
* Returns a payload containing only version and an array of passed IDs,
* rather than existing instances on the model.
* @param {Snapshot} snapshot
* @param {[string]} credentialSourceIDs
* @param {[string]} brokered_credential_source_ids
* @return {object}
*/
serializeWithCredentialSources(snapshot, credentialSourceIDs) {
serializeWithBrokeredCredentialSources(
snapshot,
brokered_credential_source_ids
) {
return {
version: snapshot.attr('version'),
brokered_credential_source_ids: credentialSourceIDs,
brokered_credential_source_ids,
};
}
/**
* Returns a payload containing only version and an array of passed IDs,
* rather than existing instances on the model.
* @param {Snapshot} snapshot
* @param {[string]} injected_application_credential_source_ids
* @return {object}
*/
serializeWithInjectedApplicationCredentialSources(
snapshot,
injected_application_credential_source_ids
) {
return {
version: snapshot.attr('version'),
injected_application_credential_source_ids,
};
}
}