theme.keycloak.v2.admin.resources.assets.DetailSettings-CBdijxzV.js Maven / Gradle / Ivy
import{jsxs as b,Fragment as L,jsx as e}from"react/jsx-runtime";import{useState as I,useMemo as Oe}from"react";import{a as M,aj as A,ab as E,aH as fe,aI as ge,ae as P,a4 as ie,ac as w,ad as D,am as oe,an as G,aq as re,v as Le,u as Z,w as ee,b5 as te,b6 as ae,U as z,r as be,ao as Ne,g as Me,b as Ke,f as ye,d as Ve,c as he,B as se,k as N,cw as Ee,cx as le,a3 as Ae,ar as Ce,F as Be,P as He,b1 as Ue,cy as de,a2 as qe,i as Ge,L as ve,b2 as ze,D as J,cz as je}from"./main-C7ps2lmX.js";import{u as Y}from"./ConfirmDialog-hx7XKLbN.js";import{D as Je}from"./DynamicComponents-DvaX3FJx.js";import{F as _,a as _e}from"./FormAccess-DyLNkc18.js";import{L as We}from"./PaginatingTableToolbar-Cjsz5Jh4.js";import{P as $e}from"./PermissionTab-CKEvhIGg.js";import{R as Ye,u as Qe}from"./RoutableTabs-T8JTILEW.js";import{K as Xe}from"./KeycloakDataTable-DbY4la1D.js";import{V as Ze}from"./ViewHeader-B7eeFzFA.js";import{u as ne}from"./useParams-B67lSY02.js";import{T as Q,S as p,F as X,O as et,D as tt,a as at}from"./OIDCGeneralSettings--wdBI6nV.js";import{S as nt,D as it}from"./SamlGeneralSettings-C6trYCdu.js";import{E as ot}from"./ExpandableSection-CSay1Wbo.js";import{G as rt}from"./GeneralSettings-BtQ8n2eJ.js";import{M as ce}from"./MultiLineInput-DiPNQ1LE.js";import{a as W,b as $}from"./Tabs-CMdqT4Cg.js";import"react-dom";import"./ClientSelect-B9UqjyP6.js";import"./FileUpload-CumNwlWc.js";import"./CodeEditor-C-nZkUJx.js";import"./copy-icon-ACZmDH8e.js";import"./EmptyStateFooter-DqmBOP2I.js";import"./EmptyStateActions-DWNUFByn.js";import"./GroupPickerDialog-C09EjRTA.js";import"./DataListItemRow-BC0LurDd.js";import"./FlexItem-BzZfUnQ1.js";import"./KeySelect-jKxsKqdI.js";import"./useToggle-K3Kx99tM.js";import"./AddRoleMappingModal-DW8o4W0z.js";import"./filter-icon-DO0QNij3.js";import"./Td-D2hVFK0Z.js";import"./grip-vertical-icon-BxF7V59o.js";import"./Trans-DcGUccv9.js";import"./PageHandler-P2CRgucq.js";import"./PageList-s9OtSlkz.js";import"./_baseFlatten-eIEJR-AJ.js";import"./SwitchControl-C_9Y74oV.js";/* empty css */import"./ClientIdSecret-D4xxDCdD.js";import"./DisplayOrder-BDgUHroI.js";const pe=({field:n,label:t,defaultValue:a,labelForEmpty:r="none"})=>{const{adminClient:d}=Z(),{t:i}=M(),{control:s}=A(),[l,g]=I(),[c,v]=I(!1);return ee(()=>d.authenticationManagement.getFlows(),y=>g(y.filter(u=>u.providerId==="basic-flow")),[]),e(w,{label:i(t),labelIcon:e(D,{helpText:i(`${t}Help`),fieldLabelId:t}),fieldId:t,children:e(P,{name:n,defaultValue:a,control:s,render:({field:y})=>e(te,{toggleId:t,onToggle:()=>v(!c),onSelect:u=>{y.onChange(u),v(!1)},selections:y.value||i(r),variant:ae.single,"aria-label":i(t),isOpen:c,children:[...a===""?[e(z,{value:"",children:i(r)},"empty")]:[],...l?.map(u=>e(z,{selected:u.alias===y.value,value:u.alias,children:u.alias},u.id))||[]]})})})},me=["IMPORT","LEGACY","FORCE"],st=({isOIDC:n,isSAML:t})=>{const{t:a}=M(),{control:r,register:d,setValue:i,formState:{errors:s}}=A(),g=E({control:r,name:"config.filteredByClaim",defaultValue:"false"})==="true",v=fe()(ge.TransientUsers),u=E({control:r,name:"config.doNotStoreUsers",defaultValue:"false"})==="false";return b(L,{children:[!n&&!t&&e(Q,{field:"config.defaultScope",label:"scopes"}),e(p,{field:"storeToken",label:"storeTokens",fieldType:"boolean"}),(t||n)&&e(p,{field:"addReadTokenRoleOnCreate",label:"storedTokensReadable",fieldType:"boolean"}),!n&&!t&&b(L,{children:[e(p,{field:"config.acceptsPromptNoneForwardFromClient",label:"acceptsPromptNone"}),e(p,{field:"config.disableUserInfo",label:"disableUserInfo"})]}),n&&e(p,{field:"config.isAccessTokenJWT",label:"isAccessTokenJWT"}),e(p,{field:"trustEmail",label:"trustEmail",fieldType:"boolean"}),e(p,{field:"linkOnly",label:"accountLinkingOnly",fieldType:"boolean"}),e(p,{field:"config.hideOnLoginPage",label:"hideOnLoginPage"}),(!t||n)&&e(X,{label:"filteredByClaim",children:e(P,{name:"config.filteredByClaim",defaultValue:"false",control:r,render:({field:f})=>e(ie,{id:"filteredByClaim",label:a("on"),labelOff:a("off"),isChecked:f.value==="true",onChange:(T,h)=>{f.onChange(h.toString())}})})}),(!t||n)&&g&&b(L,{children:[b(w,{label:a("claimFilterName"),labelIcon:e(D,{helpText:a("claimFilterNameHelp"),fieldLabelId:"claimFilterName"}),fieldId:"kc-claim-filter-name",isRequired:!0,children:[e(oe,{isRequired:!0,id:"kc-claim-filter-name","data-testid":"claimFilterName",validated:s.config?.claimFilterName?G.error:G.default,...d("config.claimFilterName",{required:!0})}),s.config?.claimFilterName&&e(re,{message:a("required")})]}),b(w,{label:a("claimFilterValue"),labelIcon:e(D,{helpText:a("claimFilterValueHelp"),fieldLabelId:"claimFilterName"}),fieldId:"kc-claim-filter-value",isRequired:!0,children:[e(oe,{isRequired:!0,id:"kc-claim-filter-value","data-testid":"claimFilterValue",validated:s.config?.claimFilterValue?G.error:G.default,...d("config.claimFilterValue",{required:!0})}),s.config?.claimFilterValue&&e(re,{message:a("required")})]})]}),e(pe,{field:"firstBrokerLoginFlowAlias",label:"firstBrokerLoginFlowAliasOverride",defaultValue:"",labelForEmpty:""}),e(pe,{field:"postBrokerLoginFlowAlias",label:"postBrokerLoginFlowAlias",defaultValue:""}),v&&e(X,{label:"doNotStoreUsers",children:e(P,{name:"config.doNotStoreUsers",defaultValue:"false",control:r,render:({field:f})=>e(ie,{id:"doNotStoreUsers",label:a("on"),labelOff:a("off"),isChecked:f.value==="true",onChange:(T,h)=>{f.onChange(h.toString()),h&&i("config.syncMode","IMPORT")}})})}),u&&e(Le,{name:"config.syncMode",label:a("syncMode"),labelIcon:a("syncModeHelp"),options:me.map(f=>({key:f,value:a(`syncModes.${f.toLocaleLowerCase()}`)})),controller:{defaultValue:me[0],rules:{required:a("required")}}}),e(p,{field:"config.caseSensitiveOriginalUsername",label:"caseSensitiveOriginalUsername"})]})},lt={unspecified:"",none:"none",consent:"consent",login:"login",select_account:"select_account"},dt=()=>{const{t:n}=M(),{control:t}=A(),[a,r]=I(!1),[d,i]=I(!1);return e(ot,{toggleText:n("advanced"),onToggle:()=>r(!a),isExpanded:a,children:b(be,{isHorizontal:!0,children:[e(p,{label:"passLoginHint",field:"config.loginHint"}),e(p,{label:"passMaxAge",field:"config.passMaxAge"}),e(p,{label:"passCurrentLocale",field:"config.uiLocales"}),e(p,{field:"config.backchannelSupported",label:"backchannelLogout"}),e(p,{field:"config.sendIdTokenOnLogout",label:"sendIdTokenOnLogout",defaultValue:"true"}),e(p,{field:"config.sendClientIdOnLogout",label:"sendClientIdOnLogout"}),e(p,{field:"config.disableUserInfo",label:"disableUserInfo"}),e(p,{field:"config.disableNonce",label:"disableNonce"}),e(Q,{field:"config.defaultScope",label:"scopes"}),e(X,{label:"prompt",children:e(P,{name:"config.prompt",defaultValue:"",control:t,render:({field:s})=>e(te,{toggleId:"prompt",onToggle:()=>i(!d),onSelect:l=>{s.onChange(l),i(!1)},selections:s.value||n("prompts.unspecified"),variant:ae.single,"aria-label":n("prompt"),isOpen:d,children:Object.entries(lt).map(([l,g])=>e(z,{selected:g===s.value,value:g,children:n(`prompts.${l}`)},l))})})}),e(p,{field:"config.acceptsPromptNoneForwardFromClient",label:"acceptsPromptNone"}),e(w,{label:n("allowedClockSkew"),labelIcon:e(D,{helpText:n("allowedClockSkewHelp"),fieldLabelId:"allowedClockSkew"}),fieldId:"allowedClockSkew",children:e(P,{name:"config.allowedClockSkew",defaultValue:0,control:t,render:({field:s})=>{const l=Number(s.value);return e(Ne,{"data-testid":"allowedClockSkew",inputName:"allowedClockSkew",min:0,max:2147483,value:l,readOnly:!0,onPlus:()=>s.onChange(l+1),onMinus:()=>s.onChange(l-1),onChange:g=>{const c=Number(g.target.value);s.onChange(c<0?0:c)}})}})}),e(Q,{field:"config.forwardParameters",label:"forwardParameters"})]})})},ue=["exact","minimum","maximum","better"],ct=()=>{const{t:n}=M(),{control:t}=A(),[a,r]=I(!1);return b(L,{children:[e(w,{label:n("comparison"),labelIcon:e(D,{helpText:n("comparisonHelp"),fieldLabelId:"comparison"}),fieldId:"comparison",children:e(P,{name:"config.authnContextComparisonType",defaultValue:ue[0],control:t,render:({field:d})=>e(te,{toggleId:"comparison",direction:"up",onToggle:i=>r(i),onSelect:i=>{d.onChange(i.toString()),r(!1)},selections:d.value,variant:ae.single,"aria-label":n("comparison"),isOpen:a,children:ue.map(i=>e(z,{selected:i===d.value,value:i,children:n(i)},i))})})}),e(w,{label:n("authnContextClassRefs"),fieldId:"kc-authnContextClassRefs",labelIcon:e(D,{helpText:n("authnContextClassRefsHelp"),fieldLabelId:"authnContextClassRefs"}),children:e(ce,{name:"config.authnContextClassRefs","aria-label":n("identify-providers:authnContextClassRefs"),addButtonLabel:"addAuthnContextClassRef","data-testid":"classref-field"})}),e(w,{label:n("authnContextDeclRefs"),fieldId:"kc-authnContextDeclRefs",labelIcon:e(D,{helpText:n("authnContextDeclRefsHelp"),fieldLabelId:"authnContextDeclRefs"}),children:e(ce,{name:"config.authnContextDeclRefs","aria-label":n("identify-providers:authnContextDeclRefs"),addButtonLabel:"addAuthnContextDeclRef","data-testid":"declref-field"})})]})},pt=({onChange:n,value:t,save:a,toggleDeleteDialog:r})=>{const{adminClient:d}=Z(),{t:i}=M(),{alias:s}=ne(),[l,g]=I(),{addAlert:c,addError:v}=ye(),{setValue:y,formState:u,control:f}=A(),T=E({control:f,name:"config.validateSignature"}),h=E({control:f,name:"config.useMetadataDescriptorUrl"}),k=E({control:f,name:"config.metadataDescriptorUrl"});ee(()=>d.identityProviders.findOne({alias:s}),C=>{if(!C)throw new Error(i("notFound"));g(C)},[]);const[K,F]=Y({titleKey:"disableProvider",messageKey:i("disableConfirmIdentityProvider",{provider:s}),continueButtonLabel:"disable",onConfirm:()=>{n(!t),a()}}),B=async(C,R)=>{try{const S=await d.identityProviders.importFromUrl({providerId:C,fromUrl:R});S.signingCertificate?(y("config.signingCertificate",S.signingCertificate),c(i("importKeysSuccess"),N.success)):v("importKeysError",i("importKeysErrorNoSigningCertificate"))}catch(S){v("importKeysError",S)}},j=async C=>{try{await d.identityProviders.reloadKeys({alias:C})?c(i("reloadKeysSuccess"),N.success):c(i("reloadKeysSuccessButFalse"),N.warning)}catch(R){v("reloadKeysError",R)}};return b(L,{children:[e(F,{}),e(Ze,{titleKey:ze(l?l.displayName?l.displayName:l.providerId:""),divider:!1,dropdownItems:[...l?.providerId?.includes("saml")&&T==="true"&&h==="true"&&k&&!u.isDirty&&t?[e(J,{onClick:()=>j(l.alias),children:i("reloadKeys")},"reloadKeys")]:l?.providerId?.includes("saml")&&T==="true"&&h!=="true"&&k&&!u.isDirty?[e(J,{onClick:()=>B(l.providerId,k),children:i("importKeys")},"importKeys")]:[],e(Ce,{},"separator"),e(J,{onClick:()=>r(),children:i("delete")},"delete")],isEnabled:t,onToggle:C=>{C?(n(C),a()):K()}})]})},mt=({name:n,mapperId:t,provider:a})=>{const{realm:r}=he(),{alias:d}=ne();return e(ve,{to:je({realm:r,alias:d,providerId:a?.providerId,id:t}),children:n})};function aa(){const{adminClient:n}=Z(),{t}=M(),{alias:a,providerId:r}=ne(),d=fe(),i=Me(),{handleSubmit:s,getValues:l,reset:g}=i,[c,v]=I(),[y,u]=I(),f=Ke(),T=Oe(()=>{const o=["org.keycloak.broker.social.SocialIdentityProvider","org.keycloak.broker.provider.IdentityProvider"];for(const m of o){const O=f.componentTypes?.[m]?.find(({id:x})=>x===r);if(O)return O}},[f,r]),{addAlert:h,addError:k}=ye(),K=Ve(),{realm:F}=he(),[B,j]=I(0),C=()=>j(B+1);ee(()=>n.identityProviders.findOne({alias:a}),o=>{if(!o)throw new Error(t("notFound"));g(o),v(o),o.config.authnContextClassRefs&&i.setValue("config.authnContextClassRefs",JSON.parse(o.config?.authnContextClassRefs)),o.config.authnContextDeclRefs&&i.setValue("config.authnContextDeclRefs",JSON.parse(o.config?.authnContextDeclRefs))},[]);const R=o=>le({realm:F,alias:a,providerId:r,tab:o}),S=o=>Qe(R(o)),Ie=S("settings"),Se=S("mappers"),xe=S("permissions"),H=async o=>{const m=o||l(),O=m.config?.authnContextClassRefs;m.config?.authnContextClassRefs&&(m.config.authnContextClassRefs=JSON.stringify(m.config.authnContextClassRefs));const x=m.config?.authnContextDeclRefs;m.config?.authnContextDeclRefs&&(m.config.authnContextDeclRefs=JSON.stringify(m.config.authnContextDeclRefs));try{await n.identityProviders.update({alias:a},{...m,config:{...c?.config,...m.config},alias:a,providerId:r}),O&&(m.config.authnContextClassRefs=O),x&&(m.config.authnContextDeclRefs=x),g(m),h(t("updateSuccessIdentityProvider"),N.success)}catch(q){k("updateErrorIdentityProvider",q)}},[Te,ke]=Y({titleKey:"deleteProvider",messageKey:t("deleteConfirmIdentityProvider",{provider:a}),continueButtonLabel:"delete",continueButtonVariant:se.danger,onConfirm:async()=>{try{await n.identityProviders.del({alias:a}),h(t("deletedSuccessIdentityProvider"),N.success),K(Ee({realm:F}))}catch(o){k("deleteErrorIdentityProvider",o)}}}),[Fe,Re]=Y({titleKey:"deleteProviderMapper",messageKey:t("deleteMapperConfirm",{mapper:y?.name}),continueButtonLabel:"delete",continueButtonVariant:se.danger,onConfirm:async()=>{try{await n.identityProviders.delMapper({alias:a,id:y?.mapperId}),h(t("deleteMapperSuccess"),N.success),C(),K(le({providerId:r,alias:a,tab:"mappers",realm:F}))}catch(o){k("deleteErrorIdentityProvider",o)}}});if(!c)return e(Ae,{});const U=c.providerId.includes("oidc"),V=c.providerId.includes("saml"),we=async()=>{const[o,m]=await Promise.all([n.identityProviders.findMappers({alias:a}),n.identityProviders.findMapperTypes({alias:a})]);return o.map(x=>{const q=Object.values(m).find(Pe=>x.identityProviderMapper===Pe.id);return{...q,name:x.name,type:q?.name,mapperId:x.id}})},De=[{title:t("generalSettings"),panel:b(_,{role:"manage-identity-providers",isHorizontal:!0,onSubmit:s(H),children:[!U&&!V&&e(rt,{create:!1,id:a}),U&&e(et,{}),V&&e(nt,{isAliasReadonly:!0}),T&&e(Je,{stringify:!0,properties:T.properties})]})},{title:t("oidcSettings"),isHidden:!U,panel:b(L,{children:[e(tt,{readOnly:!1}),b(be,{isHorizontal:!0,className:"pf-v5-u-py-lg",children:[e(Ce,{}),e(at,{create:!1})]}),e(dt,{})]})},{title:t("samlSettings"),isHidden:!V,panel:e(it,{readOnly:!1})},{title:t("reqAuthnConstraints"),isHidden:!V,panel:e(_,{role:"manage-identity-providers",isHorizontal:!0,onSubmit:s(H),children:e(ct,{})})},{title:t("advancedSettings"),panel:b(_,{role:"manage-identity-providers",isHorizontal:!0,onSubmit:s(H),children:[e(st,{isOIDC:U,isSAML:V}),e(_e,{name:"idp-details",isSubmit:!0,reset:g})]})}];return b(Be,{...i,children:[e(ke,{}),e(Re,{}),e(P,{name:"enabled",control:i.control,defaultValue:!0,render:({field:o})=>e(pt,{value:o.value||!1,onChange:o.onChange,save:H,toggleDeleteDialog:Te})}),e(He,{variant:"light",className:"pf-v5-u-p-0",children:b(Ye,{isBox:!0,defaultLocation:R("settings"),children:[e(W,{id:"settings",title:e($,{children:t("settings")}),...Ie,children:e(Ue,{label:t("jumpToSection"),className:"pf-v5-u-px-lg",sections:De})}),e(W,{id:"mappers","data-testid":"mappers-tab",title:e($,{children:t("mappers")}),...Se,children:e(Xe,{emptyState:e(We,{message:t("noMappers"),instructions:t("noMappersInstructions"),primaryActionText:t("addMapper"),onPrimaryAction:()=>K(de({realm:F,alias:a,providerId:c.providerId,tab:"mappers"}))}),loader:we,ariaLabelKey:"mappersList",searchPlaceholderKey:"searchForMapper",toolbarItem:e(qe,{children:e(Ge,{id:"add-mapper-button",component:o=>e(ve,{...o,to:de({realm:F,alias:a,providerId:c.providerId,tab:"mappers"})}),"data-testid":"addMapper",children:t("addMapper")})}),columns:[{name:"name",displayKey:"name",cellRenderer:o=>e(mt,{...o,provider:c})},{name:"category",displayKey:"category"},{name:"type",displayKey:"type"}],actions:[{title:t("delete"),onRowClick:o=>{u(o),Fe()}}]},B)}),d(ge.AdminFineGrainedAuthz)&&e(W,{id:"permissions","data-testid":"permissionsTab",title:e($,{children:t("permissions")}),...xe,children:e($e,{id:a,type:"identityProviders"})})]})})]})}export{aa as default};
//# sourceMappingURL=DetailSettings-CBdijxzV.js.map
© 2015 - 2025 Weber Informatics LLC | Privacy Policy