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

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

There is a newer version: 25.0.1
Show newest version
import{u as h,c as x,a as I,j as e,T as b,F as f,h as y,aV as S,a0 as E,g as u,b as F,e as P,d as T,P as k,f as A,B as g,L as w,bM as C,A as D,bN as V}from"./index-831988f6.js";import{F as L}from"./FormAccess-589a8032.js";import{V as U}from"./ViewHeader-2b1ad3ef.js";import{F as $}from"./FileUploadForm-7262e28a.js";import{K as q}from"./KeycloakTextInput-ead44014.js";import{g as z}from"./getAuthorizationHeaders-f2376d1a.js";import{D as B}from"./DiscoveryEndpointField-af13cf43.js";import{D as G,S as H}from"./SamlGeneralSettings-202dd741.js";import{A as K}from"./Form-bd3cf98e.js";import"./copy-icon-476b0d6d.js";import"./GridItem-2c75fd83.js";import"./Text-2a2c2dcc.js";import"./ToolbarContent-186be8fd.js";import"./FileUpload-bcd6c3a5.js";import"./CodeEditor-09988f1c.js";import"./EmptyStateBody-dd392e69.js";import"./EmptyStateSecondaryActions-3d9f7969.js";import"./Modal-5d8a3df4.js";import"./KeycloakTextArea-3e2614e3.js";import"./discovery-settings-0e7750f9.js";import"./ExpandableSection-4ded5b10.js";import"./Select-9c61d949.js";import"./check-fc57dbe1.js";import"./star-icon-f5649401.js";import"./NumberInput-25f268d9.js";import"./minus-icon-9c8a6df2.js";import"./plus-icon-1b237b1a.js";import"./DisplayOrder-8e5ff983.js";const N=()=>{const{t}=h("identity-providers"),c="saml",{realm:i}=x(),{setValue:n,register:m,setError:d,clearErrors:p,formState:{errors:o}}=I(),l=r=>{Object.entries(r).map(([a,s])=>n(`config.${a}`,s))},v=async r=>{if(p("discoveryError"),!r)return;const a=new FormData;a.append("providerId",c),a.append("file",new Blob([r]));try{const s=await fetch(`${E(u.baseUrl)}admin/realms/${i}/identity-provider/import-config`,{method:"POST",body:a,headers:z(await u.getAccessToken())});if(s.ok){const j=await s.json();l(j)}else d("discoveryError",{type:"manual",message:s.statusText})}catch(s){d("discoveryError",{type:"manual",message:s.message})}};return e.jsxs(e.Fragment,{children:[e.jsx(b,{headingLevel:"h2",size:"xl",className:"kc-form-panel__title",children:t("samlSettings")}),e.jsx(f,{label:t("serviceProviderEntityId"),fieldId:"kc-service-provider-entity-id",labelIcon:e.jsx(y,{helpText:t("identity-providers-help:serviceProviderEntityId"),fieldLabelId:"identity-providers:serviceProviderEntityId"}),isRequired:!0,helperTextInvalid:t("common:required"),validated:o.config?.entityId?"error":"default",children:e.jsx(q,{"data-testid":"serviceProviderEntityId",id:"kc-service-provider-entity-id",validated:o.config?.entityId?"error":"default",defaultValue:`${S.authServerUrl}/realms/${i}`,...m("config.entityId",{required:!0})})}),e.jsx(B,{id:"saml",fileUpload:e.jsx(f,{label:t("importConfig"),fieldId:"kc-import-config",labelIcon:e.jsx(y,{helpText:t("identity-providers-help:importConfig"),fieldLabelId:"identity-providers:importConfig"}),validated:o.discoveryError?"error":"default",helperTextInvalid:o.discoveryError?.message,children:e.jsx($,{id:"kc-import-config",extension:".xml",hideDefaultPreview:!0,unWrap:!0,validated:o.discoveryError?"error":"default",onChange:r=>v(r)})}),children:r=>e.jsx(G,{readOnly:r})})]})};function he(){const{t}=h("identity-providers"),c=F(),i="saml",n=P({defaultValues:{alias:i,config:{allowCreate:"true"}}}),{handleSubmit:m,formState:{isDirty:d}}=n,{addAlert:p,addError:o}=T(),{realm:l}=x(),v=async r=>{delete r.discoveryEndpoint;try{await u.identityProviders.create({...r,providerId:i}),p(t("createSuccess"),D.success),c(V({realm:l,providerId:i,alias:r.alias,tab:"settings"}))}catch(a){o("identity-providers:createError",a)}};return e.jsxs(e.Fragment,{children:[e.jsx(U,{titleKey:t("addSamlProvider")}),e.jsx(k,{variant:"light",children:e.jsx(A,{...n,children:e.jsxs(L,{role:"manage-identity-providers",isHorizontal:!0,onSubmit:m(v),children:[e.jsx(H,{id:i}),e.jsx(N,{}),e.jsxs(K,{children:[e.jsx(g,{isDisabled:!d,variant:"primary",type:"submit","data-testid":"createProvider",children:t("common:add")}),e.jsx(g,{variant:"link","data-testid":"cancel",component:r=>e.jsx(w,{...r,to:C({realm:l})}),children:t("common:cancel")})]})]})})})]})}export{he as default};
//# sourceMappingURL=AddSamlConnect-1ac354da.js.map




© 2015 - 2024 Weber Informatics LLC | Privacy Policy