47 lines
1.2 KiB
JavaScript
47 lines
1.2 KiB
JavaScript
import { generateNewId } from "oak-domain/lib/utils/uuid";
|
|
export default OakComponent({
|
|
entity: 'oauthApplication',
|
|
isList: false,
|
|
projection: {
|
|
name: 1,
|
|
description: 1,
|
|
redirectUris: 1,
|
|
logo: 1, // string
|
|
isConfidential: 1,
|
|
scopes: 1, // string[]
|
|
ableState: 1,
|
|
requirePKCE: 1,
|
|
},
|
|
formData({ data, features }) {
|
|
if (!data) {
|
|
return { item: {}, clientSecret: "" };
|
|
}
|
|
const [client] = features.cache.get("oauthApplication", {
|
|
data: {
|
|
clientSecret: 1,
|
|
},
|
|
filter: {
|
|
id: data.id,
|
|
}
|
|
});
|
|
return {
|
|
item: data,
|
|
clientSecret: client?.clientSecret || "",
|
|
isCreation: this.isCreation(),
|
|
};
|
|
},
|
|
properties: {},
|
|
methods: {
|
|
reGenerateClientSecret() {
|
|
this.features.cache.operate("oauthApplication", {
|
|
id: generateNewId(),
|
|
action: "resetSecret",
|
|
data: {},
|
|
filter: {
|
|
id: this.props.oakId,
|
|
}
|
|
});
|
|
}
|
|
}
|
|
});
|