All Downloads are FREE. Search and download functionalities are using the official Maven repository.

theme.keycloak.v2.admin.resources.assets.AddOpenIdConnect-Cs8jn03U.js Maven / Gradle / Ivy

There is a newer version: 26.0.7
Show newest version
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 k,ad as S,aq as b,d as D,bL as E,g as O,f as A,c as x,P as w,F as L,A as j,i as f,L as T,cw as U,k as V,cx as z}from"./main-C7ps2lmX.js";import{F as G}from"./FormAccess-DyLNkc18.js";import{V as H}from"./ViewHeader-B7eeFzFA.js";import{D as J,O as K,a as N}from"./OIDCGeneralSettings--wdBI6nV.js";import{J as B}from"./JsonFileUpload-DGJ9M0nq.js";import{D as _}from"./DiscoveryEndpointField-DMZro08f.js";import"react";import"react-dom";import"./copy-icon-ACZmDH8e.js";import"./SwitchControl-C_9Y74oV.js";/* empty css                           */import"./ExpandableSection-CSay1Wbo.js";import"./ClientIdSecret-D4xxDCdD.js";import"./DisplayOrder-BDgUHroI.js";import"./FileUploadForm-BgyzQxBE.js";import"./FileUpload-CumNwlWc.js";import"./CodeEditor-C-nZkUJx.js";import"./EmptyStateFooter-DqmBOP2I.js";import"./EmptyStateActions-DWNUFByn.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(k,{label:t("importConfig"),fieldId:"kc-import-config",labelIcon:e(S,{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(b,{message:o.discoveryError.message})]}),children:r=>e(J,{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(z({realm:a,providerId:s,alias:n.alias,tab:"settings"}))}catch(F){i("createIdentityProviderError",F)}};return d(v,{children:[e(H,{titleKey:t(c?"addKeycloakOpenIdProvider":"addOpenIdProvider")}),e(w,{variant:"light",children:e(L,{...o,children:d(G,{role:"manage-identity-providers",isHorizontal:!0,onSubmit:u(I),children:[e(K,{}),e($,{}),e(N,{}),d(j,{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-Cs8jn03U.js.map




© 2015 - 2025 Weber Informatics LLC | Privacy Policy