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

theme.keycloak.v2.admin.resources.assets.AddSamlConnect-PHsNHe8d.js Maven / Gradle / Ivy

There is a newer version: 26.0.7
Show newest version
import{jsxs as l,Fragment as y,jsx as e}from"react/jsx-runtime";import{u as h,bH as F,a as S,c as b,aj as I,T as P,y as C,ac as w,ad as A,aq as x,a6 as D,a8 as k,a7 as T,d as j,g as H,f as V,P as U,F as $,A as z,i as g,L,cw as q,k as B,cx as G}from"./main-C7ps2lmX.js";import{F as O}from"./FormAccess-DyLNkc18.js";import{V as N}from"./ViewHeader-B7eeFzFA.js";import{F as W}from"./FileUploadForm-BgyzQxBE.js";import{D as _}from"./DiscoveryEndpointField-DMZro08f.js";import{D as K,S as R}from"./SamlGeneralSettings-C6trYCdu.js";import"react";import"react-dom";import"./copy-icon-ACZmDH8e.js";import"./FileUpload-CumNwlWc.js";import"./CodeEditor-C-nZkUJx.js";import"./EmptyStateFooter-DqmBOP2I.js";import"./EmptyStateActions-DWNUFByn.js";import"./SwitchControl-C_9Y74oV.js";/* empty css                           */import"./ExpandableSection-CSay1Wbo.js";import"./DisplayOrder-BDgUHroI.js";const J=()=>{const{adminClient:c}=h(),{environment:o}=F(),{t}=S(),s="saml",{realm:n}=b(),{setValue:u,setError:m,clearErrors:f,formState:{errors:d}}=I(),p=r=>{Object.entries(r).map(([a,i])=>u(`config.${a}`,i))},v=async r=>{if(f("discoveryError"),!r)return;const a=new FormData;a.append("providerId",s),a.append("file",new Blob([r]));try{const i=await D(`${k(c.baseUrl)}admin/realms/${n}/identity-provider/import-config`,{method:"POST",body:a,headers:T(await c.getAccessToken())});if(i.ok){const E=await i.json();p(E)}else m("discoveryError",{type:"manual",message:i.statusText})}catch(i){m("discoveryError",{type:"manual",message:i.message})}};return l(y,{children:[e(P,{headingLevel:"h2",size:"xl",className:"kc-form-panel__title",children:t("samlSettings")}),e(C,{name:"config.entityId",label:t("serviceProviderEntityId"),labelIcon:t("serviceProviderEntityIdHelp"),defaultValue:`${o.serverBaseUrl}/realms/${n}`,rules:{required:t("required")}}),e(_,{id:"saml",fileUpload:l(w,{label:t("importConfig"),fieldId:"kc-import-config",labelIcon:e(A,{helpText:t("importConfigHelp"),fieldLabelId:"importConfig"}),children:[e(W,{id:"kc-import-config",extension:".xml",hideDefaultPreview:!0,unWrap:!0,validated:d.discoveryError?"error":"default",onChange:r=>v(r)}),d.discoveryError&&e(x,{message:d.discoveryError.message})]}),children:r=>e(K,{readOnly:r})})]})};function ue(){const{adminClient:c}=h(),{t:o}=S(),t=j(),s="saml",n=H({defaultValues:{alias:s,config:{allowCreate:"true"}},mode:"onChange"}),{handleSubmit:u,formState:{isDirty:m}}=n,{addAlert:f,addError:d}=V(),{realm:p}=b(),v=async r=>{delete r.discoveryEndpoint;try{await c.identityProviders.create({...r,providerId:s}),f(o("createIdentityProviderSuccess"),B.success),t(G({realm:p,providerId:s,alias:r.alias,tab:"settings"}))}catch(a){d("createIdentityProviderError",a)}};return l(y,{children:[e(N,{titleKey:o("addSamlProvider")}),e(U,{variant:"light",children:e($,{...n,children:l(O,{role:"manage-identity-providers",isHorizontal:!0,onSubmit:u(v),children:[e(R,{}),e(J,{}),l(z,{children:[e(g,{isDisabled:!m,variant:"primary",type:"submit","data-testid":"createProvider",children:o("add")}),e(g,{variant:"link","data-testid":"cancel",component:r=>e(L,{...r,to:q({realm:p})}),children:o("cancel")})]})]})})})]})}export{ue as default};
//# sourceMappingURL=AddSamlConnect-PHsNHe8d.js.map




© 2015 - 2025 Weber Informatics LLC | Privacy Policy