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

theme.keycloak.v2.admin.resources.assets.AuthenticationSection-DPPGU9pd.js Maven / Gradle / Ivy

There is a newer version: 26.0.7
Show newest version
import{jsx as e,jsxs as b,Fragment as _}from"react/jsx-runtime";import{o as $e,u as T,a as S,g as D,f as N,c as E,M as Q,i as P,B as F,r as oe,F as M,v as K,k,d as Ue,q as re,l as Ie,w as se,A as B,Q as ce,S as de,a3 as ue,a4 as te,a5 as z,a6 as Te,a7 as Ee,a8 as Re,a9 as _e,C as Ke,aa as ke,Z as ae,$ as Be,P as $,y as Y,s as Fe,ab as je,ac as H,ad as q,ae as ne,R as pe,af as he,ag as ze,ah as Ge,ai as Ne,aj as We,ak as Ye,al as be,am as Xe,an as ye,ao as Qe,ap as Ze,aq as Je,b as Oe,a0 as et,a1 as tt,a2 as xe,ar as at,as as nt,V as it,K as lt,W as ot,U as rt,at as st,au as ct,j as fe,L as De,av as dt,p as ut,x as mt}from"./main-C7ps2lmX.js";import{useEffect as j,useState as R,useMemo as Me}from"react";import{u as pt}from"./ConfirmDialog-hx7XKLbN.js";import{L as ht}from"./PaginatingTableToolbar-Cjsz5Jh4.js";import{R as bt,u as yt}from"./RoutableTabs-T8JTILEW.js";import{K as Ve}from"./KeycloakDataTable-DbY4la1D.js";import{V as ft}from"./ViewHeader-B7eeFzFA.js";import{u as ie}from"./useToggle-K3Kx99tM.js";import{N as gt}from"./NameDescription-C0ru_aK0.js";import{D as At}from"./DraggableTable-yOogAvJ0.js";import{D as wt}from"./DynamicComponents-DvaX3FJx.js";import{T as vt}from"./trash-icon-BkuEbPwb.js";import{f as Pt}from"./AddRoleMappingModal-DW8o4W0z.js";import{F as Z}from"./FormAccess-DyLNkc18.js";import{T as Le}from"./TimeSelectorControl-BxG2OWnt.js";import{E as Ct,a as St,b as It}from"./EmptyStateFooter-DqmBOP2I.js";import{E as Tt,a as Et,b as Rt}from"./EmptyStateActions-DWNUFByn.js";import{M as ge}from"./MultiLineInput-DiPNQ1LE.js";import{Q as _t}from"./question-circle-icon-dDThmv9d.js";import{T as kt,a as O,b as x}from"./Tabs-CMdqT4Cg.js";import{T as Ft}from"./Trans-DcGUccv9.js";import{s as Nt}from"./sortBy-DtY8l0cj.js";const Ot={name:"CogIcon",height:512,width:512,svgPath:"M487.4 315.7l-42.6-24.6c4.3-23.2 4.3-47 0-70.2l42.6-24.6c4.9-2.8 7.1-8.6 5.5-14-11.1-35.6-30-67.8-54.7-94.6-3.8-4.1-10-5.1-14.8-2.3L380.8 110c-17.9-15.4-38.5-27.3-60.8-35.1V25.8c0-5.6-3.9-10.5-9.4-11.7-36.7-8.2-74.3-7.8-109.2 0-5.5 1.2-9.4 6.1-9.4 11.7V75c-22.2 7.9-42.8 19.8-60.8 35.1L88.7 85.5c-4.9-2.8-11-1.9-14.8 2.3-24.7 26.7-43.6 58.9-54.7 94.6-1.7 5.4.6 11.2 5.5 14L67.3 221c-4.3 23.2-4.3 47 0 70.2l-42.6 24.6c-4.9 2.8-7.1 8.6-5.5 14 11.1 35.6 30 67.8 54.7 94.6 3.8 4.1 10 5.1 14.8 2.3l42.6-24.6c17.9 15.4 38.5 27.3 60.8 35.1v49.2c0 5.6 3.9 10.5 9.4 11.7 36.7 8.2 74.3 7.8 109.2 0 5.5-1.2 9.4-6.1 9.4-11.7v-49.2c22.2-7.9 42.8-19.8 60.8-35.1l42.6 24.6c4.9 2.8 11 1.9 14.8-2.3 24.7-26.7 43.6-58.9 54.7-94.6 1.5-5.5-.7-11.3-5.6-14.1zM256 336c-44.1 0-80-35.9-80-80s35.9-80 80-80 80 35.9 80 80-35.9 80-80 80z",yOffset:0,xOffset:0},xt=$e(Ot),Dt=({flowAlias:n,onClose:a})=>{const{adminClient:l}=T(),{t}=S(),i=D(),{addAlert:r,addError:c}=N(),{realm:d,realmRepresentation:m,refresh:g}=E(),h=async({bindingType:A})=>{try{await l.realms.update({realm:d},{...m,[A]:n}),g(),r(t("updateFlowSuccess"),k.success)}catch(u){c("updateFlowError",u)}a(!0)},f=Array.from(X.keys());return e(Q,{title:t("bindFlow"),variant:"small",onClose:()=>a(),actions:[e(P,{"data-testid":"save",type:"submit",form:"bind-form",children:t("save")},"confirm"),e(P,{"data-testid":"cancel",variant:F.link,onClick:()=>a(),children:t("cancel")},"cancel")],isOpen:!0,children:e(oe,{id:"bind-form",isHorizontal:!0,onSubmit:i.handleSubmit(h),children:e(M,{...i,children:e(K,{id:"chooseBindingType",name:"bindingType",label:t("chooseBindingType"),options:f.filter(A=>A!=="dockerAuthenticationFlow").map(A=>({key:A,value:t(`flow.${X.get(A)}`)})),controller:{defaultValue:f[0]},menuAppendTo:"parent","aria-label":t("chooseBindingType")})})})})},Mt=({name:n,description:a,toggleDialog:l,onComplete:t})=>{const{adminClient:i}=T(),{t:r}=S(),c=D({mode:"onChange"}),{setValue:d,getValues:m,handleSubmit:g}=c,{addAlert:h,addError:f}=N(),A=Ue(),{realm:u}=E();j(()=>{d("alias",r("copyOf",{name:n})),d("description",a)},[n,a]);const y=async()=>{const v=m();try{await i.authenticationManagement.copyFlow({flow:n,newName:v.alias});const o=(await i.authenticationManagement.getFlows()).find(w=>w.alias===v.alias);v.description!==a&&(o.description=v.description,await i.authenticationManagement.updateFlow({flowId:o.id},o)),h(r("copyFlowSuccess"),k.success),A(Ie({realm:u,id:o.id,usedBy:"notInUse",builtIn:o.builtIn?"builtIn":void 0}))}catch(o){f("copyFlowError",o)}t()};return e(Q,{title:r("duplicateFlow"),onClose:l,variant:re.small,actions:[e(P,{"data-testid":"confirm",type:"submit",form:"duplicate-flow-form",children:r("duplicate")},"confirm"),e(P,{"data-testid":"cancel",variant:F.link,onClick:l,children:r("cancel")},"cancel")],isOpen:!0,children:e(M,{...c,children:e(oe,{id:"duplicate-flow-form",onSubmit:g(y),isHorizontal:!0,children:e(gt,{})})})})},Vt=({requiredAction:n,onClose:a})=>{const{adminClient:l}=T(),{t}=S(),{addAlert:i,addError:r}=N(),[c,d]=R(),m=D(),{setValue:g,handleSubmit:h}=m,f=u=>{ce(u||{},g)};se(async()=>{const u=await l.authenticationManagement.getRequiredActionConfigDescription({alias:n.alias}),y=await l.authenticationManagement.getRequiredActionConfig({alias:n.alias});return u.properties=[...u.properties],{configDescription:u,config:y}},({configDescription:u,config:y})=>{d(u),f(y)},[]);const A=async u=>{const y=de(u);try{await l.authenticationManagement.updateRequiredActionConfig({alias:n.alias},y),f(y),i(t("configSaveSuccess"),k.success),a()}catch(v){r("configSaveError",v)}};return e(Q,{variant:re.small,isOpen:!0,title:t("requiredActionConfig",{name:n.name}),onClose:a,children:b(oe,{id:"required-action-config-form",onSubmit:h(A),children:[e(M,{...m,children:e(wt,{stringify:!0,properties:c?.properties||[]})}),b(B,{children:[e(P,{"data-testid":"save",variant:"primary",type:"submit",children:t("save")}),e(P,{"data-testid":"cancel",variant:F.link,onClick:a,children:t("cancel")}),b(P,{className:"pf-v5-u-ml-3xl","data-testid":"clear",variant:F.link,onClick:async()=>{await l.authenticationManagement.removeRequiredActionConfig({alias:n.alias}),m.reset({}),a()},children:[t("clear")," ",e(vt,{})]})]})]})})},Lt=()=>{const{adminClient:n}=T(),{t:a}=S(),{addAlert:l,addError:t}=N(),[i,r]=R(),[c,d]=R(),[m,g]=R(0),h=()=>g(m+1),{realm:f}=E(),A=async()=>await(await Te(`${Re(n.baseUrl)}admin/realms/${f}/ui-ext/authentication-management/required-actions`,{method:"GET",headers:Ee(await n.getAccessToken())})).json();se(async()=>{const[o,w]=await Promise.all([A(),n.authenticationManagement.getUnregisteredRequiredActions()]);return[...o.map(s=>({name:s.name,enabled:s.enabled,defaultAction:s.defaultAction,data:s})),...w.map(s=>({name:s.name,enabled:!1,defaultAction:!1,data:s}))]},o=>r(o),[m]);const u=o=>!("alias"in o),y=async(o,w)=>{try{w in o?(o[w]=!o[w],delete o.configurable,await n.authenticationManagement.updateRequiredAction({alias:o.alias},o)):u(o)&&await n.authenticationManagement.registerRequiredAction({name:o.name,providerId:o.providerId}),h(),l(a("updatedRequiredActionSuccess"),k.success)}catch(s){t("updatedRequiredActionError",s)}},v=async(o,w)=>{try{const s=o.alias;for(let p=0;p0?await n.authenticationManagement.lowerRequiredActionPriority({alias:s}):await n.authenticationManagement.raiseRequiredActionPriority({alias:s});h(),l(a("updatedRequiredActionSuccess"),k.success)}catch(s){t("updatedRequiredActionError",s)}};return i?b(_,{children:[c&&e(Vt,{requiredAction:c,onClose:()=>d(void 0)}),e(At,{keyField:"name",onDragFinish:async(o,w)=>{const s=i.map(C=>C.name),p=w.indexOf(o),I=s.indexOf(o),V=i[I].data;if(!V.alias)return;const J=p-I;v(V,J)},columns:[{name:"name",displayKey:"action",width:50},{name:"enabled",displayKey:"enabled",cellRenderer:o=>e(te,{id:`enable-${z(o.name)}`,label:a("on"),labelOff:a("off"),isChecked:o.enabled,onChange:()=>{y(o.data,"enabled")},"aria-label":z(o.name)}),width:20},{name:"default",displayKey:"setAsDefaultAction",thTooltipText:"authDefaultActionTooltip",cellRenderer:o=>e(te,{id:`default-${z(o.name)}`,label:a("on"),isDisabled:!o.enabled,labelOff:o.enabled?a("off"):a("disabledOff"),isChecked:o.defaultAction,onChange:()=>{y(o.data,"defaultAction")},"aria-label":z(o.name)}),width:20},{name:"config",displayKey:"configure",cellRenderer:o=>o.data.configurable?e(P,{variant:"plain","aria-label":a("settings"),onClick:()=>d(o.data),children:e(xt,{})}):void 0,width:10}],data:i})]}):e(ue,{})},Ht="_label_1u2bs_1",le={label:Ht},ee=({label:n})=>b(_,{children:[e(Ke,{className:le.label})," ",n]}),qt=({id:n,isSpecificClient:a,onClose:l})=>{const{adminClient:t}=T(),{t:i}=S(),r=async(c,d,m)=>(await Pt(t,{id:n,type:a?"clients":"idp",first:c||0,max:d||10,search:m})).map(h=>({name:h}));return e(Q,{header:b(ke,{children:[e(ae,{component:Be.h1,children:i("flowUsedBy")}),e(ae,{children:i("flowUsedByDescription",{value:i(a?"clients":"identiyProviders")})})]}),variant:re.medium,isOpen:!0,onClose:l,actions:[e(P,{"data-testid":"cancel",id:"modal-cancel",onClick:l,children:i("close")},"cancel")],children:e(Ve,{loader:r,isPaginated:!0,ariaLabelKey:"usedBy",searchPlaceholderKey:"search",columns:[{name:"name"}]})})},$t=({authType:{id:n,usedBy:a}})=>{const{t:l}=S(),{realmRepresentation:t}=E(),[i,r]=ie(),c=Object.entries(t).find(d=>d[1]===a?.values[0])?.[0];return b(_,{children:[i&&e(qt,{id:n,onClose:r,isSpecificClient:a?.type==="SPECIFIC_CLIENTS"}),(a?.type==="SPECIFIC_PROVIDERS"||a?.type==="SPECIFIC_CLIENTS")&&(a.values.length<=8?e(_e,{"aria-label":l("usedBy"),bodyContent:b("div",{children:[l("appliedBy"+(a.type==="SPECIFIC_CLIENTS"?"Clients":"Providers"))," ",a.values.map((d,m)=>b(_,{children:[e("strong",{children:d}),m{const{adminClient:l}=T(),{t}=S(),i=D({mode:"onChange"}),{realm:r}=E(),{addAlert:c,addError:d}=N(),m=h=>ce(h,i.setValue);j(()=>m(n),[]);const g=async h=>{try{await l.realms.update({realm:r},de(h));const f=await l.realms.findOne({realm:r});a(f),m(f),c(t("updateCibaSuccess"),k.success)}catch(f){d("updateCibaError",f)}};return e($,{variant:"light",children:b(Z,{role:"manage-realm",isHorizontal:!0,onSubmit:i.handleSubmit(g),children:[b(M,{...i,children:[e(K,{name:"attributes.cibaBackchannelTokenDeliveryMode",label:t("cibaBackchannelTokenDeliveryMode"),labelIcon:t("cibaBackchannelTokenDeliveryModeHelp"),options:Ut.map(h=>({key:h,value:t(`cibaBackhannelTokenDeliveryModes.${h}`)})),controller:{defaultValue:""}}),e(Y,{name:"attributes.cibaExpiresIn",type:"number",min:G,max:W,label:t("cibaExpiresIn"),labelIcon:t("cibaExpiresInHelp"),rules:{min:{value:G,message:t("greaterThan",{value:G})},max:{value:W,message:t("lessThan",{value:W})},required:{value:!0,message:t("required")}}}),e(Y,{name:"attributes.cibaInterval",type:"number",min:G,max:W,label:t("cibaInterval"),labelIcon:t("cibaIntervalHelp"),rules:{min:{value:Ae,message:t("greaterThan",{value:Ae})},max:{value:we,message:t("lessThan",{value:we})},required:{value:!0,message:t("required")}}}),e(K,{name:"attributes.cibaAuthRequestedUserHint",label:t("cibaAuthRequestedUserHint"),labelIcon:t("cibaAuthRequestedUserHintHelp"),options:["login_hint","id_token_hint","login_hint_token"],controller:{defaultValue:""},isDisabled:!0})]}),b(B,{children:[e(P,{"data-testid":"save",variant:"primary",type:"submit",isDisabled:!i.formState.isValid||!i.formState.isDirty,children:t("save")}),e(P,{"data-testid":"reload",variant:F.link,onClick:()=>m({...n}),children:t("reload")})]})]})})},L=["totp","hotp"],ve=["SHA1","SHA256","SHA512"],Pe=[6,8],Bt=({realm:n,realmUpdated:a})=>{const{adminClient:l}=T(),{t}=S(),i=D({mode:"onChange",defaultValues:n}),{control:r,reset:c,handleSubmit:d,formState:{isValid:m,isDirty:g}}=i,{realm:h}=E(),{addAlert:f,addError:A}=N(),u=Fe(),y=je({name:"otpPolicyType",control:r,defaultValue:L[0]}),v=s=>c(s);j(()=>v(n),[]);const o=Me(()=>{const s=(n.otpSupportedApplications??[]).map(p=>t(`otpSupportedApplications.${p}`));return u(s,p=>p)},[n.otpSupportedApplications]);return e($,{variant:"light",children:e(Z,{role:"manage-realm",isHorizontal:!0,onSubmit:d(async s=>{try{await l.realms.update({realm:h},s);const p=await l.realms.findOne({realm:h});a(p),v(p),f(t("updateOtpSuccess"),k.success)}catch(p){A("updateOtpError",p)}}),className:"keycloak__otp_policies_authentication__form",children:b(M,{...i,children:[e(H,{label:t("otpType"),labelIcon:e(q,{helpText:t("otpTypeHelp"),fieldLabelId:"otpType"}),hasNoPaddingTop:!0,children:e(ne,{name:"otpPolicyType","data-testid":"otpPolicyType",defaultValue:L[0],control:r,render:({field:s})=>e(_,{children:L.map(p=>e(pe,{id:p,"data-testid":p,isChecked:s.value===p,name:"otpPolicyType",onChange:()=>s.onChange(p),label:t(`policyType.${p}`),className:"keycloak__otp_policies_authentication__policy-type"},p))})})}),e(K,{name:"otpPolicyAlgorithm",label:t("otpHashAlgorithm"),labelIcon:t("otpHashAlgorithmHelp"),options:ve.map(s=>({key:`Hmac${s}`,value:s})),controller:{defaultValue:`Hmac${ve[0]}`}}),e(H,{label:t("otpPolicyDigits"),labelIcon:e(q,{helpText:t("otpPolicyDigitsHelp"),fieldLabelId:"otpPolicyDigits"}),hasNoPaddingTop:!0,children:e(ne,{name:"otpPolicyDigits","data-testid":"otpPolicyDigits",defaultValue:Pe[0],control:r,render:({field:s})=>e(_,{children:Pe.map(p=>e(pe,{id:`digit-${p}`,"data-testid":`digit-${p}`,isChecked:s.value===p,name:"otpPolicyDigits",onChange:()=>s.onChange(p),label:p,className:"keycloak__otp_policies_authentication__number-of-digits"},p))})})}),e(he,{name:"otpPolicyLookAheadWindow",label:t("lookAround"),labelIcon:t("lookAroundHelp"),controller:{defaultValue:1,rules:{min:0}}}),y===L[0]&&e(Le,{name:"otpPolicyPeriod",label:t("otpPolicyPeriod"),labelIcon:t("otpPolicyPeriodHelp"),units:["second","minute"],controller:{defaultValue:30,rules:{min:1,max:{value:120,message:t("maxLength",{length:"2 "+t("minutes")})}}}}),y===L[1]&&e(he,{name:"otpPolicyInitialCounter",label:t("initialCounter"),labelIcon:t("initialCounterHelp"),controller:{defaultValue:30,rules:{min:1,max:120}}}),e(H,{label:t("supportedApplications"),labelIcon:e(q,{helpText:t("supportedApplicationsHelp"),fieldLabelId:"supportedApplications"}),children:e("span",{"data-testid":"supportedApplications",children:e(ze,{children:o.map(s=>e(Ge,{isReadOnly:!0,children:s},s))})})}),y===L[0]&&e(Ne,{name:"otpPolicyCodeReusable",label:t("otpPolicyCodeReusable"),labelIcon:t("otpPolicyCodeReusableHelp"),labelOn:t("on"),labelOff:t("off")}),b(B,{children:[e(P,{"data-testid":"save",variant:"primary",type:"submit",isDisabled:!m||!g,children:t("save")}),e(P,{"data-testid":"reload",variant:F.link,onClick:()=>c({...n}),children:t("reload")})]})]})})})},jt=({policy:{id:n,configType:a,defaultValue:l,displayName:t},onRemove:i})=>{const{t:r}=S(),{control:c,register:d,formState:{errors:m}}=We(),g=m[n];return b(H,{label:t,fieldId:n,isRequired:!0,labelIcon:e(q,{helpText:r(`passwordPoliciesHelp.${n}`),fieldLabelId:n}),children:[b(Ye,{children:[b(be,{isFilled:!0,children:[a&&a!=="int"&&e(Xe,{id:n,"data-testid":n,...d(n,{required:!0}),defaultValue:l,validated:g?ye.error:ye.default}),a==="int"&&e(ne,{name:n,defaultValue:Number.parseInt(l||"0"),control:c,render:({field:h})=>{const A=y=>h.onChange(Math.max(y,0)),u=Number(h.value);return e(Qe,{id:n,value:u,min:0,onPlus:()=>A(u+1),onMinus:()=>A(u-1),onChange:y=>{const v=Number(y.currentTarget.value);A(isNaN(v)?0:v)},className:"keycloak__policies_authentication__number-field"})}}),!a&&e(te,{id:n,label:r("on"),labelOff:r("off"),isChecked:!0,isDisabled:!0,"aria-label":t})]}),e(be,{children:e(P,{"data-testid":`remove-${n}`,variant:"link",className:"keycloak__policies_authentication__minus-icon",onClick:()=>i(n),"aria-label":r("remove"),children:e(Ze,{})})})]}),g&&e(Je,{message:r("required")})]})},He=" and ",zt=(n,a)=>n.map(l=>`${l.id}(${a[l.id]})`).join(He),Gt=(n,a)=>n.split(He).map(Wt).reduce((l,{id:t,value:i})=>{const r=a.find(c=>c.id===t);return r?l.concat({...r,value:i}):l},[]);function Wt(n){const a=n.indexOf("(");if(a===-1)return{id:n.trim()};const l=n.substring(0,a).trim(),t=n.lastIndexOf(")");if(t===-1)return{id:l};const i=n.substring(a+1,t).trim();return{id:l,value:i}}const Ce=({onSelect:n,selectedPolicies:a})=>{const{t:l}=S(),{passwordPolicies:t}=Oe(),[i,r]=R(!1),c=Me(()=>t?.filter(d=>a.find(m=>m.id===d.id)===void 0),[a]);return e(it,{onSelect:(d,m)=>{n(m),r(!1)},toggle:d=>e(lt,{ref:d,onClick:()=>r(!i),isExpanded:i,isDisabled:c?.length===0,style:{width:"300px"},"data-testid":"add-policy",children:l("addPolicy")}),isOpen:i,children:e(ot,{children:c?.map(d=>e(rt,{value:d,children:d.displayName},d.id))})})},Yt=({realm:n,realmUpdated:a})=>{const{adminClient:l}=T(),{t}=S(),{passwordPolicies:i}=Oe(),{addAlert:r,addError:c}=N(),{realm:d}=E(),[m,g]=R([]),h=s=>{g([...m,s]),u(s.id,s.defaultValue,{shouldDirty:!0})},f=D({defaultValues:{}}),{handleSubmit:A,setValue:u,reset:y,formState:{isDirty:v}}=f,o=s=>{y();const p=Gt(s.passwordPolicy||"",i);p.forEach(I=>{u(I.id,I.value)}),g(p)};j(()=>o(n),[]);const w=async s=>{const p={...n,passwordPolicy:zt(m,s)};try{await l.realms.update({realm:d},p),a(p),o(p),r(t("updatePasswordPolicySuccess"),k.success)}catch(I){c("updatePasswordPolicyError",I)}};return b($,{variant:"light",className:"pf-v5-u-p-0",children:[(m.length!==0||n.passwordPolicy)&&b(_,{children:[e(et,{children:e(tt,{children:e(xe,{children:e(Ce,{onSelect:h,selectedPolicies:m})})})}),e(at,{}),e($,{variant:"light",children:e(M,{...f,children:b(Z,{className:"keycloak__policies_authentication__form",role:"manage-realm",isHorizontal:!0,onSubmit:A(w),children:[m.map((s,p)=>e(jt,{policy:s,onRemove:I=>{g(m.filter(V=>V.id!==I)),u(s.id,"",{shouldDirty:!0})}},`${s.id}-${p}`)),b(B,{children:[e(P,{"data-testid":"save",variant:"primary",type:"submit",isDisabled:!v,children:t("save")}),e(P,{"data-testid":"reload",variant:F.link,onClick:()=>o(n),children:t("reload")})]})]})})})]}),!m.length&&!n.passwordPolicy&&b(Ct,{"data-testid":"empty-state",variant:"lg",children:[e(Tt,{titleText:e(_,{children:t("noPasswordPolicies")}),icon:e(Et,{icon:nt}),headingLevel:"h1"}),e(St,{children:t("noPasswordPoliciesInstructions")}),e(It,{children:e(Rt,{children:e(Ce,{onSelect:h,selectedPolicies:[]})})})]})]})},Xt=["ES256","ES384","ES512","RS256","RS384","RS512","Ed25519","RS1"],Qt=["not specified","none","indirect","direct"],Zt=["not specified","platform","cross-platform"],Jt=["not specified","Yes","No"],ea=["not specified","required","preferred","discouraged"],U=({name:n,label:a,options:l,labelPrefix:t,isMultiSelect:i=!1})=>{const{t:r}=S();return e(K,{name:n,label:r(a),variant:i?"typeaheadMulti":"single",controller:{defaultValue:l[0]},options:l.map(c=>({key:c,value:t?r(`${t}.${c}`):c}))})},Se=({realm:n,realmUpdated:a,isPasswordLess:l=!1})=>{const{adminClient:t}=T(),{t:i}=S(),{addAlert:r,addError:c}=N(),{realm:d}=E(),{enabled:m}=st(),g=D({mode:"onChange"}),{setValue:h,handleSubmit:f,formState:{isDirty:A}}=g,u=l?"webAuthnPolicyPasswordless":"webAuthnPolicy",y=o=>ce(o,h);j(()=>y(n),[]);const v=async o=>{const w=de(o);try{await t.realms.update({realm:d},w),a(w),y(w),r(i("webAuthnUpdateSuccess"),k.success)}catch(s){c("webAuthnUpdateError",s)}};return b($,{variant:"light",children:[m&&e(_e,{bodyContent:i(`${u}FormHelp`),children:e(ke,{className:"keycloak__section_intro__help",children:b(ae,{children:[e(_t,{})," ",i("webauthnIntro")]})})}),b(Z,{role:"manage-realm",isHorizontal:!0,onSubmit:f(v),className:"keycloak__webauthn_policies_authentication__form",children:[b(M,{...g,children:[e(Y,{name:`${u}RpEntityName`,label:i("webAuthnPolicyRpEntityName"),labelIcon:i("webAuthnPolicyRpEntityNameHelp"),rules:{required:{value:!0,message:i("required")}}}),e(U,{name:`${u}SignatureAlgorithms`,label:"webAuthnPolicySignatureAlgorithms",options:Xt,isMultiSelect:!0}),e(Y,{name:`${u}RpId`,label:i("webAuthnPolicyRpId"),labelIcon:i("webAuthnPolicyRpIdHelp")}),e(U,{name:`${u}AttestationConveyancePreference`,label:"webAuthnPolicyAttestationConveyancePreference",options:Qt,labelPrefix:"attestationPreference"}),e(U,{name:`${u}AuthenticatorAttachment`,label:"webAuthnPolicyAuthenticatorAttachment",options:Zt,labelPrefix:"authenticatorAttachment"}),e(U,{name:`${u}RequireResidentKey`,label:"webAuthnPolicyRequireResidentKey",options:Jt,labelPrefix:"residentKey"}),e(U,{name:`${u}UserVerificationRequirement`,label:"webAuthnPolicyUserVerificationRequirement",options:ea,labelPrefix:"userVerify"}),e(Le,{name:`${u}CreateTimeout`,label:i("webAuthnPolicyCreateTimeout"),labelIcon:i("otpPolicyPeriodHelp"),units:["second","minute","hour"],controller:{defaultValue:0,rules:{min:0,max:{value:31536,message:i("webAuthnPolicyCreateTimeoutHint")}}}}),e(Ne,{name:`${u}AvoidSameAuthenticatorRegister`,label:i("webAuthnPolicyAvoidSameAuthenticatorRegister"),labelIcon:i("webAuthnPolicyAvoidSameAuthenticatorRegisterHelp"),labelOn:i("on"),labelOff:i("off")}),e(H,{label:i("webAuthnPolicyAcceptableAaguids"),fieldId:"webAuthnPolicyAcceptableAaguids",labelIcon:e(q,{helpText:i("webAuthnPolicyAcceptableAaguidsHelp"),fieldLabelId:"webAuthnPolicyAcceptableAaguids"}),children:e(ge,{name:`${u}AcceptableAaguids`,"aria-label":i("webAuthnPolicyAcceptableAaguids"),addButtonLabel:"addAaguids"})}),e(H,{label:i("webAuthnPolicyExtraOrigins"),fieldId:"webAuthnPolicyExtraOrigins",labelIcon:e(q,{helpText:i("webAuthnPolicyExtraOriginsHelp"),fieldLabelId:"webAuthnPolicyExtraOrigins"}),children:e(ge,{name:`${u}ExtraOrigins`,"aria-label":i("webAuthnPolicyExtraOrigins"),addButtonLabel:"addOrigins"})})]}),b(B,{children:[e(P,{"data-testid":"save",variant:"primary",type:"submit",isDisabled:!A,children:i("save")}),e(P,{"data-testid":"reload",variant:F.link,onClick:()=>y(n),children:i("reload")})]})]})]})},ta=()=>{const{adminClient:n}=T(),{t:a}=S(),[l,t]=R(1),{realm:i}=E(),[r,c]=R();return se(async()=>{const d=await n.realms.findOne({realm:i});if(!d)throw new Error(a("notFound"));return d},d=>{c(d)},[]),r?b(kt,{activeKey:l,onSelect:(d,m)=>t(m),mountOnEnter:!0,unmountOnExit:!0,children:[e(O,{id:"passwordPolicy",eventKey:1,title:e(x,{children:a("passwordPolicy")}),children:e(Yt,{realm:r,realmUpdated:c})}),e(O,{id:"otpPolicy",eventKey:2,title:e(x,{children:a("otpPolicy")}),children:e(Bt,{realm:r,realmUpdated:c})}),e(O,{id:"webauthnPolicy",eventKey:3,title:e(x,{children:a("webauthnPolicy")}),children:e(Se,{realm:r,realmUpdated:c})}),e(O,{id:"webauthnPasswordlessPolicy",eventKey:4,title:e(x,{children:a("webauthnPasswordlessPolicy")}),children:e(Se,{realm:r,realmUpdated:c,isPasswordLess:!0})}),e(O,{"data-testid":"tab-ciba-policy",eventKey:5,title:e(x,{children:a("cibaPolicy")}),children:e(Kt,{realm:r,realmUpdated:c})})]}):e(ue,{})},X=new Map([["browserFlow","browser"],["registrationFlow","registration"],["directGrantFlow","direct grant"],["resetCredentialsFlow","reset credentials"],["clientAuthenticationFlow","clients"],["dockerAuthenticationFlow","docker auth"],["firstBrokerLoginFlow","firstBrokerLogin"]]),aa=({id:n,alias:a,usedBy:l,builtIn:t})=>{const{t:i}=S(),{realm:r}=E();return b(_,{children:[e(De,{to:Ie({realm:r,id:n,usedBy:l?.type||"notInUse",builtIn:t?"builtIn":void 0}),children:a},`link-${n}`)," ",t&&e(ut,{children:i("buildIn")},`label-${n}`)]})};function na(){const{adminClient:n}=T(),{t:a}=S(),{realm:l,realmRepresentation:t}=E(),[i,r]=R(0),c=()=>r(i+1),{addAlert:d,addError:m}=N(),g=Fe(),[h,f]=R(),[A,u]=ie(),[y,v]=ie(),o=async()=>{const me=await(await Te(`${Re(n.baseUrl)}admin/realms/${l}/ui-ext/authentication-management/flows`,{method:"GET",headers:Ee(await n.getAccessToken())})).json();return me?Nt(g(me,mt("alias")),qe=>qe.usedBy?.type):[]},w=C=>yt(fe({realm:l,tab:C})),s=w("flows"),p=w("required-actions"),I=w("policies"),[V,J]=pt({titleKey:"deleteConfirmFlow",children:b(Ft,{i18nKey:"deleteConfirmFlowMessage",children:[" ",e("strong",{children:{flow:h?h.alias:""}}),"."]}),continueButtonLabel:"delete",continueButtonVariant:F.danger,onConfirm:async()=>{try{await n.authenticationManagement.deleteFlow({flowId:h.id}),c(),d(a("deleteFlowSuccess"),k.success)}catch(C){m("deleteFlowError",C)}}});return t?b(_,{children:[e(J,{}),A&&e(Mt,{name:h?h.alias:"",description:h?.description,toggleDialog:u,onComplete:()=>{c(),u()}}),y&&e(Dt,{onClose:()=>{v(),c()},flowAlias:h?.alias}),e(ft,{titleKey:"titleAuthentication",subKey:"authenticationExplain",helpUrl:ct.authenticationUrl,divider:!1}),e($,{variant:"light",className:"pf-v5-u-p-0",children:b(bt,{isBox:!0,defaultLocation:fe({realm:l,tab:"flows"}),children:[e(O,{"data-testid":"flows",title:e(x,{children:a("flows")}),...s,children:e(Ve,{loader:o,ariaLabelKey:"titleAuthentication",searchPlaceholderKey:"searchForFlow",toolbarItem:e(xe,{children:e(P,{component:C=>e(De,{...C,to:dt({realm:l})}),children:a("createFlow")})}),actionResolver:({data:C})=>[{title:a("duplicate"),onClick:()=>{u(),f(C)}},...C.usedBy?.type!=="DEFAULT"?[{title:a("bindFlow"),onClick:()=>{v(),f(C)}}]:[],...!C.builtIn&&!C.usedBy?[{title:a("delete"),onClick:()=>{f(C),V()}}]:[]],columns:[{name:"alias",displayKey:"flowName",cellRenderer:C=>e(aa,{...C})},{name:"usedBy",displayKey:"usedBy",cellRenderer:C=>e($t,{authType:C})},{name:"description",displayKey:"description"}],emptyState:e(ht,{message:a("emptyEvents"),instructions:a("emptyEventsInstructions")})},i)}),e(O,{"data-testid":"requiredActions",title:e(x,{children:a("requiredActions")}),...p,children:e(Lt,{})}),e(O,{"data-testid":"policies",title:e(x,{children:a("policies")}),...I,children:e(ta,{})})]})})]}):e(ue,{})}const Ea=Object.freeze(Object.defineProperty({__proto__:null,REALM_FLOWS:X,default:na},Symbol.toStringTag,{value:"Module"}));export{Ea as A,Dt as B,xt as C,Mt as D};
//# sourceMappingURL=AuthenticationSection-DPPGU9pd.js.map




© 2015 - 2025 Weber Informatics LLC | Privacy Policy