theme.keycloak.v2.admin.resources.assets.AddOpenIdConnect-B-p6aRm7.js Maven / Gradle / Ivy
import{jsxs as d,Fragment as v,jsx as e}from"react/jsx-runtime";import{u as g,a as h,aj as C,T as P,ac as S,ad as b,aq as k,d as D,bK as E,g as O,f as A,c as x,P as w,F as j,A as L,h as f,L as T,cw as U,j as V,cx as K}from"./index-C1LIsRX7.js";import{F as z}from"./FormAccess-BcY70QlP.js";import{V as G}from"./ViewHeader-qjLr6U82.js";import{D as H,O as J,a as N}from"./OIDCGeneralSettings-BOJlg0zL.js";import{J as B}from"./JsonFileUpload-C06Nil7S.js";import{D as _}from"./DiscoveryEndpointField-D6J04Afm.js";import"react";import"react-dom";import"./copy-icon-DOS8MmN7.js";import"./SwitchControl-C3zDl-9W.js";/* empty css */import"./ExpandableSection-DLsX7rbK.js";import"./ClientIdSecret-B8yoPK02.js";import"./DisplayOrder-eyXhXEFD.js";import"./FileUploadForm-DXJKFbGA.js";import"./FileUpload-T43Q4AfB.js";import"./CodeEditor-CIeIZGz7.js";import"./EmptyStateFooter-Cm2IMTi1.js";import"./EmptyStateActions-DBSnfkAA.js";const $=()=>{const{adminClient:l}=g(),{t}=h(),m="oidc",{setValue:p,setError:c,clearErrors:s,formState:{errors:o}}=C(),u=r=>{Object.keys(r).map(i=>p(`config.${i}`,r[i]))},y=async r=>{if(s("discoveryError"),!r)return;const i=new FormData;i.append("providerId",m),i.append("file",new Blob([JSON.stringify(r)]));try{const a=await l.identityProviders.importFromUrl(i);u(a)}catch(a){c("discoveryError",{type:"manual",message:a.message})}};return d(v,{children:[e(P,{headingLevel:"h2",size:"xl",className:"kc-form-panel__title",children:t("oidcSettings")}),e(_,{id:"oidc",fileUpload:d(S,{label:t("importConfig"),fieldId:"kc-import-config",labelIcon:e(b,{helpText:t("importConfigHelp"),fieldLabelId:"importConfig"}),children:[e(B,{id:"kc-import-config",helpText:t("identity=providers-help:jsonFileUpload"),hideDefaultPreview:!0,unWrap:!0,validated:o.discoveryError?"error":"default",onChange:r=>y(r)}),o.discoveryError&&e(k,{message:o.discoveryError.message})]}),children:r=>e(H,{readOnly:r})})]})};function pe(){const{adminClient:l}=g(),{t}=h(),m=D(),{pathname:p}=E(),c=p.includes("keycloak-oidc"),s=`${c?"keycloak-":""}oidc`,o=O({defaultValues:{alias:s},mode:"onChange"}),{handleSubmit:u,formState:{isDirty:y}}=o,{addAlert:r,addError:i}=A(),{realm:a}=x(),I=async n=>{delete n.discoveryEndpoint;try{await l.identityProviders.create({...n,providerId:s}),r(t("createIdentityProviderSuccess"),V.success),m(K({realm:a,providerId:s,alias:n.alias,tab:"settings"}))}catch(F){i("createIdentityProviderError",F)}};return d(v,{children:[e(G,{titleKey:t(c?"addKeycloakOpenIdProvider":"addOpenIdProvider")}),e(w,{variant:"light",children:e(j,{...o,children:d(z,{role:"manage-identity-providers",isHorizontal:!0,onSubmit:u(I),children:[e(J,{}),e($,{}),e(N,{}),d(L,{children:[e(f,{isDisabled:!y,variant:"primary",type:"submit","data-testid":"createProvider",children:t("add")}),e(f,{variant:"link","data-testid":"cancel",component:n=>e(T,{...n,to:U({realm:a})}),children:t("cancel")})]})]})})})]})}export{pe as default};
//# sourceMappingURL=AddOpenIdConnect-B-p6aRm7.js.map
© 2015 - 2025 Weber Informatics LLC | Privacy Policy