8000 Fix not update certificate value when import key. by mikoto2000 · Pull Request #39410 · keycloak/keycloak · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix not update certificate value when import key. #39410

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion js/apps/admin-ui/src/clients/keys/SamlImportKeyDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ import { SamlKeysDialogForm, submitForm } from "./SamlKeysDialog";
type SamlImportKeyDialogProps = {
id: string;
attr: KeyTypes;
onSubmit: (cert: string) => void;
onClose: () => void;
};

export const SamlImportKeyDialog = ({
id,
attr,
onSubmit,
onClose,
}: SamlImportKeyDialogProps) => {
const { adminClient } = useAdminClient();
Expand All @@ -28,11 +30,14 @@ export const SamlImportKeyDialog = ({
const { addAlert, addError } = useAlerts();

const submit = (form: SamlKeysDialogForm) => {
submitForm(adminClient, form, id, attr, (error) => {
submitForm(adminClient, form, id, attr, (certificate, error) => {
if (error) {
addError("importError", error);
} else {
addAlert(t("importSuccess"), AlertVariant.success);
if (certificate) {
onSubmit(certificate);
}
}
});
};
Expand Down
1 change: 1 addition & 0 deletions js/apps/admin-ui/src/clients/keys/SamlKeys.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ export const SamlKeys = ({ clientId, save }: SamlKeysProps) => {
<SamlImportKeyDialog
id={clientId}
attr={attr}
string) => setKeyInfo([{ certificate: cert }])}
=> setImportOpen(undefined)}
/>
)}
Expand Down
8 changes: 4 additions & 4 deletions js/apps/admin-ui/src/clients/keys/SamlKeysDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const submitForm = async (
form: SamlKeysDialogForm,
id: string,
attr: KeyTypes,
callback: (error?: unknown) => void,
callback: (certificate?: string, error?: unknown) => void,
) => {
try {
const formData = new FormData();
Expand All @@ -58,10 +58,10 @@ export const submitForm = async (
);
formData.append("file", file);

await adminClient.clients.uploadKey({ id, attr }, formData);
callback();
const result = await adminClient.clients.uploadKey({ id, attr }, formData);
callback(result.certificate);
} catch (error) {
callback(error);
callback(undefined, error);
}
};

Expand Down
Loading
0