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

theme.keycloak.v2.admin.resources.assets.ClientDetails-Cuh-h3cY.js Maven / Gradle / Ivy

There is a newer version: 26.0.7
Show newest version
import{jsx as e,jsxs as r,Fragment as L}from"react/jsx-runtime";import*as Le from"react";import{useState as f,useMemo as pt,useEffect as Ne,Fragment as On,useId as ga,useRef as ot}from"react";import{_ as mt,m as He,aU as ba,aV as ya,u as Y,c as ce,a as I,at as Ln,b as Be,w as te,aW as Ze,q as ht,r as he,aX as va,aY as sn,ac as F,ad as M,V as Tt,K as Ue,W as At,U as Ae,aZ as It,a6 as Sa,a7 as Ca,a8 as ka,a_ as We,aj as oe,ae as ie,ak as et,al as be,aH as Hn,aI as Kn,aJ as R,A as Ie,i as P,v as q,a$ as Ta,g as Pe,f as ae,M as qe,B as pe,F as Re,y as $,k as W,a2 as de,b0 as Aa,a4 as ke,P as re,b1 as Mn,Z as ue,b2 as Rt,b3 as Ee,O as Fn,b4 as Ia,b5 as Jt,b6 as St,ap as Ra,as as Vn,am as zn,aa as Me,$ as Ea,L as me,b7 as ft,b8 as Yt,b9 as xa,a0 as wa,ba as Pa,bb as Bn,bc as Ct,bd as _a,ar as Ke,be as Da,ab as Xe,bf as on,T as qt,bg as rn,bh as Na,a3 as xe,I as Un,d as tt,bi as dt,p as Gt,J as Qt,N as qn,D as Je,ay as nt,bj as ln,bk as Gn,bl as cn,bm as jn,bn as dn,R as ut,bo as Oa,bp as La,X as kt,Y as Ye,bq as un,br as Ha,bs as Ka,bt as Ma,s as Fa,aB as Va,aF as za,x as Ba,bu as Ua,bv as pn,bw as $n,bx as qa,aQ as Ga,by as ja,bz as $a,bA as mn,bB as hn,bC as Wa,aR as Ja,Q as Ya,S as fn,bD as Qa}from"./main-C7ps2lmX.js";import{C as Xt,u as ye}from"./ConfirmDialog-hx7XKLbN.js";import{P as Xa}from"./PermissionTab-CKEvhIGg.js";import{R as Za}from"./RolesList-DGhdq5QH.js";import{R as Kt,u as Mt}from"./RoutableTabs-T8JTILEW.js";import{V as ei}from"./ViewHeader-B7eeFzFA.js";import{u as Zt}from"./useParams-B67lSY02.js";import{u as ve}from"./useToggle-K3Kx99tM.js";import{D as Te}from"./SwitchControl-C_9Y74oV.js";import{F as se,a as Et,C as ti,b as Wn}from"./FormAccess-DyLNkc18.js";import{K as ni}from"./KeyValueInput-B0tpVTv9.js";import{M as Jn}from"./MultiLineInput-DiPNQ1LE.js";import{T as en}from"./TimeSelector-DcQmr_f3.js";import{s as Yn}from"./sortBy-DtY8l0cj.js";import{L as we,P as xt}from"./PaginatingTableToolbar-Cjsz5Jh4.js";import{K as wt,E as at}from"./KeycloakDataTable-DbY4la1D.js";import{u as Qn,F as ai}from"./useFormatDate-X7HJ5iYO.js";import{E as Xn}from"./ExpandableSection-CSay1Wbo.js";import{S as ii}from"./SessionsTable-7Bmc2htq.js";import{C as si,a as oi}from"./ClientDescription-p94dy3yH.js";import{L as ri}from"./LoginSettings-BIZRUkgM.js";import{C as li}from"./ClientSelect-B9UqjyP6.js";import{U as Zn,N as gn,D as ci,A as di}from"./NewPolicyDialog-DySSrR_B.js";import{d as ea,i as yt,g as ui}from"./utils-DeGqqWSp.js";import{c as pi}from"./camelCase-BNIoyGq8.js";import{U as Ge,V as je,W as ne,X as K,Y as $e,Z as O}from"./Td-D2hVFK0Z.js";import{D as bn}from"./policyRepresentation-LeM_FTje.js";import{D as it,a as mi,b as hi,c as fi}from"./DescriptionListTerm-Bdo198Bq.js";import{E as ta,a as na,b as gi}from"./EmptyStateFooter-DqmBOP2I.js";import{E as aa,a as bi}from"./EmptyStateActions-DWNUFByn.js";import{D as yi}from"./DeleteScopeDialog-D5dmjsK7.js";import{J as vi}from"./JsonFileUpload-DGJ9M0nq.js";import{F as ia}from"./FileUpload-CumNwlWc.js";import{F as Si,a as yn}from"./FlexItem-BzZfUnQ1.js";import{S as Ci,a as ki,C as Ti,n as Ai,t as Ii}from"./SearchFilter-D7dkU26J.js";import{A as vn,d as Sn,e as Ri,a as Ei,f as xi,C as Cn}from"./ClientScopeTypes-BnGjMgG5.js";import{c as rt,T as wi,a as X,b as Z}from"./Tabs-CMdqT4Cg.js";import{Q as Pi}from"./question-circle-icon-dDThmv9d.js";import{R as _i}from"./AddRoleMappingModal-DW8o4W0z.js";import{T as Di}from"./Trans-DcGUccv9.js";import"react-dom";import"./PageHandler-P2CRgucq.js";import"./DynamicComponents-DvaX3FJx.js";import"./GroupPickerDialog-C09EjRTA.js";import"./DataListItemRow-BC0LurDd.js";import"./KeySelect-jKxsKqdI.js";import"./CodeEditor-C-nZkUJx.js";import"./copy-icon-ACZmDH8e.js";import"./PageList-s9OtSlkz.js";import"./_baseFlatten-eIEJR-AJ.js";import"./ListItem-CHzEhhky.js";import"./filter-icon-DO0QNij3.js";import"./DatePicker-DTJHSI7E.js";import"./debounce-DTNSlfWG.js";import"./capitalize-Dxqk2Vco.js";import"./_baseSlice-F8doVSIJ.js";import"./grip-vertical-icon-BxF7V59o.js";import"./FileUploadForm-BgyzQxBE.js";const ct={codeBlock:"pf-v5-c-code-block",codeBlockActions:"pf-v5-c-code-block__actions",codeBlockCode:"pf-v5-c-code-block__code",codeBlockContent:"pf-v5-c-code-block__content",codeBlockHeader:"pf-v5-c-code-block__header",codeBlockPre:"pf-v5-c-code-block__pre"},sa=n=>{var{children:i=null,className:a,actions:t=null}=n,s=mt(n,["children","className","actions"]);return Le.createElement("div",Object.assign({className:He(ct.codeBlock,a)},s),t&&Le.createElement("div",{className:He(ct.codeBlockHeader)},Le.createElement("div",{className:He(ct.codeBlockActions)},t)),Le.createElement("div",{className:He(ct.codeBlockContent)},i))};sa.displayName="CodeBlock";const oa=n=>{var{children:i=null,className:a}=n,t=mt(n,["children","className"]);return Le.createElement("div",Object.assign({className:He(`${ct.codeBlockActions}-item`,a)},t),i)};oa.displayName="CodeBlockAction";const jt=n=>{var{className:i,children:a}=n,t=mt(n,["className","children"]);return Le.createElement("div",Object.assign({className:He(ba.panelHeader,i)},t),a)};jt.displayName="PanelHeader";var $t;(function(n){n.ul="ul",n.ol="ol",n.dl="dl"})($t||($t={}));const ra=n=>{var{children:i=null,className:a="",component:t=$t.ul,isPlain:s=!1}=n,o=mt(n,["children","className","component","isPlain"]);const l=t;return Le.createElement(l,Object.assign({},o,{className:He(s&&ya.modifiers.plain,a)}),i)};ra.displayName="TextList";var Wt;(function(n){n.li="li",n.dt="dt",n.dd="dd"})(Wt||(Wt={}));const la=n=>{var{children:i=null,className:a="",component:t=Wt.li}=n,s=mt(n,["children","className","component"]);const o=t;return Le.createElement(o,Object.assign({},s,{className:He(a)}),i)};la.displayName="TextListItem";const Ni=({id:n,open:i,toggleDialog:a,protocol:t="openid-connect"})=>{const{adminClient:s}=Y(),{realm:o}=ce(),{t:l}=I(),{enabled:c}=Ln(),u=Be().clientInstallations[t],[d,g]=f(u[u.length-1].id),[m,h]=f(),[S,E]=f(!1),k=pt(()=>u.find(v=>v.id===d)??null,[d]),T=v=>v.replace(/.*<\/PrivateKeyPem>/gs,`${l("privateKeyMask")}`);return te(async()=>{if(k?.mediaType==="application/zip")return(await Sa(`${ka(s.baseUrl)}admin/realms/${o}/clients/${n}/installation/providers/${d}`,{method:"GET",headers:Ca(await s.getAccessToken())})).arrayBuffer();{const v=await s.clients.getInstallationProviders({id:n,providerId:d});return typeof v=="string"?T(v):We(v)}},v=>h(v),[n,d]),Ne(()=>h(""),[n,d]),e(Xt,{titleKey:l("downloadAdaptorTitle"),continueButtonLabel:l("download"),onConfirm:()=>{Ze.saveAs(new Blob([m],{type:k?.mediaType}),k?.filename)},open:i,toggleDialog:a,variant:ht.medium,children:e(he,{children:r(va,{hasGutter:!0,children:[e(sn,{children:e(F,{fieldId:"type",label:l("formatOption"),labelIcon:e(M,{helpText:l("downloadType"),fieldLabelId:"formatOption"}),children:e(Tt,{isOpen:S,onOpenChange:v=>E(v),toggle:v=>e(Ue,{id:"type",ref:v,onClick:()=>E(!S),isExpanded:S,children:d}),selected:d,onSelect:(v,D)=>{g(D?.toString()||""),E(!1)},"aria-label":l("selectOne"),popperProps:{appendTo:document.body},children:e(At,{children:u.map(v=>e(Ae,{value:v.id,isSelected:d===v.id,description:c?v.helpText:void 0,children:v.displayType},v.id))})})})}),!k?.downloadOnly&&e(sn,{isFilled:!0,children:e(F,{fieldId:"details",label:l("details"),labelIcon:e(M,{helpText:l("detailsHelp"),fieldLabelId:"details"}),children:e(It,{id:"details",readOnly:!0,rows:12,resizeOrientation:"vertical",value:m&&typeof m=="string"?m:"","aria-label":"text area example"})})})]})})})},Ft="tokenLifespan.inherited",Vt="tokenLifespan.expires",lt=({id:n,name:i,defaultValue:a,units:t})=>{const{t:s}=I(),[o,l]=f(!1),[c,p]=f(!1),u=()=>p(!0),d=()=>p(!1),{control:g}=oe(),m=h=>typeof h=="number"||typeof h=="string"&&h!==""||c;return e(F,{label:s(n),fieldId:n,labelIcon:e(M,{helpText:s(`${n}Help`),fieldLabelId:n}),"data-testid":`token-lifespan-${n}`,children:e(ie,{name:i,defaultValue:"",control:g,render:({field:h})=>r(et,{hasGutter:!0,children:[e(be,{children:e(Tt,{toggle:S=>e(Ue,{ref:S,onClick:()=>l(!o),isExpanded:o,children:m(h.value)?s(Vt):s(Ft)}),isOpen:o,onOpenChange:S=>l(S),onSelect:(S,E)=>{h.onChange(E),l(!1)},selected:m(h.value)?s(Vt):s(Ft),children:r(At,{children:[e(Ae,{value:"",children:s(Ft)}),e(Ae,{value:60,children:s(Vt)})]})})}),e(be,{hidden:!m(h.value),children:e(en,{validated:m(h.value)&&h.value<1?"warning":"default",units:t,value:h.value===""?a:h.value,onChange:h.onChange,onFocus:u,onBlur:d,min:1,isDisabled:!m(h.value)})})]})})})},Oi=({save:n,reset:i,protocol:a,hasConfigureAccess:t})=>{const{t:s}=I(),[o,l]=f(!1),{realmRepresentation:c}=ce(),u=Hn()(Kn.DPoP),{control:d}=oe();return r(se,{role:"manage-realm",fineGrainedAccess:t,isHorizontal:!0,children:[a!=="openid-connect"&&e(F,{label:s("assertionLifespan"),fieldId:"assertionLifespan",labelIcon:e(M,{helpText:s("assertionLifespanHelp"),fieldLabelId:"assertionLifespan"}),children:e(ie,{name:R("attributes.saml.assertion.lifespan"),defaultValue:"",control:d,render:({field:g})=>e(en,{units:["minute","day","hour"],value:g.value,onChange:g.onChange})})}),a==="openid-connect"&&r(L,{children:[e(lt,{id:"accessTokenLifespan",name:R("attributes.access.token.lifespan"),defaultValue:c?.accessTokenLifespan,units:["minute","day","hour"]}),e(lt,{id:"clientSessionIdle",name:R("attributes.client.session.idle.timeout"),defaultValue:c?.clientSessionIdleTimeout,units:["minute","day","hour"]}),e(lt,{id:"clientSessionMax",name:R("attributes.client.session.max.lifespan"),defaultValue:c?.clientSessionMaxLifespan,units:["minute","day","hour"]}),e(lt,{id:"clientOfflineSessionIdle",name:R("attributes.client.offline.session.idle.timeout"),defaultValue:c?.offlineSessionIdleTimeout,units:["minute","day","hour"]}),c?.offlineSessionMaxLifespanEnabled&&e(lt,{id:"clientOfflineSessionMax",name:R("attributes.client.offline.session.max.lifespan"),defaultValue:c?.offlineSessionMaxLifespanEnabled?c.offlineSessionMaxLifespan:void 0,units:["minute","day","hour"]}),e(Te,{name:R("attributes.tls.client.certificate.bound.access.tokens"),label:s("oAuthMutual"),labelIcon:s("oAuthMutualHelp"),stringify:!0}),u&&e(Te,{name:R("attributes.dpop.bound.access.tokens"),label:s("oAuthDPoP"),labelIcon:s("oAuthDPoPHelp"),stringify:!0}),e(F,{label:s("keyForCodeExchange"),fieldId:"keyForCodeExchange",hasNoPaddingTop:!0,labelIcon:e(M,{helpText:s("keyForCodeExchangeHelp"),fieldLabelId:"keyForCodeExchange"}),children:e(ie,{name:R("attributes.pkce.code.challenge.method"),defaultValue:"",control:d,render:({field:g})=>e(Tt,{toggle:m=>e(Ue,{id:"keyForCodeExchange",ref:m,onClick:()=>l(!o),isExpanded:o,children:[g.value||s("choose")]}),isOpen:o,onOpenChange:m=>l(m),onSelect:(m,h)=>{g.onChange(h),l(!1)},selected:g.value,children:e(At,{children:["","S256","plain"].map(m=>e(Ae,{value:m,children:m||s("choose")},m))})})})}),e(Te,{name:R("attributes.require.pushed.authorization.requests"),label:s("pushedAuthorizationRequestRequired"),labelIcon:s("pushedAuthorizationRequestRequiredHelp"),stringify:!0}),e(Te,{name:R("attributes.client.use.lightweight.access.token.enabled"),label:s("lightweightAccessToken"),labelIcon:s("lightweightAccessTokenHelp"),stringify:!0}),e(Te,{name:R("attributes.client.introspection.response.allow.jwt.claim.enabled"),label:s("supportJwtClaimInIntrospectionResponse"),labelIcon:s("supportJwtClaimInIntrospectionResponseHelp"),stringify:!0}),e(F,{label:s("acrToLoAMapping"),fieldId:"acrToLoAMapping",labelIcon:e(M,{helpText:s("acrToLoAMappingHelp"),fieldLabelId:"acrToLoAMapping"}),children:e(ni,{label:s("acrToLoAMapping"),name:R("attributes.acr.loa.map")})}),e(F,{label:s("defaultACRValues"),fieldId:"defaultACRValues",labelIcon:e(M,{helpText:s("defaultACRValuesHelp"),fieldLabelId:"defaultACRValues"}),children:e(Jn,{id:"defaultACRValues","aria-label":"defaultACRValues",name:R("attributes.default.acr.values"),stringify:!0})})]}),r(Ie,{children:[e(P,{variant:"secondary",onClick:n,"data-testid":"OIDCAdvancedSave",children:s("save")}),e(P,{variant:"link",onClick:i,"data-testid":"OIDCAdvancedRevert",children:s("revert")})]})]})},Li=({protocol:n,save:i,reset:a,hasConfigureAccess:t})=>{const{adminClient:s}=Y(),{t:o}=I(),[l,c]=f([]);return te(()=>s.authenticationManagement.getFlows(),p=>{let u=[...p.filter(d=>d.providerId!=="client-flow")];u=Yn(u,[d=>d.alias]),c(u)},[]),r(se,{role:"manage-clients",fineGrainedAccess:t,isHorizontal:!0,children:[e(q,{name:"authenticationFlowBindingOverrides.browser",label:o("browserFlow"),labelIcon:o("browserFlowHelp"),controller:{defaultValue:""},options:[{key:"",value:o("choose")},...l.map(({id:p,alias:u})=>({key:p,value:u}))]}),n==="openid-connect"&&e(q,{name:"authenticationFlowBindingOverrides.direct_grant",label:o("directGrant"),labelIcon:o("directGrantHelp"),controller:{defaultValue:""},options:[{key:"",value:o("choose")},...l.map(({id:p,alias:u})=>({key:p,value:u}))]}),r(Ie,{children:[e(P,{variant:"secondary",onClick:i,"data-testid":"OIDCAuthFlowOverrideSave",children:o("save")}),e(P,{variant:"link",onClick:a,"data-testid":"OIDCAuthFlowOverrideRevert",children:o("revert")})]})]})},Hi=n=>{const{field:i}=Ta(n);return e(en,{...n,...i})},Ki=({clientId:n,isOpen:i,onAdded:a,onClose:t})=>{const{adminClient:s}=Y(),{t:o}=I(),l=Pe(),{handleSubmit:c,formState:{isDirty:p,isValid:u}}=l,{addAlert:d,addError:g}=ae();async function m({node:h}){try{await s.clients.addClusterNode({id:n,node:h}),a(h),d(o("addedNodeSuccess"),W.success)}catch(S){g("addedNodeFail",S)}t()}return e(qe,{title:o("addNode"),isOpen:i,onClose:t,variant:"small",actions:[e(P,{id:"add-node-confirm",type:"submit",form:"add-host-form",isDisabled:!p||!u,children:o("save")},"confirm"),e(P,{id:"add-node-cancel",variant:pe.link,onClick:t,children:o("cancel")},"cancel")],children:e(Re,{...l,children:e(he,{id:"add-host-form",onSubmit:c(m),isHorizontal:!0,children:e($,{name:"node",label:o("nodeHost"),rules:{required:o("required")}})})})})},Mi=({save:n,client:{id:i,registeredNodes:a,access:t}})=>{const{adminClient:s}=Y(),{t:o}=I(),{addAlert:l,addError:c}=ae(),p=Qn(),[u,d]=f(a||{}),[g,m]=f(!1),[h,S]=f(""),[E,k]=f(!1),[T,v]=f(0),D=()=>v(new Date().getTime()),V=async()=>{const y=await s.clients.testNodesAvailable({id:i});Bi(y,"testCluster",l,o)},[z,U]=ye({titleKey:"deleteNode",messageKey:o("deleteNodeBody",{node:h}),continueButtonLabel:"delete",continueButtonVariant:pe.danger,onConfirm:async()=>{try{await s.clients.deleteClusterNode({id:i,node:h}),d({...Object.keys(u).reduce((y,H)=>(H!==h&&(y[H]=u[H]),y),{})}),D(),l(o("deleteNodeSuccess"),W.success)}catch(y){c("deleteNodeFail",y)}}});return r(L,{children:[e(se,{role:"manage-clients",fineGrainedAccess:t?.configure,isHorizontal:!0,children:e(F,{label:o("nodeReRegistrationTimeout"),fieldId:"kc-node-reregistration-timeout",labelIcon:e(M,{helpText:o("nodeReRegistrationTimeoutHelp"),fieldLabelId:"nodeReRegistrationTimeout"}),children:r(et,{hasGutter:!0,children:[e(be,{children:e(Hi,{name:"nodeReRegistrationTimeout"})}),e(be,{children:e(P,{variant:pe.secondary,onClick:()=>n(),children:o("save")})})]})})}),r(L,{children:[e(U,{}),e(Ki,{clientId:i,isOpen:E,onAdded:y=>{u[y]=Date.now()/1e3,D()},onClose:()=>k(!1)}),e(Xn,{toggleText:o("registeredClusterNodes"),onToggle:(y,H)=>m(H),isExpanded:g,children:e(wt,{ariaLabelKey:"registeredClusterNodes",loader:()=>Promise.resolve(Object.entries(u||{}).map(y=>({host:y[0],registration:y[1]}))),toolbarItem:r(L,{children:[e(de,{children:e(P,{id:"testClusterAvailability",onClick:V,variant:pe.secondary,isDisabled:Object.keys(u).length===0,children:o("testClusterAvailability")})}),e(de,{children:e(P,{id:"registerNodeManually",onClick:()=>k(!0),variant:pe.tertiary,children:o("registerNodeManually")})})]}),actions:[{title:o("delete"),onRowClick:y=>{S(y.host),z()}}],columns:[{name:"host",displayKey:"nodeHost"},{name:"registration",displayKey:"lastRegistration",cellFormatters:[y=>y?p(new Date(parseInt(y.toString())*1e3),ai):""]}],emptyState:e(we,{message:o("noNodes"),instructions:o("noNodesInstructions"),primaryActionText:o("registerNodeManually"),onPrimaryAction:()=>k(!0)})},T)})]})]})},ca=n=>{const{t:i}=I();return r(L,{children:[e($,{name:"attributes.logoUri",label:i("logoUrl"),labelIcon:i("logoUrlHelp"),type:"url",...n}),e($,{name:"attributes.policyUri",label:i("policyUrl"),labelIcon:i("policyUrlHelp"),type:"url",...n}),e($,{name:"attributes.tosUri",label:i("termsOfServiceUrl"),labelIcon:i("termsOfServiceUrlHelp"),type:"url",...n})]})},Fi=({save:n,reset:i,hasConfigureAccess:a})=>{const{t}=I(),s=Be().providers,o=s?.clientSignature.providers,l=s?.contentencryption.providers,c=s?.cekmanagement.providers,p=s?.signature.providers,u=h=>Aa(h).map(S=>({key:S,value:S})),d=h=>[{key:"",value:t("choose")},...u(h)],g=h=>[{key:"any",value:t("any")},...u(h)],m=h=>[{key:"none",value:t("none")},...u(h)];return r(se,{role:"manage-clients",fineGrainedAccess:a,isHorizontal:!0,children:[e(ca,{}),e(q,{name:R("attributes.access.token.signed.response.alg"),label:t("accessTokenSignatureAlgorithm"),labelIcon:t("accessTokenSignatureAlgorithmHelp"),controller:{defaultValue:""},options:d(o)}),e(q,{name:R("attributes.id.token.signed.response.alg"),label:t("idTokenSignatureAlgorithm"),labelIcon:t("idTokenSignatureAlgorithmHelp"),controller:{defaultValue:""},options:d(o)}),e(q,{name:R("attributes.id.token.encrypted.response.alg"),label:t("idTokenEncryptionKeyManagementAlgorithm"),labelIcon:t("idTokenEncryptionKeyManagementAlgorithmHelp"),controller:{defaultValue:""},options:d(c)}),e(q,{name:R("attributes.id.token.encrypted.response.enc"),label:t("idTokenEncryptionContentEncryptionAlgorithm"),labelIcon:t("idTokenEncryptionContentEncryptionAlgorithmHelp"),controller:{defaultValue:""},options:d(l)}),e(q,{name:R("attributes.user.info.response.signature.alg"),label:t("userInfoSignedResponseAlgorithm"),labelIcon:t("userInfoSignedResponseAlgorithmHelp"),controller:{defaultValue:""},options:d(p)}),e(q,{name:R("attributes.user.info.encrypted.response.alg"),label:t("userInfoResponseEncryptionKeyManagementAlgorithm"),labelIcon:t("userInfoResponseEncryptionKeyManagementAlgorithmHelp"),controller:{defaultValue:""},options:d(c)}),e(q,{name:R("attributes.user.info.encrypted.response.enc"),label:t("userInfoResponseEncryptionContentEncryptionAlgorithm"),labelIcon:t("userInfoResponseEncryptionContentEncryptionAlgorithmHelp"),controller:{defaultValue:""},options:d(l)}),e(q,{name:R("attributes.request.object.signature.alg"),label:t("requestObjectSignatureAlgorithm"),labelIcon:t("requestObjectSignatureAlgorithmHelp"),controller:{defaultValue:""},options:[{key:"any",value:t("any")},...m(o)]}),e(q,{name:R("attributes.request.object.encryption.alg"),label:t("requestObjectEncryption"),labelIcon:t("requestObjectEncryptionHelp"),controller:{defaultValue:""},options:g(c)}),e(q,{name:R("attributes.request.object.encryption.enc"),label:t("requestObjectEncoding"),labelIcon:t("requestObjectEncodingHelp"),controller:{defaultValue:""},options:g(l)}),e(q,{name:R("attributes.request.object.required"),label:t("requestObjectRequired"),labelIcon:t("requestObjectRequiredHelp"),controller:{defaultValue:""},options:["not required","request or request_uri","request only","request_uri only"].map(h=>({key:h,value:t(`requestObject.${h}`)}))}),e(F,{label:t("validRequestURIs"),fieldId:"validRequestURIs",labelIcon:e(M,{helpText:t("validRequestURIsHelp"),fieldLabelId:"validRequestURIs"}),children:e(Jn,{name:R("attributes.request.uris"),"aria-label":t("validRequestURIs"),addButtonLabel:"addRequestUri",stringify:!0})}),e(q,{name:R("attributes.authorization.signed.response.alg"),label:t("authorizationSignedResponseAlg"),labelIcon:t("authorizationSignedResponseAlgHelp"),controller:{defaultValue:""},options:d(p)}),e(q,{name:R("attributes.authorization.encrypted.response.alg"),label:t("authorizationEncryptedResponseAlg"),labelIcon:t("authorizationEncryptedResponseAlgHelp"),controller:{defaultValue:""},options:d(c)}),e(q,{name:R("attributes.authorization.encrypted.response.enc"),label:t("authorizationEncryptedResponseEnc"),labelIcon:t("authorizationEncryptedResponseEncHelp"),controller:{defaultValue:""},options:d(l)}),r(Ie,{children:[e(P,{variant:"secondary",id:"fineGrainSave",onClick:n,children:t("save")}),e(P,{id:"fineGrainRevert",variant:"link",onClick:i,children:t("revert")})]})]})},Vi=({save:n,reset:i})=>{const{t:a}=I();return r(se,{role:"manage-realm",isHorizontal:!0,children:[e(ca,{}),e($,{name:"attributes.saml_assertion_consumer_url_post",label:a("assertionConsumerServicePostBindingURL"),labelIcon:a("assertionConsumerServicePostBindingURLHelp"),type:"url"}),e($,{name:"attributes.saml_assertion_consumer_url_redirect",label:a("assertionConsumerServiceRedirectBindingURL"),labelIcon:a("assertionConsumerServiceRedirectBindingURLHelp"),type:"url"}),e($,{name:"attributes.saml_single_logout_service_url_post",label:a("logoutServicePostBindingURL"),labelIcon:a("logoutServicePostBindingURLHelp"),type:"url"}),e($,{name:"attributes.saml_single_logout_service_url_redirect",label:a("logoutServiceRedirectBindingURL"),labelIcon:a("logoutServiceRedirectBindingURLHelp"),type:"url"}),e($,{name:"attributes.saml_single_logout_service_url_soap",label:a("logoutServiceSoapBindingUrl"),labelIcon:a("logoutServiceSoapBindingUrlHelp"),type:"url"}),e($,{name:"attributes.saml_single_logout_service_url_artifact",label:a("logoutServiceArtifactBindingUrl"),labelIcon:a("logoutServiceArtifactBindingUrlHelp"),type:"url"}),e($,{name:"attributes.saml_artifact_binding_url",label:a("artifactBindingUrl"),labelIcon:a("artifactBindingUrlHelp"),type:"url"}),e($,{name:"attributes.saml_artifact_resolution_service_url",label:a("artifactResolutionService"),labelIcon:a("artifactResolutionServiceHelp"),type:"url"}),r(Ie,{children:[e(P,{variant:"tertiary",onClick:n,"data-testid":"fineGrainSave",children:a("save")}),e(P,{variant:"link",onClick:i,"data-testid":"fineGrainRevert",children:a("revert")})]})]})},zi=({save:n,reset:i,hasConfigureAccess:a})=>{const{t}=I(),{control:s}=oe();return r(se,{role:"manage-clients",fineGrainedAccess:a,isHorizontal:!0,children:[e(F,{label:t("excludeSessionStateFromAuthenticationResponse"),fieldId:"excludeSessionStateFromAuthenticationResponse",hasNoPaddingTop:!0,labelIcon:e(M,{helpText:t("excludeSessionStateFromAuthenticationResponseHelp"),fieldLabelId:"excludeSessionStateFromAuthenticationResponse"}),children:e(ie,{name:R("attributes.exclude.session.state.from.auth.response"),defaultValue:"",control:s,render:({field:o})=>e(ke,{id:"excludeSessionStateFromAuthenticationResponse-switch",label:t("on"),labelOff:t("off"),isChecked:o.value==="true",onChange:(l,c)=>o.onChange(c.toString()),"aria-label":t("excludeSessionStateFromAuthenticationResponse")})})}),e(F,{label:t("excludeIssuerFromAuthenticationResponse"),fieldId:"excludeIssuerFromAuthenticationResponse",hasNoPaddingTop:!0,labelIcon:e(M,{helpText:t("excludeIssuerFromAuthenticationResponseHelp"),fieldLabelId:"excludeIssuerFromAuthenticationResponse"}),children:e(ie,{name:R("attributes.exclude.issuer.from.auth.response"),defaultValue:"",control:s,render:({field:o})=>e(ke,{id:"excludeIssuerFromAuthenticationResponse-switch",label:t("on"),labelOff:t("off"),isChecked:o.value==="true",onChange:(l,c)=>o.onChange(c.toString()),"aria-label":t("excludeIssuerFromAuthenticationResponse")})})}),e(F,{label:t("useRefreshTokens"),fieldId:"useRefreshTokens",hasNoPaddingTop:!0,labelIcon:e(M,{helpText:t("useRefreshTokensHelp"),fieldLabelId:"useRefreshTokens"}),children:e(ie,{name:R("attributes.use.refresh.tokens"),defaultValue:"true",control:s,render:({field:o})=>e(ke,{id:"useRefreshTokens",label:t("on"),labelOff:t("off"),isChecked:o.value==="true",onChange:(l,c)=>o.onChange(c.toString()),"aria-label":t("useRefreshTokens")})})}),e(F,{label:t("useRefreshTokenForClientCredentialsGrant"),fieldId:"useRefreshTokenForClientCredentialsGrant",hasNoPaddingTop:!0,labelIcon:e(M,{helpText:t("useRefreshTokenForClientCredentialsGrantHelp"),fieldLabelId:"useRefreshTokenForClientCredentialsGrant"}),children:e(ie,{name:R("attributes.client_credentials.use_refresh_token"),defaultValue:"false",control:s,render:({field:o})=>e(ke,{id:"useRefreshTokenForClientCredentialsGrant",label:t("on"),labelOff:t("off"),isChecked:o.value==="true",onChange:(l,c)=>o.onChange(c.toString()),"aria-label":t("useRefreshTokenForClientCredentialsGrant")})})}),e(F,{label:t("useLowerCaseBearerType"),fieldId:"useLowerCaseBearerType",hasNoPaddingTop:!0,labelIcon:e(M,{helpText:t("useLowerCaseBearerTypeHelp"),fieldLabelId:"useLowerCaseBearerType"}),children:e(ie,{name:R("attributes.token.response.type.bearer.lower-case"),defaultValue:"false",control:s,render:({field:o})=>e(ke,{id:"useLowerCaseBearerType",label:t("on"),labelOff:t("off"),isChecked:o.value==="true",onChange:(l,c)=>o.onChange(c.toString()),"aria-label":t("useLowerCaseBearerType")})})}),r(Ie,{children:[e(P,{variant:"secondary",onClick:n,"data-testid":"OIDCCompatabilitySave",children:t("save")}),e(P,{variant:"link",onClick:i,"data-testid":"OIDCCompatabilityRevert",children:t("revert")})]})]})},Bi=(n,i,a,t)=>{const s=n.successRequests?.length||0,o=n.failedRequests?.length||0;s===0&&o===0?a(t("noAdminUrlSet"),W.warning):o>0?(a(t(i+"Success",{successNodes:n.successRequests}),W.success),a(t(i+"Fail",{failedNodes:n.failedRequests}),W.danger)):a(t(i+"Success",{successNodes:n.successRequests}),W.success)},Ui=({save:n,client:i})=>{const{t:a}=I(),t="openid-connect",{setValue:s}=oe(),{publicClient:o,attributes:l,protocol:c,authenticationFlowBindingOverrides:p}=i,u=d=>{for(const g of d)s(R(`attributes.${g}`),l?.[g]||"")};return e(re,{variant:"light",className:"pf-v5-u-py-0",children:e(Mn,{label:a("jumpToSection"),sections:[{title:a("clustering"),isHidden:!o,panel:e(Mi,{client:i,save:n})},{title:a("fineGrainOpenIdConnectConfiguration"),isHidden:c!==t,panel:r(L,{children:[e(ue,{className:"pf-v5-u-pb-lg",children:a("fineGrainOpenIdConnectConfigurationHelp")}),e(Fi,{save:n,reset:()=>{u(["logoUri","policyUri","tosUri","access.token.signed.response.alg","id.token.signed.response.alg","id.token.encrypted.response.alg","id.token.encrypted.response.enc","user.info.response.signature.alg","user.info.encrypted.response.alg","user.info.encrypted.response.enc","request.object.signature.alg","request.object.encryption.alg","request.object.encryption.enc","request.object.required","request.uris","authorization.signed.response.alg","authorization.encrypted.response.alg","authorization.encrypted.response.enc"])}})]})},{title:a("openIdConnectCompatibilityModes"),isHidden:c!==t,panel:r(L,{children:[e(ue,{className:"pf-v5-u-pb-lg",children:a("openIdConnectCompatibilityModesHelp")}),e(zi,{save:()=>n(),reset:()=>u(["exclude.session.state.from.auth.response","use.refresh.tokens","client_credentials.use_refresh_token","token.response.type.bearer.lower-case"])})]})},{title:a("fineGrainSamlEndpointConfig"),isHidden:c===t,panel:r(L,{children:[e(ue,{className:"pf-v5-u-pb-lg",children:a("fineGrainSamlEndpointConfigHelp")}),e(Vi,{save:()=>n(),reset:()=>u(["logoUri","policyUri","tosUri","saml_assertion_consumer_url_post","saml_assertion_consumer_url_redirect","saml_single_logout_service_url_post","saml_single_logout_service_url_redirect","saml_single_logout_service_url_artifact","saml_artifact_binding_url","saml_artifact_resolution_service_url"])})]})},{title:a("advancedSettings"),panel:r(L,{children:[e(ue,{className:"pf-v5-u-pb-lg",children:a("advancedSettings"+Rt(c||""))}),e(Oi,{protocol:c,save:()=>n(),reset:()=>{u(["saml.assertion.lifespan","access.token.lifespan","tls.client.certificate.bound.access.tokens","pkce.code.challenge.method"])}})]})},{title:a("authenticationOverrides"),panel:r(L,{children:[e(ue,{className:"pf-v5-u-pb-lg",children:a("authenticationOverridesHelp")}),e(Li,{protocol:c,save:()=>n(),reset:()=>{s("authenticationFlowBindingOverrides.browser",p?.browser),s("authenticationFlowBindingOverrides.direct_grant",p?.direct_grant)}})]})}],borders:!0})})},qi=({client:n})=>{const{adminClient:i}=Y(),{t:a}=I();return e(re,{variant:"light",className:"pf-v5-u-p-0",children:e(ii,{loader:async(s,o)=>{const l=p=>u=>u.map(d=>({type:p,...d}));return(await Promise.all([i.clients.listSessions({id:n.id,first:s,max:o}).then(l(a("sessionsType.regularSSO"))),i.clients.listOfflineSessions({id:n.id,first:s,max:o}).then(l(a("sessionsType.offline")))])).flat()},hiddenColumns:["clients"],emptyInstructions:a("noSessionsForClient")})})},Gi=({client:n,save:i,reset:a})=>{const{t}=I(),{watch:s}=oe(),{hasAccess:o}=Ee(),l=o("manage-clients")||n.access?.configure,c=s("protocol");return r(se,{isHorizontal:!0,fineGrainedAccess:n.access?.configure,role:"manage-clients",children:[!n.bearerOnly&&e(ri,{protocol:c}),c!=="saml"&&e($,{type:"url",name:"adminUrl",label:t("adminURL"),labelIcon:t("adminURLHelp")}),n.bearerOnly&&e(Et,{name:"settings",save:i,reset:a,isActive:!l})]})},ji=({access:n})=>{const{t:i}=I(),{watch:a}=oe(),t=Be().themes.login,s=a("consentRequired"),o=a(R("attributes.display.on.consent.screen"));return r(se,{isHorizontal:!0,fineGrainedAccess:n,role:"manage-clients",children:[e(q,{name:"attributes.login_theme",label:i("loginTheme"),labelIcon:i("loginThemeHelp"),controller:{defaultValue:""},options:[{key:"",value:i("choose")},...t.map(({name:l})=>({key:l,value:l}))]}),e(Te,{name:"consentRequired",label:i("consentRequired"),labelIcon:i("consentRequiredHelp")}),e(Te,{name:R("attributes.display.on.consent.screen"),label:i("displayOnClient"),labelIcon:i("displayOnClientHelp"),isDisabled:!s,stringify:!0}),e(Fn,{name:R("attributes.consent.screen.text"),label:i("consentScreenText"),labelIcon:i("consentScreenTextHelp"),isDisabled:!(s&&o==="true")})]})},kn=(n,i)=>(n?.startsWith("https://")||n?.startsWith("http://"))&&!n.includes("*")||n===""||i,$i=({save:n,reset:i,client:{access:a}})=>{const{t}=I(),{control:s,watch:o}=oe(),{hasAccess:l}=Ee(),c=l("manage-clients")||a?.configure,p=o("protocol"),u=o("frontchannelLogout");return r(se,{isHorizontal:!0,fineGrainedAccess:a?.configure,role:"manage-clients",children:[e(F,{label:t("frontchannelLogout"),labelIcon:e(M,{helpText:t("frontchannelLogoutHelp"),fieldLabelId:"frontchannelLogout"}),fieldId:"kc-frontchannelLogout",hasNoPaddingTop:!0,children:e(ie,{name:"frontchannelLogout",defaultValue:!0,control:s,render:({field:d})=>e(ke,{id:"kc-frontchannelLogout-switch",label:t("on"),labelOff:t("off"),isChecked:d.value,onChange:d.onChange,"aria-label":t("frontchannelLogout")})})}),p==="openid-connect"&&u&&e($,{"data-testid":"frontchannelLogoutUrl",type:"url",name:R("attributes.frontchannel.logout.url"),label:t("frontchannelLogoutUrl"),labelIcon:t("frontchannelLogoutUrlHelp"),rules:{validate:d=>kn(d,t("frontchannelUrlInvalid").toString())}}),p==="openid-connect"&&r(L,{children:[e($,{"data-testid":"backchannelLogoutUrl",type:"url",name:R("attributes.backchannel.logout.url"),label:t("backchannelLogoutUrl"),labelIcon:t("backchannelLogoutUrlHelp"),rules:{validate:d=>kn(d,t("backchannelUrlInvalid").toString())}}),e(F,{label:t("backchannelLogoutSessionRequired"),labelIcon:e(M,{helpText:t("backchannelLogoutSessionRequiredHelp"),fieldLabelId:"backchannelLogoutSessionRequired"}),fieldId:"backchannelLogoutSessionRequired",hasNoPaddingTop:!0,children:e(ie,{name:R("attributes.backchannel.logout.session.required"),defaultValue:"true",control:s,render:({field:d})=>e(ke,{id:"backchannelLogoutSessionRequired",label:t("on"),labelOff:t("off"),isChecked:d.value==="true",onChange:(g,m)=>d.onChange(m.toString()),"aria-label":t("backchannelLogoutSessionRequired")})})}),e(F,{label:t("backchannelLogoutRevokeOfflineSessions"),labelIcon:e(M,{helpText:t("backchannelLogoutRevokeOfflineSessionsHelp"),fieldLabelId:"backchannelLogoutRevokeOfflineSessions"}),fieldId:"backchannelLogoutRevokeOfflineSessions",hasNoPaddingTop:!0,children:e(ie,{name:R("attributes.backchannel.logout.revoke.offline.tokens"),defaultValue:"false",control:s,render:({field:d})=>e(ke,{id:"backchannelLogoutRevokeOfflineSessions",label:t("on"),labelOff:t("off"),isChecked:d.value==="true",onChange:(g,m)=>d.onChange(m.toString()),"aria-label":t("backchannelLogoutRevokeOfflineSessions")})})})]}),e(Et,{name:"settings",save:n,reset:i,isActive:c})]})},De=({name:n,label:i})=>{const{t:a}=I();return e(Te,{name:n,label:a(i),labelIcon:a(`${i}Help`),stringify:!0})},Wi=()=>{const{t:n}=I();return r(se,{isHorizontal:!0,role:"manage-clients",className:"keycloak__capability-config__form",children:[e(q,{name:"attributes.saml_name_id_format",label:n("nameIdFormat"),labelIcon:n("nameIdFormatHelp"),controller:{defaultValue:"username"},options:["username","email","transient","persistent"]}),e(De,{name:"attributes.saml_force_name_id_format",label:"forceNameIdFormat"}),e(De,{name:R("attributes.saml.force.post.binding"),label:"forcePostBinding"}),e(De,{name:R("attributes.saml.artifact.binding"),label:"forceArtifactBinding"}),e(De,{name:R("attributes.saml.authnstatement"),label:"includeAuthnStatement"}),e(De,{name:R("attributes.saml.onetimeuse.condition"),label:"includeOneTimeUseCondition"}),e(De,{name:R("attributes.saml.server.signature.keyinfo.ext"),label:"optimizeLookup"}),e(De,{name:R("attributes.saml.allow.ecp.flow"),label:"allowEcpFlow"})]})},Tn=["RSA_SHA1","RSA_SHA256","RSA_SHA256_MGF1","RSA_SHA512","RSA_SHA512_MGF1","DSA_SHA1"],An=["NONE","KEY_ID","CERT_SUBJECT"],In=[{name:"EXCLUSIVE",value:"http://www.w3.org/2001/10/xml-exc-c14n#"},{name:"EXCLUSIVE_WITH_COMMENTS",value:"http://www.w3.org/2001/10/xml-exc-c14n#WithComments"},{name:"INCLUSIVE",value:"http://www.w3.org/TR/2001/REC-xml-c14n-20010315"},{name:"INCLUSIVE_WITH_COMMENTS",value:"http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments"}],Ji=()=>{const{t:n}=I(),{watch:i}=oe(),a=i(R("attributes.saml.server.signature")),t=i(R("attributes.saml.assertion.signature"));return r(se,{isHorizontal:!0,role:"manage-clients",className:"keycloak__capability-config__form",children:[e(De,{name:R("attributes.saml.server.signature"),label:"signDocuments"}),e(De,{name:R("attributes.saml.assertion.signature"),label:"signAssertions"}),(a==="true"||t==="true")&&r(L,{children:[e(q,{name:R("attributes.saml.signature.algorithm"),label:n("signatureAlgorithm"),labelIcon:n("signatureAlgorithmHelp"),controller:{defaultValue:Tn[0]},options:[...Tn]}),e(q,{name:R("attributes.saml.server.signature.keyinfo.xmlSigKeyInfoKeyNameTransformer"),label:n("signatureKeyName"),labelIcon:n("signatureKeyNameHelp"),controller:{defaultValue:An[0]},options:[...An]}),e(q,{name:"attributes.saml_signature_canonicalization_method",label:n("canonicalization"),labelIcon:n("canonicalizationHelp"),controller:{defaultValue:In[0].value},options:In.map(({name:s,value:o})=>({key:o,value:s}))})]})]})},Yi=n=>{const{t:i}=I(),{watch:a}=oe(),t=a("protocol"),{client:s}=n;return e(Mn,{label:i("jumpToSection"),className:"pf-v5-u-px-lg pf-v5-u-pb-lg",sections:[{title:i("generalSettings"),panel:e(he,{isHorizontal:!0,children:e(si,{protocol:s.protocol,hasConfigureAccess:s.access?.configure})})},{title:i("accessSettings"),panel:e(Gi,{...n})},{title:i("samlCapabilityConfig"),isHidden:t!=="saml"||s.bearerOnly,panel:e(Wi,{})},{title:i("signatureAndEncryption"),isHidden:t!=="saml"||s.bearerOnly,panel:e(Ji,{})},{title:i("capabilityConfig"),isHidden:t!=="openid-connect"||s.bearerOnly,panel:e(oi,{})},{title:i("loginSettings"),isHidden:s.bearerOnly,panel:e(ji,{access:s.access?.configure})},{title:i("logoutSettings"),isHidden:s.bearerOnly,panel:e($i,{...n})}]})},Qi=({name:n,rowIndex:i,attribute:a,selectableValues:t,resources:s})=>{const{t:o}=I(),{control:l,register:c,getValues:p}=oe(),[u,d]=f([!1]),g=(E,k)=>{const T=[...u];T[E]=k,d(T)},m=pt(()=>{let E=[];return t&&(E=ea.find(k=>k.key===p().context?.[i]?.key)?.values),E},[p]),h=()=>{const E=s?.find(k=>k.name===p().resources?.[i]?.key)?.scopes;if(m?.length&&!s)return m.map(k=>e(Ae,{value:k.key,children:k.name},k.key));if(E?.length)return E.map(k=>e(Ae,{value:k.name,children:k.name},k.name))},S=E=>pi(E).replace(/\W/g,"");return e(O,{children:s||m?.length?e(ie,{name:`${n}.${i}.value`,defaultValue:[],control:l,render:({field:E})=>e(Jt,{toggleId:`${a.id}-value`,className:"kc-attribute-value-selectable",chipGroupProps:{numChips:1,expandedText:o("hide"),collapsedText:o("showRemaining")},onToggle:k=>g(i,k),isOpen:u[i],variant:St.typeahead,typeAheadAriaLabel:o("selectOrTypeAKey"),placeholderText:o("selectOrTypeAKey"),selections:E.value,onSelect:k=>{E.onChange(k),g(i,!1)},children:h()})}):e(zn,{id:`${S(a.key)}-value`,className:"value-input",defaultValue:a.value,"data-testid":"attribute-value-input","aria-label":o("value"),...c(`${n}.${i}.value`)})})},Rn=({name:n,selectableValues:i,resources:a})=>{const{t}=I(),{control:s,watch:o}=oe(),{fields:l,append:c,remove:p}=Ia({control:s,name:n}),[u,d]=f([!1]),g=(h,S)=>{const E=[...u];E[h]=S,d(E)};Ne(()=>{l.length||c({key:"",value:""},{shouldFocus:!1})},[l]);const m=o(`${n}.${l.length-1}.value`,"");return r(Ge,{className:"kc-attributes__table","aria-label":"Role attribute keys and values",variant:"compact",children:[e(je,{children:r(ne,{children:[e(K,{width:40,children:t("key")}),e(K,{width:40,children:t("value")})]})}),r($e,{children:[l.map((h,S)=>r(ne,{"data-testid":"attribute-row",children:[e(O,{children:e(ie,{name:`${n}.${S}.key`,defaultValue:"",control:s,render:({field:E})=>e(Jt,{toggleId:`${n}.${S}.key`,className:"kc-attribute-key-selectable",onToggle:k=>g(S,k),isOpen:u[S],variant:St.typeahead,typeAheadAriaLabel:t("selectOrTypeAKey"),placeholderText:t("selectOrTypeAKey"),selections:E.value,onSelect:k=>{E.onChange(k.toString()),g(S,!1)},children:i?.map(k=>e(Ae,{selected:k.name===E.value,value:a?k.name:k.key,children:k.name},k.key))})})}),e(Qi,{name:n,attribute:h,rowIndex:S,selectableValues:i,resources:a}),e(O,{children:e(P,{id:`${n}-minus-button-${S}`,variant:"link",className:"kc-attributes__minus-icon",onClick:()=>p(S),"aria-label":t("remove"),children:e(Ra,{})})})]},h.id)),e(ne,{children:e(O,{children:e(P,{"aria-label":t("addAttribute",{label:t("attribute")}),id:`${n}-plus-icon`,variant:"link",className:"kc-attributes__plus-icon",onClick:()=>{c({key:"",value:""}),d([...u,!1])},icon:e(Vn,{}),isDisabled:!m,"data-testid":"attribute-add-row",children:t("addAttribute",{label:t("attribute")})})})})]})]})},Xi=({data:n})=>{const{t:i}=I(),[a,t]=ve();return r(L,{children:[e(P,{"data-testid":"authorization-revert",onClick:t,variant:"secondary",children:i("showAuthData")}),e(qe,{variant:ht.medium,isOpen:a,"aria-label":i("authData"),header:r(Me,{children:[e(ue,{component:Ea.h1,children:i("authData")}),e(ue,{children:i("authDataDescription")})]}),onClose:t,actions:[e(P,{"data-testid":"cancel",id:"modal-cancel",onClick:t,children:i("cancel")},"cancel")],children:e(It,{readOnly:!0,rows:20,value:We(n)})})]})},Zi=({idx:n,rowIndex:i,outerPolicy:a,resource:t})=>{const[s,o]=f(!1),{t:l}=I(),{realm:c}=ce(),{clientId:p}=Zt();return r($e,{isExpanded:s,children:[r(ne,{children:[e(O,{expand:{rowIndex:i,isExpanded:s,onToggle:()=>o(u=>!u)}}),e(O,{"data-testid":`name-column-${t.resource}`,children:e(me,{to:ft({realm:c,id:p,permissionType:a.policy?.type,permissionId:a.policy?.id}),children:a.policy?.name})}),e(O,{id:a.status?.toLowerCase(),children:l(a.status?.toLowerCase())}),e(O,{children:l(`${a.policy?.decisionStrategy?.toLowerCase()}`)}),e(O,{children:a.status===bn.Permit?t.policies?.[i]?.scopes?.join(", "):"-"}),e(O,{children:a.status===bn.Deny&&t.policies?.[i]?.scopes?.length?t.policies[i].scopes?.join(", "):"-"})]}),r(ne,{isExpanded:s,children:[e(O,{}),e(O,{colSpan:5,children:s&&e(at,{children:e(it,{isHorizontal:!0,className:"keycloak_resource_details",children:e(Me,{children:e(ra,{children:a.associatedPolicies?.map(u=>r(la,{children:[e(me,{to:Yt({realm:c,id:p,policyType:u.policy?.type,policyId:u.policy?.id}),children:u.policy?.name}),l("votedToStatus",{status:xa(u.status)})]},"policyDetails"))})})})})})]},`child-${t.resource}`)]},n)},es=({rowIndex:n,resource:i,evaluateResults:a})=>{const[t,s]=f(!1),{t:o}=I();return r($e,{isExpanded:t,children:[r(ne,{children:[e(O,{expand:{rowIndex:n,isExpanded:t,onToggle:()=>s(l=>!l)}}),e(O,{"data-testid":`name-column-${i.resource}`,children:i.resource?.name}),e(O,{id:i.status?.toLowerCase(),children:o(`${i.status?.toLowerCase()}`)}),e(O,{children:i.allowedScopes?.length?i.allowedScopes.map(l=>l.name):"-"})]}),r(ne,{isExpanded:t,children:[e(O,{}),e(O,{colSpan:5,children:e(at,{children:t&&e(it,{isHorizontal:!0,className:"keycloak_resource_details",children:r(Ge,{"aria-label":o("evaluationResults"),children:[e(je,{children:r(ne,{children:[e(K,{"aria-hidden":"true"}),e(K,{children:o("permission")}),e(K,{children:o("results")}),e(K,{children:o("decisionStrategy")}),e(K,{children:o("grantedScopes")}),e(K,{children:o("deniedScopes")}),e(K,{"aria-hidden":"true"})]})}),Object.values(a[n].policies).map((l,c)=>e(Zi,{idx:c,rowIndex:n,outerPolicy:l,resource:i},c))]})})})})]},`child-${i.resource}`)]})};function ts(n,i){switch(i){case"STATUS_PERMITTED":return n.filter(({status:a})=>a==="PERMIT");case"STATUS_DENIED":return n.filter(({status:a})=>a==="DENY");default:return n}}const ns=({evaluateResult:n,refresh:i,back:a})=>{const{t}=I(),[s,o]=ve(),[l,c]=f("ALL"),[p,u]=f(""),[d,g]=f(""),m=()=>{u(d)},h=T=>{T.key==="Enter"&&m()},S=pt(()=>ts(n.results,l).filter(({resource:T})=>T?.name?.includes(p)??!1),[n.results,l,p]),E=n.results.length===0,k=S.length===0;return r(re,{children:[e(wa,{children:r(Pa,{className:"providers-toolbar",children:[e(de,{children:r(Bn,{children:[e(Ct,{isFill:!0,children:e(zn,{name:"inputGroupName",id:"inputGroupName",type:"search","aria-label":t("search"),placeholder:t("search"),onChange:(T,v)=>g(v),onKeyDown:h})}),e(Ct,{children:e(P,{variant:pe.control,"aria-label":t("search"),onClick:()=>m(),children:e(_a,{})})})]})}),e(de,{children:e(Tt,{"data-testid":"filter-type-select",isOpen:s,className:"kc-filter-type-select",toggle:T=>e(Ue,{ref:T,onClick:o,isExpanded:s,style:{width:"300px"},children:l}),onSelect:(T,v)=>{c(v),o(),i()},selected:l,children:r(At,{children:[e(Ae,{"data-testid":"all-results-option",value:"ALL",children:t("allResults")}),e(Ae,{"data-testid":"result-permit-option",value:"STATUS_PERMITTED",children:t("resultPermit")}),e(Ae,{"data-testid":"result-deny-option",value:"STATUS_DENIED",children:t("resultDeny")})]})})})]})}),!k&&r(Ge,{"aria-label":t("evaluationResults"),children:[e(je,{children:r(ne,{children:[e(K,{"aria-hidden":"true"}),e(K,{children:t("resource")}),e(K,{children:t("overallResults")}),e(K,{children:t("scopes")}),e(K,{"aria-hidden":"true"})]})}),S.map((T,v)=>e(es,{rowIndex:v,resource:T,evaluateResults:n.results},v))]}),(k||E)&&r(L,{children:[e(Ke,{}),e(we,{isSearchVariant:!0,message:t("noSearchResults"),instructions:t("noSearchResultsInstructions")})]}),e(he,{children:r(Et,{name:"authorization",children:[e(P,{"data-testid":"authorization-eval",id:"back-btn",onClick:a,children:t("back")})," ",e(P,{"data-testid":"authorization-reevaluate",id:"reevaluate-btn",variant:"secondary",onClick:i,children:t("reevaluate")})," ",e(Xi,{data:n.rpt})]})})]})},as=n=>{const{hasAccess:i}=Ee();return i("view-users")?e(is,{...n}):e(Da,{permissionNeeded:"view-users"})},is=({client:n})=>{const{adminClient:i}=Y(),a=Pe({mode:"onChange"}),{control:t,reset:s,trigger:o,formState:{isValid:l}}=a,{t:c}=I(),{addError:p}=ae(),u=ce(),[d,g]=f(!1),[m,h]=f(!1),[S,E]=f([]),[k,T]=f([]),[v,D]=f(),[V,z]=f([]);te(()=>i.roles.find(),x=>{z(x)},[]),te(()=>Promise.all([i.clients.listResources({id:n.id}),i.clients.listAllScopes({id:n.id})]),([x,_])=>{E(x),T(_)},[]);const U=async()=>{if(!await o())return;const x=a.getValues(),_=Na(x.resources),A={roleIds:x.roleIds??[],clientId:x.client.id,userId:x.user[0],resources:S.filter(b=>Object.keys(_).includes(b.name)).map(b=>({...b,scopes:b.scopes?.filter(C=>Object.values(_).flatMap(B=>B).includes(C.name))})),entitlements:!1,context:{attributes:Object.fromEntries(x.context.attributes.filter(b=>b.key||b.value!=="").map(({key:b,value:C})=>[b,C]))}};try{const b=await i.clients.evaluateResource({id:n.id,realm:u.realm},A);D(b)}catch(b){p("evaluateError",b)}},y=Xe({control:t,name:"user",defaultValue:[]}),H=Xe({control:t,name:"roleIds",defaultValue:[]});return v?e(ns,{evaluateResult:v,refresh:U,back:()=>D(void 0)}):e(re,{children:r(Re,{...a,children:[r(on,{children:[e(jt,{children:e(qt,{headingLevel:"h2",children:c("identityInformation")})}),e(rn,{children:r(se,{isHorizontal:!0,role:"view-clients",children:[e(li,{name:"client",label:"client",helpText:"clientHelp",defaultValue:n.clientId}),e(Zn,{name:"user",label:"users",helpText:c("selectUser"),defaultValue:[],variant:"typeahead",isRequired:H?.length===0}),e(q,{name:"roleIds",label:c("roles"),labelIcon:c("rolesHelp"),variant:"typeaheadMulti",placeholderText:c("selectARole"),controller:{defaultValue:[],rules:{required:{value:y.length===0,message:c("required")}}},options:V.map(x=>x.name)})]})})]}),r(on,{children:[e(jt,{children:e(qt,{headingLevel:"h2",children:c("permissions")})}),e(rn,{children:r(se,{isHorizontal:!0,role:"view-clients",children:[e(F,{label:c("applyToResourceType"),fieldId:"applyToResourceType",labelIcon:e(M,{helpText:c("applyToResourceTypeHelp"),fieldLabelId:"applyToResourceType"}),children:e(ke,{id:"applyToResource-switch",label:c("on"),labelOff:c("off"),isChecked:m,onChange:(x,_)=>h(_),"aria-label":c("applyToResourceType")})}),m?r(L,{children:[e($,{name:"alias",label:c("resourceType"),labelIcon:c("resourceTypeHelp"),rules:{required:c("required")}}),e(q,{name:"authScopes",label:c("authScopes"),labelIcon:c("scopesSelect"),controller:{defaultValue:[]},variant:"typeaheadMulti",options:k.map(x=>x.name)})]}):e(F,{label:c("resourcesAndScopes"),id:"resourcesAndScopes",labelIcon:e(M,{helpText:c("contextualAttributesHelp"),fieldLabelId:"resourcesAndScopes"}),fieldId:"resourcesAndScopes",children:e(Rn,{selectableValues:S.map(x=>({name:x.name,key:x._id})),resources:S,name:"resources"})}),e(Xn,{toggleText:c("contextualInfo"),onToggle:()=>g(!d),isExpanded:d,children:e(F,{label:c("contextualAttributes"),id:"contextualAttributes",labelIcon:e(M,{helpText:c("contextualAttributesHelp"),fieldLabelId:"contextualAttributes"}),fieldId:"contextualAttributes",children:e(Rn,{selectableValues:ea,name:"context.attributes"})})})]})})]}),r(Ie,{children:[e(P,{"data-testid":"authorization-eval",id:"authorization-eval",className:"pf-v5-u-mr-md",isDisabled:!l,onClick:()=>U(),children:c("evaluate")}),e(P,{"data-testid":"authorization-revert",id:"authorization-revert",className:"pf-v5-u-mr-md",variant:"link",onClick:()=>s(),children:c("revert")})]})]})})},ss=()=>{const{adminClient:n}=Y(),{t:i}=I(),{clientId:a}=Zt(),{addAlert:t,addError:s}=ae(),[o,l]=f(),[c,p]=f();te(()=>n.clients.exportResource({id:a}),d=>{l(JSON.stringify(d,null,2)),p(d)},[]);const u=()=>{try{Ze.saveAs(new Blob([We(c)],{type:"application/json"}),"test-authz-config.json"),t(i("exportAuthDetailsSuccess"),W.success)}catch(d){s("exportAuthDetailsError",d)}};return o?e(re,{children:r(se,{isHorizontal:!0,role:"manage-authorization",className:"pf-v5-u-mt-lg",children:[e(Fn,{name:"authDetails",label:i("authDetails"),labelIcon:i("authDetailsHelp"),resizeOrientation:"vertical",defaultValue:o,readOnly:!0,rows:10}),r(Ie,{children:[e(P,{"data-testid":"authorization-export-download",onClick:()=>u(),children:i("download")}),e(P,{"data-testid":"authorization-export-copy",variant:"secondary",onClick:async()=>{try{await navigator.clipboard.writeText(o),t(i("copied"),W.success)}catch(d){s(i("copyError"),d)}},children:i("copy")})]})]})}):e(xe,{})};function os(n){return e(ze,{...n})}function ze({name:n,array:i,convert:a,link:t}){const{t:s}=I();return r(mi,{children:[e(hi,{children:s(n)}),r(fi,{children:[i?.map(o=>{const l=typeof o=="string"?o:a(o);return t?e(me,{to:t(o),className:"pf-v5-u-pr-sm",children:l},l):e("span",{className:"pf-v5-u-pr-sm",children:l},l)}),i?.length===0&&e("i",{children:s("none")})]})]})}const En=({permissionType:n,disabled:i=!1,clientId:a})=>{const{t}=I(),{realm:s}=ce(),o=tt();return e(P,{"data-testid":`create-${n}`,className:i?"keycloak__permissions__empty_state ":"pf-v5-u-m-sm",variant:"secondary",onClick:()=>!i&&o(dt({realm:s,id:a,permissionType:n})),children:t(`create${Rt(n)}BasedPermission`)})},xn=({permissionType:n,disabled:i,...a})=>{const{t}=I();return i?e(Un,{content:t(`no${Rt(n)}CreateHint`),children:e(En,{...a,disabled:i,permissionType:n})}):e(En,{...a,disabled:i,permissionType:n})},rs=({clientId:n,isResourceEnabled:i,isScopeEnabled:a})=>{const{t}=I();return r(ta,{"data-testid":"empty-state",variant:"lg",children:[e(aa,{titleText:e(L,{children:t("emptyPermissions")}),icon:e(bi,{icon:Vn}),headingLevel:"h1"}),e(na,{children:t("emptyPermissionInstructions")}),r(gi,{children:[e(xn,{permissionType:"resource",disabled:i,clientId:n}),e("br",{}),e(xn,{permissionType:"scope",disabled:a,clientId:n})]})]})},tn=({array:n})=>{const{t:i}=I();return!n||n.length<=1?null:e(Gt,{color:"blue",children:i("more",{count:n.length-1})})},nn=({types:n,search:i,onSearch:a,type:t})=>{const{t:s}=I(),o=Pe({mode:"onChange"}),{reset:l,formState:{isDirty:c},handleSubmit:p}=o,[u,d]=ve(),g=m=>{d(),a(m)};return Ne(()=>l(i),[i]),e(Qt,{onOpenChange:d,toggle:m=>r(Ue,{"data-testid":"searchdropdown_dorpdown",ref:m,onClick:d,className:"keycloak__client_authentication__searchdropdown",children:[t==="resource"&&s("searchClientAuthorizationResource"),t==="policy"&&s("searchClientAuthorizationPolicy"),t==="permission"&&s("searchClientAuthorizationPermission")]}),isOpen:u,children:e(Re,{...o,children:r(he,{isHorizontal:!0,className:"keycloak__client_authentication__searchdropdown_form",onSubmit:p(g),children:[e($,{name:"name",label:s("name")}),t==="resource"&&r(L,{children:[e($,{name:"type",label:s("type")}),e($,{name:"uris",label:s("uris")}),e($,{name:"owner",label:s("owner")})]}),t!=="resource"&&t!=="policy"&&e($,{name:"resource",label:s("resource")}),t!=="policy"&&e($,{name:"scope",label:s("scope")}),t!=="resource"&&e(q,{name:"type",label:s("type"),controller:{defaultValue:""},options:[{key:"",value:s("allTypes")},...(n||[]).map(({type:m,name:h})=>({key:m,value:h}))]}),r(Ie,{children:[e(P,{variant:"primary",type:"submit","data-testid":"search-btn",isDisabled:!c,children:s("search")}),e(P,{variant:"link","data-testid":"revert-btn",onClick:()=>a({}),children:s("clear")})]})]})})})},ls=({row:n})=>r(L,{children:[n.associatedPolicies?.[0]?.name," ",e(tn,{array:n.associatedPolicies})]}),cs=({clientId:n,isDisabled:i=!1})=>{const{adminClient:a}=Y(),{t}=I(),s=tt(),{addAlert:o,addError:l}=ae(),{realm:c}=ce(),[p,u]=f(),[d,g]=f(),[m,h]=f(),[S,E]=f(),[k,T]=ve(),[v,D]=f({}),[V,z]=f(0),U=()=>z(V+1),[y,H]=f(10),[x,_]=f(0);te(async()=>{const N=await a.clients.findPermissions({first:x,max:y+1,id:n,...v});return await Promise.all(N.map(async ee=>{const w=await a.clients.getAssociatedPolicies({id:n,permissionId:ee.id});return{...ee,associatedPolicies:w,isExpanded:!1}}))},u,[V,v,x,y]),te(async()=>{const N={first:0,max:1},[ee,w,G]=await Promise.all([a.clients.listPolicyProviders({id:n}),a.clients.listResources({...N,id:n}),a.clients.listAllScopes({...N,id:n})]);return{policies:ee.filter(fe=>fe.type==="resource"||fe.type==="scope"),resources:w.length!==1,scopes:G.length!==1}},({policies:N,resources:ee,scopes:w})=>{h(N),E({resources:ee,scopes:w})},[]);const[A,b]=ye({titleKey:"deletePermission",messageKey:t("deletePermissionConfirm",{permission:d?.name}),continueButtonVariant:pe.danger,continueButtonLabel:"confirm",onConfirm:async()=>{try{await a.clients.delPermission({id:n,type:d?.type,permissionId:d?.id}),o(t("permissionDeletedSuccess"),W.success),U()}catch(N){l("permissionDeletedError",N)}}});if(!p)return e(xe,{});const C=p.length===0,B=Object.keys(v).length!==0;return r(re,{variant:"light",className:"pf-v5-u-p-0",children:[e(b,{}),(!C||B)&&e(xt,{count:p.length,first:x,max:y,onNextClick:_,onPreviousClick:_,onPerPageSelect:(N,ee)=>{_(N),H(ee)},toolbarItem:r(L,{children:[e(de,{children:e(nn,{types:m,search:v,onSearch:D,type:"permission"})}),e(de,{children:e(Qt,{onOpenChange:T,toggle:N=>e(Ue,{ref:N,onClick:T,isDisabled:i,variant:"primary","data-testid":"permissionCreateDropdown",children:t("createPermission")}),isOpen:k,children:r(qn,{children:[e(Je,{"data-testid":"create-resource",isDisabled:i||S?.resources,component:"button",onClick:()=>s(dt({realm:c,id:n,permissionType:"resource"})),children:t("createResourceBasedPermission")}),e(Ke,{}),r(Je,{"data-testid":"create-scope",isDisabled:i||S?.scopes,component:"button",onClick:()=>s(dt({realm:c,id:n,permissionType:"scope"})),children:[t("createScopeBasedPermission"),S?.scopes&&e(nt,{className:"pf-v5-u-mt-sm",variant:"warning",isInline:!0,isPlain:!0,title:t("noScopeCreateHint")})]})]})})})]}),children:!C&&r(Ge,{"aria-label":t("resources"),variant:"compact",children:[e(je,{children:r(ne,{children:[e(K,{"aria-hidden":"true"}),e(K,{children:t("name")}),e(K,{children:t("type")}),e(K,{children:t("associatedPolicy")}),e(K,{children:t("description")}),e(K,{"aria-hidden":"true"})]})}),p.map((N,ee)=>r($e,{isExpanded:N.isExpanded,children:[r(ne,{children:[e(O,{expand:{rowIndex:ee,isExpanded:N.isExpanded,onToggle:(w,G)=>{const fe=p.map((_e,j)=>j===G?{..._e,isExpanded:!_e.isExpanded}:_e);u(fe)}}}),e(O,{"data-testid":`name-column-${N.name}`,children:e(me,{to:ft({realm:c,id:n,permissionType:N.type,permissionId:N.id}),children:N.name})}),e(O,{children:m?.find(w=>w.type===N.type)?.name}),e(O,{children:e(ls,{row:N})}),e(O,{children:N.description}),e(O,{actions:{items:[{title:t("delete"),onClick:async()=>{g(N),A()}}]}})]}),r(ne,{isExpanded:N.isExpanded,children:[e(O,{}),e(O,{colSpan:5,children:e(at,{children:N.isExpanded&&e(it,{isHorizontal:!0,className:"keycloak_resource_details",children:e(ze,{name:"associatedPolicy",array:N.associatedPolicies,convert:w=>w.name,link:w=>Yt({id:n,realm:c,policyId:w.id,policyType:w.type})})})})})]},`child-${N.id}`)]},N.id))]})}),C&&!B&&e(rs,{clientId:n,isResourceEnabled:!i&&S?.resources,isScopeEnabled:!i&&S?.scopes}),C&&B&&e(we,{isSearchVariant:!0,message:t("noSearchResults"),instructions:t("noSearchResultsInstructions")})]})},ds=({row:n})=>r(L,{children:[n.dependentPolicies?.[0]?.name," ",e(tn,{array:n.dependentPolicies})]}),us=({clientId:n,isDisabled:i=!1})=>{const{adminClient:a}=Y(),{t}=I(),{addAlert:s,addError:o}=ae(),{realm:l}=ce(),c=tt(),[p,u]=f(),[d,g]=f(),[m,h]=f(),[S,E]=f(0),k=()=>E(S+1),[T,v]=f(10),[D,V]=f(0),[z,U]=f({}),[y,H]=ve();te(async()=>{const C=await a.clients.listPolicies({first:D,max:T+1,id:n,permission:"false",...z});return await Promise.all([a.clients.listPolicyProviders({id:n}),...(C||[]).map(async B=>{const N=await a.clients.listDependentPolicies({id:n,policyId:B.id});return{...B,dependentPolicies:N,isExpanded:!1}})])},([C,...B])=>{h(C.filter(N=>N.type!=="resource"&&N.type!=="scope")),u(B)},[S,z,D,T]);const[x,_]=ye({titleKey:"deletePolicy",children:r(L,{children:[t("deletePolicyConfirm"),d?.dependentPolicies&&d.dependentPolicies.length>0&&e(nt,{variant:"warning",isInline:!0,isPlain:!0,component:"p",title:t("deletePolicyWarning"),className:"pf-v5-u-pt-lg",children:e("p",{className:"pf-v5-u-pt-xs",children:d.dependentPolicies.map(C=>e("strong",{className:"pf-v5-u-pr-md",children:C.name},C.id))})})]}),continueButtonLabel:"confirm",onConfirm:async()=>{try{await a.clients.delPolicy({id:n,policyId:d?.id}),s(t("policyDeletedSuccess"),W.success),k()}catch(C){o("policyDeletedError",C)}}});if(!p)return e(xe,{});const A=p.length===0,b=Object.keys(z).length!==0;return r(re,{variant:"light",className:"pf-v5-u-p-0",children:[e(_,{}),(!A||b)&&r(L,{children:[y&&e(gn,{policyProviders:m,onSelect:C=>c(ln({id:n,realm:l,policyType:C.type})),toggleDialog:H}),e(xt,{count:p.length,first:D,max:T,onNextClick:V,onPreviousClick:V,onPerPageSelect:(C,B)=>{V(C),v(B)},toolbarItem:r(L,{children:[e(de,{children:e(nn,{types:m,search:z,onSearch:U,type:"policy"})}),e(de,{children:e(P,{"data-testid":"createPolicy",onClick:H,isDisabled:i,children:t("createPolicy")})})]}),children:!A&&r(Ge,{"aria-label":t("resources"),variant:"compact",children:[e(je,{children:r(ne,{children:[e(K,{"aria-hidden":"true"}),e(K,{children:t("name")}),e(K,{children:t("type")}),e(K,{children:t("dependentPermission")}),e(K,{children:t("description")}),e(K,{"aria-hidden":"true"})]})}),p.map((C,B)=>r($e,{isExpanded:C.isExpanded,children:[r(ne,{children:[e(O,{expand:{rowIndex:B,isExpanded:C.isExpanded,onToggle:(N,ee)=>{const w=p.map((G,fe)=>fe===ee?{...G,isExpanded:!G.isExpanded}:G);u(w)}}}),e(O,{"data-testid":`name-column-${C.name}`,children:e(me,{to:Yt({realm:l,id:n,policyType:C.type,policyId:C.id}),children:C.name})}),e(O,{children:Rt(C.type)}),e(O,{children:e(ds,{row:C})}),e(O,{children:C.description}),!i&&e(O,{actions:{items:[{title:t("delete"),onClick:()=>{g(C),x()}}]}})]}),r(ne,{isExpanded:C.isExpanded,children:[e(O,{}),e(O,{colSpan:3+(i?0:1),children:e(at,{children:C.isExpanded&&e(it,{isHorizontal:!0,className:"keycloak_resource_details",children:e(ze,{name:"dependentPermission",array:C.dependentPolicies,convert:N=>N.name,link:N=>ft({realm:l,id:n,permissionId:N.id,permissionType:N.type})})})})})]},`child-${C.id}`)]},C.id))]})})]}),A&&b&&e(we,{isSearchVariant:!0,isDisabled:i,message:t("noSearchResults"),instructions:t("noSearchResultsInstructions")}),A&&!b&&r(L,{children:[y&&e(gn,{policyProviders:m?.filter(C=>C.type!=="aggregate"),onSelect:C=>c(ln({id:n,realm:l,policyType:C.type})),toggleDialog:H}),e(we,{message:t("emptyPolicies"),instructions:t("emptyPoliciesInstructions"),isDisabled:i,primaryActionText:t("createPolicy"),onPrimaryAction:H})]})]})},ps=({id:n,clientId:i,uris:a})=>{const{adminClient:t}=Y(),{realm:s}=ce(),[o,l]=f(),[c,p]=f();return te(()=>Promise.all([t.clients.listScopesByResource({id:i,resourceName:n}),t.clients.listPermissionsByResource({id:i,resourceId:n})]),([u,d])=>{l(u),p(d)},[]),!c||!o?e(xe,{}):r(it,{isHorizontal:!0,className:"keycloak_resource_details",children:[e(os,{name:"uris",array:a}),e(ze,{name:"scopes",array:o,convert:u=>u.name,link:u=>Gn({id:i,realm:s,scopeId:u.id})}),e(ze,{name:"associatedPermissions",array:c,convert:u=>u.name,link:u=>ft({id:i,realm:s,permissionId:u.id,permissionType:"resource"})})]})},ms=({row:n})=>r(L,{children:[n.uris?.[0]," ",e(tn,{array:n.uris})]}),hs=({clientId:n,isDisabled:i=!1})=>{const{adminClient:a}=Y(),{t}=I(),s=tt(),{addAlert:o,addError:l}=ae(),{realm:c}=ce(),[p,u]=f(),[d,g]=f(),[m,h]=f(),[S,E]=f(0),k=()=>E(S+1),[T,v]=f(10),[D,V]=f(0),[z,U]=f({});te(()=>{const b={first:D,max:T+1,deep:!1,...z};return a.clients.listResources({...b,id:n})},b=>u(b.map(C=>({...C,isExpanded:!1}))),[S,z,D,T]);const y=async b=>a.clients.listPermissionsByResource({id:n,resourceId:b}),[H,x]=ye({titleKey:"deleteResource",children:r(L,{children:[t("deleteResourceConfirm"),m?.length&&e(nt,{variant:"warning",isInline:!0,isPlain:!0,title:t("deleteResourceWarning"),className:"pf-v5-u-pt-lg",children:e("p",{className:"pf-v5-u-pt-xs",children:m.map(b=>e("strong",{className:"pf-v5-u-pr-md",children:b.name},b.id))})})]}),continueButtonLabel:"confirm",onConfirm:async()=>{try{await a.clients.delResource({id:n,resourceId:d?._id}),o(t("resourceDeletedSuccess"),W.success),k()}catch(b){l("resourceDeletedError",b)}}});if(!p)return e(xe,{});const _=p.length===0,A=Object.keys(z).length!==0;return r(re,{variant:"light",className:"pf-v5-u-p-0",children:[e(x,{}),(!_||A)&&e(xt,{count:p.length,first:D,max:T,onNextClick:V,onPreviousClick:V,onPerPageSelect:(b,C)=>{V(b),v(C)},toolbarItem:r(L,{children:[e(de,{children:e(nn,{search:z,onSearch:U,type:"resource"})}),e(de,{children:e(P,{"data-testid":"createResource",isDisabled:i,component:b=>e(me,{...b,to:cn({realm:c,id:n})}),children:t("createResource")})})]}),children:!_&&r(Ge,{"aria-label":t("resources"),variant:"compact",children:[e(je,{children:r(ne,{children:[e(K,{"aria-hidden":"true"}),e(K,{children:t("name")}),e(K,{children:t("displayName")}),e(K,{children:t("type")}),e(K,{children:t("owner")}),e(K,{children:t("uris")}),!i&&r(L,{children:[e(K,{"aria-hidden":"true"}),e(K,{"aria-hidden":"true"})]})]})}),p.map((b,C)=>r($e,{isExpanded:b.isExpanded,children:[r(ne,{children:[e(O,{expand:{rowIndex:C,isExpanded:b.isExpanded,onToggle:(B,N)=>{const ee=p.map((w,G)=>G===N?{...w,isExpanded:!w.isExpanded}:w);u(ee)}}}),e(O,{"data-testid":`name-column-${b.name}`,children:e(me,{to:jn({realm:c,id:n,resourceId:b._id}),children:b.name})}),e(O,{children:b.displayName}),e(O,{children:b.type}),e(O,{children:b.owner?.name}),e(O,{children:e(ms,{row:b})}),!i&&r(L,{children:[e(O,{width:10,children:e(P,{variant:"link",component:B=>e(me,{...B,to:dt({realm:c,id:n,permissionType:"resource",selectedId:b._id})}),children:t("createPermission")})}),e(O,{actions:{items:[{title:t("delete"),onClick:async()=>{g(b),h(await y(b._id)),H()}}]}})]})]}),r(ne,{isExpanded:b.isExpanded,children:[e(O,{}),e(O,{colSpan:4,children:e(at,{children:b.isExpanded&&e(ps,{clientId:n,id:b._id,uris:b.uris})})})]},`child-${b._id}`)]},b._id))]})}),_&&A&&e(we,{isSearchVariant:!0,message:t("noSearchResults"),instructions:t("noSearchResultsInstructions")}),_&&!A&&e(we,{message:t("emptyResources"),instructions:t("emptyResourcesInstructions"),isDisabled:i,primaryActionText:t("createResource"),onPrimaryAction:()=>s(cn({realm:c,id:n}))})]})},fs=({clientId:n,isDisabled:i=!1})=>{const{adminClient:a}=Y(),{t}=I(),s=tt(),{realm:o}=ce(),[l,c]=ve(),[p,u]=f(),[d,g]=f(),[m,h]=f([]),[S,E]=f(0),k=()=>E(S+1),[T,v]=f(10),[D,V]=f(0),[z,U]=f("");te(()=>{const A={first:D,max:T+1,deep:!1,name:z};return a.clients.listAllScopes({...A,id:n})},A=>{u(A.map(b=>({...b,isLoaded:!1}))),h(A.map(b=>({id:b.id,isExpanded:!1})))},[S,z,D,T]);const y=A=>p?.find(b=>b.id===A),H=A=>m.find(b=>b.id===A)?.isExpanded||!1;if(te(()=>{const A=m.filter(b=>b.isExpanded).map(({id:b})=>y(b)).filter(b=>!b.isLoaded);return Promise.all(A.map(async b=>{const[C,B]=await Promise.all([a.clients.listAllResourcesByScope({id:n,scopeId:b.id}),a.clients.listAllPermissionsByScope({id:n,scopeId:b.id})]);return{...b,resources:C,permissions:B,isLoaded:!0}}))},A=>{let b=[...p||[]];A.forEach(C=>{const B=p?.findIndex(N=>C.id===N.id);b=[...b.slice(0,B),C,...b.slice(B+1)]}),u(b)},[m]),!p)return e(xe,{});const x=p.length===0,_=z!=="";return r(re,{variant:"light",className:"pf-v5-u-p-0",children:[e(yi,{clientId:n,open:l,toggleDialog:c,selectedScope:d,refresh:k}),(!x||_)&&e(xt,{count:p.length,first:D,max:T,onNextClick:V,onPreviousClick:V,onPerPageSelect:(A,b)=>{V(A),v(b)},inputGroupName:"search",inputGroupPlaceholder:t("searchByName"),inputGroupOnEnter:U,toolbarItem:e(de,{children:e(P,{"data-testid":"createAuthorizationScope",component:A=>e(me,{...A,to:dn({realm:o,id:n})}),children:t("createAuthorizationScope")})}),children:!x&&r(Ge,{"aria-label":t("scopes"),variant:"compact",children:[e(je,{children:r(ne,{children:[e(K,{"aria-hidden":"true"}),e(K,{children:t("name")}),e(K,{children:t("displayName")}),e(K,{"aria-hidden":"true"}),e(K,{"aria-hidden":"true"})]})}),p.map((A,b)=>r($e,{isExpanded:H(A.id),children:[r(ne,{children:[e(O,{expand:{rowIndex:b,isExpanded:H(A.id),onToggle:(C,B,N)=>{h([...m.slice(0,B),{id:A.id,isExpanded:N},...m.slice(B+1)])}}}),e(O,{"data-testid":`name-column-${A.name}`,children:e(me,{to:Gn({realm:o,id:n,scopeId:A.id}),children:A.name})}),e(O,{children:A.displayName}),e(O,{width:10,children:e(P,{variant:"link",component:C=>e(me,{...C,to:dt({realm:o,id:n,permissionType:"scope",selectedId:A.id})}),children:t("createPermission")})}),e(O,{isActionCell:!0,actions:{items:[{title:t("delete"),onClick:()=>{g(A),c()}}]}})]}),r(ne,{isExpanded:H(A.id),children:[e(O,{}),e(O,{colSpan:4,children:e(at,{children:H(A.id)&&A.isLoaded?r(it,{isHorizontal:!0,className:"keycloak_resource_details",children:[e(ze,{name:"resources",array:A.resources,convert:C=>C.name,link:C=>jn({id:n,realm:o,resourceId:C._id})}),e(ze,{name:"associatedPermissions",array:A.permissions,convert:C=>C.name,link:C=>ft({id:n,realm:o,permissionId:C.id,permissionType:C.type})})]}):e(xe,{})})})]},`child-${A.id}`)]},A.id))]})}),x&&!_&&e(we,{message:t("emptyAuthorizationScopes"),instructions:t("emptyAuthorizationInstructions"),isDisabled:i,onPrimaryAction:()=>s(dn({id:n,realm:o})),primaryActionText:t("createAuthorizationScope")}),x&&_&&e(we,{isSearchVariant:!0,isDisabled:i,message:t("noSearchResults"),instructions:t("noSearchResultsInstructions")})]})},gs=({onConfirm:n,closeDialog:i})=>{const{t:a}=I(),[t,s]=f({});return r(qe,{title:a("import"),isOpen:!0,variant:"small",onClose:i,actions:[e(P,{id:"modal-confirm",onClick:()=>{n(t),i()},"data-testid":"confirm",children:a("confirm")},"confirm"),e(P,{"data-testid":"cancel",id:"modal-cancel",variant:pe.link,onClick:()=>{i()},children:a("cancel")},"cancel")],children:[e(he,{children:e(vi,{id:"import-resource",onChange:s})}),Object.keys(t).length!==0&&r(L,{children:[e(Ke,{}),e("p",{className:"pf-v5-u-my-lg",children:a("importResources")}),r(he,{isHorizontal:!0,children:[e(F,{label:a("policyEnforcementMode"),labelIcon:e(M,{helpText:a("policyEnforcementModeHelp"),fieldLabelId:"policyEnforcementMode"}),fieldId:"policyEnforcementMode",hasNoPaddingTop:!0,children:e(ut,{id:"policyEnforcementMode",name:"policyEnforcementMode",label:a(`policyEnforcementModes.${t.policyEnforcementMode}`),isChecked:!0,isDisabled:!0,className:"pf-v5-u-mb-md"})}),e(F,{label:a("decisionStrategy"),labelIcon:e(M,{helpText:a("decisionStrategyHelp"),fieldLabelId:"decisionStrategy"}),fieldId:"decisionStrategy",hasNoPaddingTop:!0,children:e(ut,{id:"decisionStrategy",name:"decisionStrategy",isChecked:!0,isDisabled:!0,label:a(`decisionStrategies.${t.decisionStrategy}`),className:"pf-v5-u-mb-md"})}),e(F,{hasNoPaddingTop:!0,label:a("allowRemoteResourceManagement"),fieldId:"allowRemoteResourceManagement",labelIcon:e(M,{helpText:a("allowRemoteResourceManagement"),fieldLabelId:"allowRemoteResourceManagement"}),children:e(ke,{id:"allowRemoteResourceManagement",label:a("on"),labelOff:a("off"),isChecked:t.allowRemoteResourceManagement,isDisabled:!0,"aria-label":a("allowRemoteResourceManagement")})})]}),e("div",{className:"pf-v5-u-mt-md",children:Object.entries(t).filter(([,o])=>Array.isArray(o)).map(([o,l])=>r(On,{children:[e(Ke,{}),e("p",{className:"pf-v5-u-my-sm",children:r("strong",{children:[l.length," ",a(o)]})})]},o))}),e(Ke,{}),e(nt,{variant:"warning",className:"pf-v5-u-mt-lg",isInline:!0,title:a("importWarning")})]})]})},wn=["ENFORCING","PERMISSIVE","DISABLED"],bs=({clientId:n})=>{const{adminClient:i}=Y(),{t:a}=I(),[t,s]=f(),[o,l]=ve(),c=Pe({}),{control:p,reset:u,handleSubmit:d}=c,{addAlert:g,addError:m}=ae(),{hasAccess:h}=Ee(),S=!h("manage-authorization");te(()=>i.clients.getResourceServer({id:n}),T=>{s(T),u(T)},[]);const E=async T=>{try{await i.clients.importResource({id:n},T),g(a("importResourceSuccess"),W.success),u({...T})}catch(v){m("importResourceError",v)}},k=async T=>{try{await i.clients.updateResourceServer({id:n},T),g(a("updateResourceSuccess"),W.success)}catch(v){m("resourceSaveError",v)}};return t?r(re,{variant:"light",children:[o&&e(gs,{onConfirm:E,closeDialog:l}),r(se,{role:"manage-authorization",isHorizontal:!0,onSubmit:d(k),children:[e(F,{label:a("import"),fieldId:"import",labelIcon:e(M,{helpText:a("importHelp"),fieldLabelId:"import"}),children:e(P,{variant:"secondary",onClick:l,children:a("import")})}),e(Ke,{}),e(F,{label:a("policyEnforcementMode"),labelIcon:e(M,{helpText:a("policyEnforcementModeHelp"),fieldLabelId:"policyEnforcementMode"}),fieldId:"policyEnforcementMode",hasNoPaddingTop:!0,children:e(ie,{name:"policyEnforcementMode","data-testid":"policyEnforcementMode",defaultValue:wn[0],control:p,render:({field:T})=>e(L,{children:wn.map(v=>e(ut,{id:v,"data-testid":v,isChecked:T.value===v,isDisabled:S,name:"policyEnforcementMode",onChange:()=>T.onChange(v),label:a(`policyEnforcementModes.${v}`),className:"pf-v5-u-mb-md"},v))})})}),r(Re,{...c,children:[e(ci,{isLimited:!0}),e(Te,{name:"allowRemoteResourceManagement",label:a("allowRemoteResourceManagement"),labelIcon:a("allowRemoteResourceManagementHelp")})]}),e(Et,{name:"authenticationSettings",reset:()=>u(t),isActive:!0,isSubmit:!0})]})]}):e(xe,{})};function ys(n){const[i,a]=f(null),[t,s]=f(null);function o(l){s({name:l.name,state:l.state})}return Ne(()=>{a(null),s(null),navigator.permissions.query({name:n}).then(l=>{a(l),o(l)})},[n]),Ne(()=>{if(!i)return;function l(){i&&o(i)}return i.addEventListener("change",l),()=>i.removeEventListener("change",l)},[i]),t}const da=({id:n,label:i,text:a,variant:t="plain"})=>{const{t:s}=I(),o=Oa(),c=ys("clipboard-write")?.state==="denied",[p,u]=f(0),d=pt(()=>{if(c)return"clipboardCopyDenied";switch(p){case 0:return"copyToClipboard";case 1:return"copySuccess";case 2:return"clipboardCopyError"}},[c,p]);Ne(()=>{if(p!==0)return o(()=>u(0),1e3)},[p,o]);const g=async m=>{try{await navigator.clipboard.writeText(m),u(1)}catch{u(2)}};return e(ti,{id:`copy-button-${n}`,textId:i,"aria-label":s("copyToClipboard"),onClick:()=>g(a),exitDelay:600,variant:t,children:s(d)})},Pn=({id:n,buttonLabel:i,client:a,secret:t,toggle:s})=>{const{t:o}=I(),l=oe(),{hasAccess:c}=Ee(),p=c("manage-clients")||a.access?.configure;return r(et,{hasGutter:!0,children:[e(be,{isFilled:!0,children:r(Bn,{children:[e(Ct,{children:e(La,{id:n,value:t,readOnly:!0})}),e(Ct,{children:e(da,{id:n,text:t,label:"clientSecret",variant:"control"})})]})}),e(be,{children:e(P,{variant:"secondary",isDisabled:l.formState.isDirty||!p,onClick:s,children:o(i)})})]})},_n=({time:n})=>{const{t:i}=I(),a=Qn();return e("div",{className:"pf-v5-u-my-md",children:(s=>s?i("secretExpiresOn",{time:a(new Date(s*1e3),{dateStyle:"full",timeStyle:"long"})}):void 0)(n)})},vs=({client:n,secret:i,toggle:a})=>{const{adminClient:t}=Y(),{t:s}=I(),{addAlert:o,addError:l}=ae(),[c,p]=f(n.attributes?.["client.secret.rotated"]),u=n.attributes?.["client.secret.expiration.time"],d=n.attributes?.["client.secret.rotated.expiration.time"],g=S=>new Date().getTime()>=S*1e3,[m,h]=ye({titleKey:"invalidateRotatedSecret",messageKey:"invalidateRotatedSecretExplain",continueButtonLabel:"confirm",onConfirm:async()=>{try{await t.clients.invalidateSecret({id:n.id}),p(void 0),o(s("invalidateRotatedSuccess"))}catch(S){l("invalidateRotatedError",S)}}});return Ne(()=>{c!==n.attributes?.["client.secret.rotated"]&&p(n.attributes?.["client.secret.rotated"])},[n,c]),r(L,{children:[e(h,{}),r(F,{label:s("clientSecret"),fieldId:"kc-client-secret",className:"pf-v5-u-my-md",children:[e(Pn,{id:"kc-client-secret",client:n,secret:i,toggle:a,buttonLabel:"regenerate"}),e(_n,{time:u}),g(u)&&e(nt,{variant:"warning",isInline:!0,title:s("secretHasExpired")})]}),c&&r(F,{label:s("secretRotated"),fieldId:"secretRotated",children:[e(Pn,{id:"secretRotated",client:n,secret:c,toggle:m,buttonLabel:"invalidateSecret"}),e(_n,{time:d})]})]})},Ss=({clientAuthenticatorType:n})=>{const{cryptoInfo:i}=Be(),a=n==="client-jwt"?i?.clientSignatureAsymmetricAlgorithms??[]:i?.clientSignatureSymmetricAlgorithms??[],{t}=I();return e(q,{name:R("attributes.token.endpoint.auth.signing.alg"),label:t("signatureAlgorithm"),labelIcon:t("signatureAlgorithmHelp"),controller:{defaultValue:""},isScrollable:!0,maxMenuHeight:"200px",options:[{key:"",value:t("anyAlgorithm")},...a.map(s=>({key:s,value:s}))]})},Cs=()=>{const{t:n}=I();return r(L,{children:[e(Te,{name:R("attributes.x509.allow.regex.pattern.comparison"),label:n("allowRegexComparison"),labelIcon:n("allowRegexComparisonHelp")}),e($,{name:R("attributes.x509.subjectdn"),label:n("subject"),labelIcon:n("subjectHelp"),rules:{required:n("required")}})]})},ks=({client:n,save:i,refresh:a})=>{const{adminClient:t}=Y(),{t:s}=I(),{addAlert:o,addError:l}=ae(),c=n.id,[p,u]=f([]),{control:d,formState:{isDirty:g},handleSubmit:m}=oe(),h=Xe({control:d,name:"clientAuthenticatorType",defaultValue:""}),[S,E]=f(""),[k,T]=f(""),v=p.find(_=>_.id===h);te(()=>Promise.all([t.authenticationManagement.getClientAuthenticatorProviders(),t.clients.getClientSecret({id:c})]),([_,A])=>{u(_),E(A.value)},[]);async function D(_,A){try{const b=await _(c);return o(s(`${A}Success`),W.success),b}catch(b){l(`${A}Error`,b)}}const V=async()=>{const _=await D(A=>t.clients.generateNewClientSecret({id:A}),"clientSecret");E(_?.value||""),a()},[z,U]=ye({titleKey:"confirmClientSecretTitle",messageKey:"confirmClientSecretBody",continueButtonLabel:"yes",cancelButtonLabel:"no",onConfirm:V}),y=async()=>{const _=await D(A=>t.clients.generateRegistrationAccessToken({id:A}),"accessToken");T(_?.registrationAccessToken||"")},[H,x]=ye({titleKey:"confirmAccessTokenTitle",messageKey:"confirmAccessTokenBody",continueButtonLabel:"yes",cancelButtonLabel:"no",onConfirm:y});return e(re,{children:r(se,{onSubmit:m(i),isHorizontal:!0,className:"pf-v5-u-mt-md",role:"manage-clients",fineGrainedAccess:n.access?.configure,children:[e(U,{}),e(x,{}),r(kt,{isFlat:!0,children:[r(Ye,{children:[e(q,{name:"clientAuthenticatorType",label:s("clientAuthenticator"),labelIcon:s("clientAuthenticatorTypeHelp"),controller:{defaultValue:""},options:p.map(({id:_,displayName:A})=>({key:_,value:A||_}))}),(h==="client-jwt"||h==="client-secret-jwt")&&e(Ss,{clientAuthenticatorType:h}),h==="client-jwt"&&e(F,{children:e(nt,{variant:"info",isInline:!0,title:s("signedJWTConfirm")})}),h==="client-x509"&&e(Cs,{}),e(Ie,{children:e(P,{variant:"primary",type:"submit",isDisabled:!g,children:s("save")})})]}),v?.supportsSecret&&r(L,{children:[e(Ke,{}),e(Ye,{children:e(vs,{client:n,secret:S,toggle:z})})]})]}),e(kt,{isFlat:!0,children:e(Ye,{children:e(F,{label:s("registrationAccessToken"),fieldId:"kc-access-token",labelIcon:e(M,{helpText:s("registrationAccessTokenHelp"),fieldLabelId:"registrationAccessToken"}),children:r(et,{hasGutter:!0,children:[e(be,{isFilled:!0,children:e(Wn,{id:"kc-access-token",isReadOnly:!0,children:k})}),e(be,{children:e(P,{variant:"secondary",onClick:H,children:s("regenerate")})})]})})})})]})})},Dn=({id:n,keyInfo:i})=>{const{t:a}=I();return e(It,{readOnly:!0,rows:5,id:n,"data-testid":"certificate",value:i?.certificate,"aria-label":a("certificate")})},an=({keyInfo:n,plain:i=!1})=>{const{t:a}=I(),t=ga();return i?e(Dn,{id:t,keyInfo:n}):e(F,{label:a("certificate"),fieldId:t,labelIcon:e(M,{helpText:a("certificateHelp"),fieldLabelId:t}),children:e(Dn,{id:t,keyInfo:n})})},ua=({hidePassword:n=!1,isSaml:i=!1})=>{const{t:a}=I();return r(L,{children:[e($,{name:"keyAlias",label:a("keyAlias"),labelIcon:a("keyAliasHelp"),rules:{required:a("required")}}),!n&&e(un,{name:"keyPassword",label:a("keyPassword"),labelIcon:a("keyPasswordHelp"),rules:{required:a("required")}}),i&&e($,{name:"realmAlias",label:a("realmCertificateAlias"),labelIcon:a("realmCertificateAliasHelp")}),e(un,{name:"storePassword",label:a("storePassword"),labelIcon:a("storePasswordHelp"),rules:{required:a("required")}})]})},Nn="Certificate PEM",Ts=new Map([["PKCS12","p12"],["JKS","jks"],["BCFKS","bcfks"]]),pa=n=>Ts.get(n),Pt=({isSaml:n=!1,hasPem:i=!1,useFile:a=!1})=>{const{t}=I(),[s,o]=f(),{control:l,watch:c}=oe(),p=c("format"),{cryptoInfo:u}=Be(),d=[...u?.supportedKeystoreTypes??[],...i?[Nn]:[]];return r(he,{className:"pf-v5-u-pt-lg",children:[e(q,{name:"format",label:t("archiveFormat"),labelIcon:t("archiveFormatHelp"),controller:{defaultValue:d[0]},menuAppendTo:"parent",options:d}),a&&e(F,{label:t("importFile"),labelIcon:e(M,{helpText:t("importFileHelp"),fieldLabelId:"importFile"}),fieldId:"importFile",children:e(ie,{name:"file",defaultValue:"",control:l,render:({field:g})=>e(ia,{id:"importFile",value:g.value,filename:s,browseButtonText:t("browse"),onChange:(m,h)=>{o(h),g.onChange(m)}})})}),p!==Nn&&e(ua,{hidePassword:a,isSaml:n})]})},As=({clientId:n,save:i,toggleDialog:a})=>{const{t}=I(),s=Pe({defaultValues:{keyAlias:n},mode:"onChange"}),{handleSubmit:o,formState:{isValid:l}}=s;return r(qe,{variant:ht.medium,title:t("generateKeys"),isOpen:!0,onClose:a,actions:[e(P,{id:"modal-confirm","data-testid":"confirm",isDisabled:!l,onClick:()=>{o(c=>{i(c),a()})()},children:t("generate")},"confirm"),e(P,{id:"modal-cancel","data-testid":"cancel",variant:pe.link,onClick:()=>{a()},children:t("cancel")},"cancel")],children:[e(Me,{children:e(ue,{children:t("generateKeysDescription")})}),e(Re,{...s,children:e(Pt,{})})]})},Is=({save:n,toggleDialog:i})=>{const{t:a}=I(),t=Pe(),{control:s,handleSubmit:o}=t,l=Be().cryptoInfo?.supportedKeystoreTypes??[],c=l.concat(["Certificate PEM","Public Key PEM","JSON Web Key Set"]),p=Xe({control:s,name:"keystoreFormat",defaultValue:c[0]});return r(qe,{variant:ht.medium,title:a("generateKeys"),isOpen:!0,onClose:i,actions:[e(P,{id:"modal-confirm","data-testid":"confirm",onClick:()=>{o(u=>{n(u),i()})()},children:a("import")},"confirm"),e(P,{id:"modal-cancel","data-testid":"cancel",variant:pe.link,onClick:()=>{i()},children:a("cancel")},"cancel")],children:[e(Me,{children:e(ue,{children:a("generateKeysDescription")})}),e(he,{className:"pf-v5-u-pt-lg",children:r(Re,{...t,children:[e(q,{name:"keystoreFormat",label:a("archiveFormat"),labelIcon:a("archiveFormatHelp"),controller:{defaultValue:c[0]},options:c}),l.includes(p)&&e(ua,{hidePassword:!0}),e(F,{label:a("importFile"),fieldId:"importFile",children:e(ie,{name:"file",control:s,defaultValue:{filename:""},render:({field:u})=>e(ia,{id:"importFile",value:u.value.value,filename:u.value.filename,onChange:(d,g)=>u.onChange({value:d,filename:g})})})})]})})]})},zt="jwt.credential",Rs=({clientId:n,save:i,hasConfigureAccess:a})=>{const{adminClient:t}=Y(),{t:s}=I(),{control:o,getValues:l,formState:{isDirty:c}}=oe(),{addAlert:p,addError:u}=ae(),[d,g]=f(),[m,h,S]=ve(),[E,k,T]=ve(),[v,D]=f(0),V=()=>D(v+1),z=Xe({control:o,name:R("attributes.use.jwks.url"),defaultValue:"false"});te(()=>t.clients.getKeyInfo({id:n,attr:zt}),H=>g(H),[v]);const U=async H=>{try{const x=await t.clients.generateAndDownloadKey({id:n,attr:zt},H);Ze.saveAs(new Blob([x],{type:"application/octet-stream"}),`keystore.${pa(H.format??"")}`),p(s("generateSuccess"),W.success),V()}catch(x){u("generateError",x)}},y=async H=>{try{const x=new FormData,{file:_,...A}=H;for(const[b,C]of Object.entries(A))x.append(b,C);x.append("file",_.value),await t.clients.uploadCertificate({id:n,attr:zt},x),p(s("importSuccess"),W.success),V()}catch(x){u("importError",x)}};return r(re,{variant:"light",className:"keycloak__form",children:[m&&e(As,{clientId:l("clientId"),toggleDialog:h,save:U}),E&&e(Is,{toggleDialog:k,save:y}),r(kt,{isFlat:!0,children:[e(Ha,{children:e(Ka,{children:s("jwksUrlConfig")})}),e(Ye,{children:e(Me,{children:e(ue,{children:s("keysIntro")})})}),e(Ye,{children:r(se,{role:"manage-clients",fineGrainedAccess:a,isHorizontal:!0,children:[e(Te,{name:R("attributes.use.jwks.url"),label:s("useJwksUrl"),labelIcon:s("useJwksUrlHelp"),stringify:!0}),z!=="true"&&(d?e(an,{plain:!0,keyInfo:d}):"No client certificate configured"),z==="true"&&e($,{name:R("attributes.jwks.url"),label:s("jwksUrl"),labelIcon:s("jwksUrlHelp"),type:"url"}),r(Ie,{children:[e(P,{"data-testid":"saveKeys",onClick:i,isDisabled:!c,children:s("save")}),e(P,{"data-testid":"generate",variant:"secondary",onClick:()=>S(!0),children:s("generateNewKeys")}),e(P,{"data-testid":"import",variant:"secondary",onClick:()=>T(!0),isDisabled:z==="true",children:s("import")})]})]})})]})]})},Es=({clientId:n,close:i,keyType:a})=>{const{adminClient:t}=Y(),{t:s}=I(),{realm:o}=ce(),{addAlert:l,addError:c}=ae(),p=Pe({defaultValues:{realmAlias:o}}),u=async d=>{try{const g=await t.clients.downloadKey({id:n,attr:a},d);Ze.saveAs(new Blob([g],{type:"application/octet-stream"}),`keystore.${pa(d.format??"")}`),l(s("samlKeysExportSuccess")),i()}catch(g){c("samlKeysExportError",g)}};return e(qe,{variant:"medium",title:s("exportSamlKeyTitle"),isOpen:!0,onClose:i,actions:[e(P,{id:"modal-confirm","data-testid":"confirm",type:"submit",form:"export-saml-key-form",children:s("export")},"confirm"),e(P,{id:"modal-cancel","data-testid":"cancel",variant:"link",onClick:()=>{i()},children:s("cancel")},"cancel")],children:e(he,{id:"export-saml-key-form",className:"pf-v5-u-pt-lg",onSubmit:p.handleSubmit(u),children:e(Re,{...p,children:e(Pt,{isSaml:!0})})})})},ma=async(n,i,a,t,s)=>{try{const o=new FormData,{file:l,...c}=i;Object.entries(c).map(([p,u])=>o.append(p==="format"?"keystoreFormat":p,u.toString())),o.append("file",l),await n.clients.uploadKey({id:a,attr:t},o),s()}catch(o){s(o)}},xs=({id:n,attr:i,onClose:a,onCancel:t})=>{const{adminClient:s}=Y(),{t:o}=I(),[l,c]=f(!1),[p,u]=f(),d=Pe({mode:"onChange"}),{handleSubmit:g,formState:{isValid:m}}=d,{addAlert:h,addError:S}=ae(),E=T=>{ma(s,T,n,i,v=>{v?S("importError",v):h(o("importSuccess"),W.success)})},k=async()=>{try{const T=await s.clients.generateKey({id:n,attr:i});u(T),Ze.saveAs(new Blob([T.privateKey],{type:"application/octet-stream"}),"private.key"),h(o("generateSuccess"),W.success)}catch(T){S("generateError",T)}};return e(qe,{variant:ht.medium,"aria-label":o("enableClientSignatureRequiredModal"),header:r(Me,{children:[e(qt,{headingLevel:"h1",children:o("enableClientSignatureRequired")}),e(ue,{children:o("enableClientSignatureRequiredExplain")})]}),isOpen:!0,onClose:a,actions:[e(P,{id:"modal-confirm","data-testid":"confirm",variant:"primary",isDisabled:!m&&!p,onClick:()=>{l&&g(E)(),a()},children:o("confirm")},"confirm"),e(P,{id:"modal-cancel","data-testid":"cancel",variant:pe.link,onClick:t,children:o("cancel")},"cancel")],children:r(Re,{...d,children:[r(he,{isHorizontal:!0,children:[e(F,{label:o("selectMethod"),fieldId:"selectMethod",hasNoPaddingTop:!0,children:r(Si,{children:[e(yn,{children:e(ut,{isChecked:!l,name:"selectMethodType",onChange:()=>c(!1),label:o("selectMethodType.generate"),id:"selectMethodType-generate"})}),e(yn,{children:e(ut,{isChecked:l,name:"selectMethodType",onChange:()=>c(!0),label:o("selectMethodType.import"),id:"selectMethodType-import"})})]})}),!l&&e(F,{label:o("certificate"),fieldId:"certificate",labelIcon:e(M,{helpText:o("certificateHelp"),fieldLabelId:"certificate"}),children:r(et,{hasGutter:!0,children:[e(be,{isFilled:!0,children:e(an,{plain:!0,keyInfo:p})}),e(be,{children:e(P,{variant:"secondary","data-testid":"generate",onClick:k,children:o("generate")})})]})})]}),l&&e(Pt,{useFile:!0})]})})},ws=({id:n,attr:i,onClose:a})=>{const{adminClient:t}=Y(),{t:s}=I(),o=oe(),{handleSubmit:l}=o,{addAlert:c,addError:p}=ae(),u=d=>{ma(t,d,n,i,g=>{g?p("importError",g):c(s("importSuccess"),W.success)})};return e(Xt,{open:!0,toggleDialog:a,continueButtonLabel:"import",titleKey:"importKey",onConfirm:()=>{l(u)(),a()},children:e(Re,{...o,children:e(Pt,{useFile:!0,hasPem:!0})})})},Bt=["saml.signing","saml.encryption"],Qe={"saml.signing":{name:R("attributes.saml.client.signature"),title:"signingKeysConfig",key:"clientSignature"},"saml.encryption":{name:R("attributes.saml.encrypt"),title:"encryptionKeysConfig",key:"encryptAssertions"}},Ps=({clientId:n,keyInfo:i,attr:a,onChanged:t,onGenerate:s,onImport:o})=>{const{t:l}=I(),{control:c,watch:p}=oe(),u=Qe[a].title,d=Qe[a].key,g=Qe[a].name,[m,h]=ve(),S=p(g);return r(L,{children:[m&&e(Es,{keyType:a,clientId:n,close:h}),r(Ma,{title:l(u),className:"kc-form-panel__panel",children:[e(Me,{className:"pf-v5-u-pb-lg",children:e(ue,{children:l(`${u}Explain`)})}),e(se,{role:"manage-clients",isHorizontal:!0,children:e(F,{labelIcon:e(M,{helpText:l(`${d}Help`),fieldLabelId:d}),label:l(d),fieldId:d,hasNoPaddingTop:!0,children:e(ie,{name:g,control:c,defaultValue:"false",render:({field:E})=>e(ke,{"data-testid":d,id:d,label:l("on"),labelOff:l("off"),isChecked:E.value==="true",onChange:(k,T)=>{const v=T.toString();v==="true"?(t(a),E.onChange(v)):s(a,!1)},"aria-label":l(d)})})})})]}),i?.certificate&&S==="true"&&e(kt,{isFlat:!0,children:e(Ye,{className:"kc-form-panel__body",children:r(he,{isHorizontal:!0,children:[e(an,{keyInfo:i}),r(Ie,{children:[e(P,{variant:"secondary",onClick:()=>s(a,!0),children:l("regenerate")}),e(P,{variant:"secondary",onClick:()=>o(a),children:l("importKey")}),e(P,{variant:"tertiary",onClick:h,children:l("export")})]})]})})})]})},_s=({clientId:n,save:i})=>{const{adminClient:a}=Y(),{t}=I(),[s,o]=f(),[l,c]=f(),[p,u]=f(),[d,g]=f(),[m,h]=f(0),{setValue:S}=oe(),{addAlert:E,addError:k}=ae();te(()=>Promise.all(Bt.map(y=>a.clients.getKeyInfo({id:n,attr:y}))),y=>c(y),[m]);const T=async y=>{const H=Bt.indexOf(y);try{const x=[...l||[]];x[H]=await a.clients.generateKey({id:n,attr:y}),c(x),Ze.saveAs(new Blob([x[H].privateKey],{type:"application/octet-stream"}),"private.key"),E(t("generateSuccess"),W.success)}catch(x){k("generateError",x)}},v=p?Qe[p].key:"",[D,V]=ye({titleKey:t("disableSigning",{key:t(v)}),messageKey:t("disableSigningExplain",{key:t(v)}),continueButtonLabel:"yes",cancelButtonLabel:"no",onConfirm:()=>{S(Qe[p].name,"false"),i()}}),[z,U]=ye({titleKey:"reGenerateSigning",messageKey:"reGenerateSigningExplain",continueButtonLabel:"yes",cancelButtonLabel:"no",onConfirm:()=>{T(p)}});return r(re,{variant:"light",className:"keycloak__form",children:[s&&e(xs,{id:n,attr:s,onClose:()=>{o(void 0),i(),h(m+1)},onCancel:()=>{S(Qe[p].name,"false"),o(void 0)}}),e(V,{}),e(U,{}),Bt.map((y,H)=>r(On,{children:[d===y&&e(ws,{id:n,attr:y,onClose:()=>g(void 0)}),e(Ps,{clientId:n,keyInfo:l?.[H],attr:y,onChanged:o,onGenerate:(x,_)=>{u(x),_?z():D()},onImport:()=>g(y)})]},y))]})},vt="dedicated",Ds=({clientId:n,refresh:i,fineGrainedAccess:a,...t})=>{const{adminClient:s}=Y(),{t:o}=I(),{addAlert:l,addError:c}=ae(),{hasAccess:p}=Ee(),u=g=>g.id===vt,d=p("manage-clients")||a;return e(Ei,{isDisabled:u(t)||!d,clientScope:t,type:t.type,onSelect:async g=>{try{await xi(s,n,t,t.type,g),l(o("clientScopeSuccess"),W.success),i()}catch(m){c("clientScopeError",m)}}})},Ns=({clientId:n,protocol:i,clientName:a,fineGrainedAccess:t})=>{const{adminClient:s}=Y(),{t:o}=I(),{addAlert:l,addError:c}=ae(),{realm:p}=ce(),u=Fa(),[d,g]=f("name"),[m,h]=f(vn.none),[S,E]=f(!1),[k,T]=f(),[v,D]=f([]),V=w=>D(w.filter(({id:G})=>G!==vt)),[z,U]=f(!1),[y,H]=f(0),x=()=>H(y+1),_=w=>w.id===vt,{hasAccess:A}=Ee(),b=A("manage-clients")||t,C=A("view-clients")||t,B=async(w,G,fe)=>{const _e=await s.clients.listDefaultClientScopes({id:n}),j=await s.clients.listOptionalClientScopes({id:n}),Q=await s.clientScopes.find(),ge=le=>Q.find(Ve=>le===Ve.id),Se=j.map(le=>{const Ve=ge(le.id);return{...le,type:Cn.optional,description:Ve?.description}}),_t=_e.map(le=>{const Ve=ge(le.id);return{...le,type:Cn.default,description:Ve?.description}});let Fe=[...Se,..._t];const Dt=Fe.map(le=>le.name);T(Q.filter(le=>!Dt.includes(le.name)).filter(le=>le.protocol===i)),Fe=u(Fe,Ba("name")),C&&Fe.unshift({id:vt,name:o("dedicatedScopeName",{clientName:a}),type:vn.none,description:o("dedicatedScopeDescription")});const Nt=d==="name"?Ai(fe):Ii(m),gt=Number(w);return Fe.filter(Nt).slice(gt,gt+Number(G))},[N,ee]=ye({titleKey:o("deleteClientScope",{count:v.length,name:v[0]?.name}),messageKey:"deleteConfirmClientScopes",continueButtonLabel:"delete",continueButtonVariant:pe.danger,onConfirm:async()=>{try{await Sn(s,n,v[0],v[0].type),l(o("clientScopeRemoveSuccess"),W.success),x()}catch(w){c("clientScopeRemoveError",w)}}});return r(L,{children:[k&&e(di,{clientScopes:k,clientName:a,open:S,toggleDialog:()=>E(!S),onAdd:async w=>{try{await Promise.all(w.map(async G=>await Ri(s,n,G.scope,G.type))),l(o("clientScopeSuccess"),W.success),x()}catch(G){c("clientScopeError",G)}}}),e(wt,{loader:B,ariaLabelKey:`clientScopeList-${y}`,searchPlaceholderKey:d==="name"?"searchByName":void 0,canSelectAll:!0,isPaginated:!0,isSearching:d==="type",onSelect:w=>V([...w]),searchTypeComponent:e(Ci,{searchType:d,onSelect:w=>g(w)}),toolbarItem:r(L,{children:[e(ki,{searchType:d,type:m,onSelect:w=>g(w),onType:w=>{h(w),x()}}),b&&r(L,{children:[e(ee,{}),e(de,{children:e(P,{onClick:()=>E(!0),children:o("addClientScope")})}),e(de,{children:e(Ti,{clientId:n,selectedRows:v,refresh:x})}),e(de,{children:e(Qt,{onOpenChange:w=>U(w),toggle:w=>e(Ue,{"data-testid":"kebab","aria-label":"Kebab toggle",ref:w,variant:"plain",onClick:()=>U(!z),isExpanded:z,children:e(Va,{})}),isOpen:z,children:e(qn,{children:e(Je,{isDisabled:v.length===0,onClick:async()=>{try{await Promise.all(v.map(w=>Sn(s,n,{...w},w.type))),U(!1),V([]),l(o("clientScopeRemoveSuccess")),x()}catch(w){c("clientScopeRemoveError",w)}},children:o("remove")},"deleteAll")})})})]})]}),columns:[{name:"name",displayKey:"assignedClientScope",cellRenderer:w=>_(w)?e(me,{to:za({realm:p,clientId:n}),children:w.name}):w.name},{name:"type",displayKey:"assignedType",cellRenderer:w=>e(Ds,{clientId:n,refresh:x,...w})},{name:"description"}],actions:b?[{title:o("remove"),onRowClick:async w=>(V([w]),N(),!0)}]:[],emptyState:e(we,{message:o("emptyClientScopes"),instructions:o("emptyClientScopesInstructions"),primaryActionText:o("emptyClientScopesPrimaryAction"),onPrimaryAction:()=>E(!0)})},y)]})},Ut=({text:n,user:i,label:a})=>{const{t}=I();return i?e(sa,{id:a,actions:e(oa,{children:e(da,{id:"code",text:n,label:a})}),children:e(It,{id:`text-area-${a}`,rows:20,value:n,"aria-label":a})}):r(ta,{variant:"lg",id:a,children:[e(aa,{titleText:e(L,{children:t(`${a}No`)}),headingLevel:"h2"}),e(na,{children:t(`${a}IsDisabled`)})]})},Os=({protocolMappers:n})=>{const[i,a]=f(0);return Ne(()=>{a(i+1)},[n]),e(wt,{loader:()=>Promise.resolve(n),ariaLabelKey:"effectiveProtocolMappers",searchPlaceholderKey:"searchForProtocol","data-testid":"effective-protocol-mappers",columns:[{name:"mapperName",displayKey:"name"},{name:"containerName",displayKey:"parentClientScope"},{name:"type.category",displayKey:"category"},{name:"type.priority",displayKey:"priority"}]},i)},Ls=({effectiveRoles:n})=>{const[i,a]=f(0);return Ne(()=>{a(i+1)},[n]),e(wt,{loader:()=>Promise.resolve(n),ariaLabelKey:"effectiveRoleScopeMappings",searchPlaceholderKey:"searchForRole","data-testid":"effective-role-scope-mappings",columns:[{name:"name",displayKey:"role"},{name:"containerId",displayKey:"origin"}]},i)},Hs=({clientId:n,protocol:i})=>{const{adminClient:a}=Y(),t="openid",{t:s}=I(),{enabled:o}=Ln(),{realm:l}=ce(),c=Be().protocolMapperTypes[i],[p,u]=f([]),[d,g]=f(!1),[m,h]=f([t]),[S,E]=f(0),[k,T]=f(""),v=()=>T(`${new Date().getTime()}`),[D,V]=f([]),[z,U]=f([]),[y,H]=f(""),[x,_]=f(""),[A,b]=f(""),C=ot(null),B=ot(null),N=ot(null),ee=ot(null),w=ot(null),G=Pe(),{hasAccess:fe}=Ee(),_e=fe("view-users");return te(()=>a.clients.listOptionalClientScopes({id:n}),j=>u(j),[]),te(async()=>{const j=m.join(" "),Q=await a.clients.evaluatePermission({id:n,roleContainer:l,scope:j,type:"granted"});return{mapperList:await a.clients.evaluateListProtocolMapper({id:n,scope:j}),effectiveRoles:Q}},({mapperList:j,effectiveRoles:Q})=>{V(Q),j.map(ge=>{ge.type=c.filter(Se=>Se.id===ge.protocolMapper)[0]}),U(j),v()},[m]),te(async()=>{const j=m.join(" "),Q=G.getValues("user");return Q?await Promise.all([a.clients.evaluateGenerateAccessToken({id:n,userId:Q[0],scope:j}),a.clients.evaluateGenerateUserInfo({id:n,userId:Q[0],scope:j}),a.clients.evaluateGenerateIdToken({id:n,userId:Q[0],scope:j})]):[]},([j,Q,ge])=>{H(We(j)),_(We(Q)),b(We(ge))},[G.getValues("user"),m]),r(L,{children:[r(re,{variant:"light",children:[o&&e(Me,{className:"keycloak__section_intro__help",children:r(ue,{children:[e(Pi,{})," ",s("evaluateExplain")]})}),r(he,{isHorizontal:!0,children:[e(F,{label:s("scopeParameter"),fieldId:"scopeParameter",labelIcon:e(M,{helpText:s("scopeParameterHelp"),fieldLabelId:"scopeParameter"}),children:r(et,{hasGutter:!0,children:[e(be,{isFilled:!0,children:e(Jt,{toggleId:"scopeParameter",variant:St.typeaheadMulti,typeAheadAriaLabel:s("scopeParameter"),onToggle:()=>g(!d),isOpen:d,selections:m,onSelect:j=>{const Q=j;m.includes(Q)?Q!==t&&h(m.filter(ge=>ge!==Q)):h([...m,Q])},"aria-labelledby":s("scopeParameter"),placeholderText:s("scopeParameterPlaceholder"),children:p.map((j,Q)=>e(Ae,{value:j.name,children:j.name},Q))})}),e(be,{children:e(Wn,{className:"keycloak__scopes_evaluate__clipboard-copy",children:m.join(" ")})})]})}),_e&&e(Re,{...G,children:e(Zn,{name:"user",label:"users",helpText:s("userHelp"),defaultValue:"",variant:St.typeahead,isRequired:!0})})]})]}),r(Ua,{hasGutter:!0,className:"keycloak__scopes_evaluate__tabs",children:[r(pn,{span:8,children:[e(rt,{"aria-labelledby":"pf-tab-0-effectiveProtocolMappers",eventKey:0,id:"effectiveProtocolMappers",ref:C,children:e(Os,{protocolMappers:z})}),e(rt,{"aria-labelledby":"pf-tab-0-effectiveRoleScopeMappings",eventKey:1,id:"effectiveRoleScopeMappings",ref:B,hidden:!0,children:e(Ls,{effectiveRoles:D})}),e(rt,{"aria-labelledby":s("generatedAccessToken"),eventKey:2,id:"tab-generated-access-token",ref:N,hidden:!0,children:e(Ut,{text:y,user:G.getValues("user"),label:"generatedAccessToken"})}),e(rt,{"aria-labelledby":s("generatedIdToken"),eventKey:3,id:"tab-generated-id-token",ref:ee,hidden:!0,children:e(Ut,{text:A,user:G.getValues("user"),label:"generatedIdToken"})}),e(rt,{"aria-labelledby":s("generatedUserInfo"),eventKey:4,id:"tab-generated-user-info",ref:w,hidden:!0,children:e(Ut,{text:x,user:G.getValues("user"),label:"generatedUserInfo"})})]}),e(pn,{span:4,children:r(wi,{id:"tabs",isVertical:!0,activeKey:S,onSelect:(j,Q)=>E(Q),children:[e(X,{id:"effectiveProtocolMappers","aria-controls":"effectiveProtocolMappers","data-testid":"effective-protocol-mappers-tab",eventKey:0,title:r(Z,{children:[s("effectiveProtocolMappers")," ",e(M,{fieldLabelId:"effectiveProtocolMappers",helpText:s("effectiveProtocolMappersHelp"),noVerticalAlign:!1,unWrap:!0})]}),tabContentRef:C}),e(X,{id:"effectiveRoleScopeMappings","aria-controls":"effectiveRoleScopeMappings","data-testid":"effective-role-scope-mappings-tab",eventKey:1,title:r(Z,{children:[s("effectiveRoleScopeMappings")," ",e(M,{fieldLabelId:"effectiveRoleScopeMappings",helpText:s("effectiveRoleScopeMappingsHelp"),noVerticalAlign:!1,unWrap:!0})]}),tabContentRef:B}),e(X,{id:"generatedAccessToken","aria-controls":"generatedAccessToken","data-testid":"generated-access-token-tab",eventKey:2,title:r(Z,{children:[s("generatedAccessToken")," ",e(M,{fieldLabelId:"generatedAccessToken",helpText:s("generatedAccessTokenHelp"),noVerticalAlign:!1,unWrap:!0})]}),tabContentRef:N}),e(X,{id:"generatedIdToken","aria-controls":"generatedIdToken","data-testid":"generated-id-token-tab",eventKey:3,title:r(Z,{children:[s("generatedIdToken")," ",e(M,{fieldLabelId:"generatedIdToken",helpText:s("generatedIdTokenHelp"),noVerticalAlign:!1,unWrap:!0})]}),tabContentRef:ee}),e(X,{id:"generatedUserInfo","aria-controls":"generatedUserInfo","data-testid":"generated-user-info-tab",eventKey:4,title:r(Z,{children:[s("generatedUserInfo")," ",e(M,{fieldLabelId:"generatedUserInfo",helpText:s("generatedUserInfoHelp"),noVerticalAlign:!1,unWrap:!0})]}),tabContentRef:w})]},k)})]})]})},Ks=({client:n})=>{const{adminClient:i}=Y(),{t:a}=I(),{addAlert:t,addError:s}=ae(),{realm:o}=ce(),[l,c]=f(),{hasAccess:p}=Ee(),u=p("manage-clients");te(()=>i.clients.getServiceAccountUser({id:n.id}),g=>c(g),[]);const d=async g=>{try{const m=g.filter(h=>h.client===void 0).map(h=>h.role).flat();await i.users.addRealmRoleMappings({id:l?.id,roles:m}),await Promise.all(g.filter(h=>h.client!==void 0).map(h=>i.users.addClientRoleMappings({id:l?.id,clientUniqueId:h.client.id,roles:[h.role]}))),t(a("roleMappingUpdatedSuccess"),W.success)}catch(m){s("roleMappingUpdatedError",m)}};return l?r(L,{children:[r(re,{className:"pf-v5-u-pb-0",children:[e($n,{className:"pf-v5-c-alert__icon keycloak--service-account--info-text"}),e("span",{className:"pf-v5-u-pl-sm",children:r(Di,{i18nKey:"manageServiceAccountUser",children:["",e(me,{to:qa({realm:o,id:l.id,tab:"settings"}),children:{link:l.username}})]})})]}),e(_i,{name:n.clientId,id:l.id,type:"users",isManager:u||n.access?.configure,save:d})]}):e(xe,{})},Ms=({onChange:n,value:i,save:a,client:t,toggleDownloadDialog:s,toggleDeleteDialog:o})=>{const{t:l}=I(),[c,p]=ye({titleKey:"disableConfirmClientTitle",messageKey:"disableConfirmClient",continueButtonLabel:"disable",onConfirm:()=>{n(!i),a()}}),u=pt(()=>{const h=ui(l,t.protocol??"openid-connect");return[{text:t.bearerOnly?e(Un,{"data-testid":"bearer-only-explainer-tooltip",content:l("explainBearerOnly"),children:e(Gt,{"data-testid":"bearer-only-explainer-label",icon:e($n,{}),children:h})}):e(Gt,{children:h})}]},[t,l]),{hasAccess:d}=Ee(),g=d("manage-clients")||t.access?.configure,m=[e(Je,{onClick:s,children:l("downloadAdapterConfig")},"download"),e(Je,{onClick:()=>Wa(t),children:l("export")},"export"),...!yt(t)&&g?[e(Ke,{},"divider"),e(Je,{"data-testid":"delete-client",onClick:o,children:l("delete")},"delete")]:[]];return r(L,{children:[e(p,{}),e(ei,{titleKey:t.clientId,subKey:"clientsExplain",badges:u,divider:!1,isReadOnly:!g,helpTextKey:"enableDisable",dropdownItems:m,isEnabled:i,onToggle:h=>{h?(n(h),a()):c()}})]})};function jo(){const{adminClient:n}=Y(),{t:i}=I(),{addAlert:a,addError:t}=ae(),{realm:s}=ce(),{hasAccess:o}=Ee(),l=Hn(),c=o("manage-authorization"),p=o("view-authorization"),u=o("manage-clients"),d=o("view-clients"),g=o("view-users"),m=l(Kn.AdminFineGrainedAuthz)&&(c||p),h=tt(),[S,E]=ve(),[k,T]=ve(),v=Pe(),{clientId:D}=Zt(),[V,z]=f(0),U=Xe({control:v.control,name:"clientAuthenticatorType",defaultValue:"client-secret"}),[y,H]=f(),x=async()=>{const J=await n.clients.listRoles({id:D});return Yn(J,st=>st.name?.toUpperCase())},_=J=>Mt(Ja({realm:s,clientId:D,tab:J})),A=_("settings"),b=_("keys"),C=_("credentials"),B=_("roles"),N=_("clientScopes"),ee=_("authorization"),w=_("serviceAccount"),G=_("sessions"),fe=_("permissions"),_e=_("advanced"),j=J=>Mt(mn({realm:s,clientId:D,tab:J})),Q=j("setup"),ge=j("evaluate"),Se=J=>Mt(hn({realm:s,clientId:D,tab:J})),_t=Se("settings"),Fe=Se("resources"),Dt=Se("scopes"),Nt=Se("policies"),gt=Se("permissions"),le=Se("evaluate"),Ve=Se("export"),[Ot,ha]=ye({titleKey:"clientDeleteConfirmTitle",messageKey:"clientDeleteConfirm",continueButtonLabel:"delete",continueButtonVariant:pe.danger,onConfirm:async()=>{try{await n.clients.del({id:D}),a(i("clientDeletedSuccess"),W.success),h(Ga({realm:s}))}catch(J){t("clientDeleteError",J)}}}),Lt=J=>{v.reset({...J}),Ya(J,v.setValue),J.attributes?.["acr.loa.map"]&&v.setValue(R("attributes.acr.loa.map"),Object.entries(JSON.parse(J.attributes["acr.loa.map"])).flatMap(([st,Ht])=>({key:st,value:Ht})))};te(()=>n.clients.findOne({id:D}),J=>{if(!J)throw new Error(i("notFound"));H(Qa(J)),Lt(J)},[D,V]);const Oe=async({confirmed:J=!1,messageKey:st="clientSaveSuccess"}={confirmed:!1,messageKey:"clientSaveSuccess"})=>{if(!await v.trigger())return;if(!y?.publicClient&&y?.clientAuthenticatorType!==U&&!J){T();return}const Ht=fn(v.getValues()),bt=fn(Ht);bt.attributes?.["acr.loa.map"]&&(bt.attributes["acr.loa.map"]=JSON.stringify(Object.fromEntries(bt.attributes["acr.loa.map"].filter(({key:Ce})=>Ce!=="").map(({key:Ce,value:fa})=>[Ce,fa]))));try{const Ce={...y,...bt};Ce.clientId=Ce.clientId?.trim(),await n.clients.update({id:D},Ce),Lt(Ce),H(Ce),a(i(st),W.success)}catch(Ce){t("clientSaveError",Ce)}};return y?r(L,{children:[e(Xt,{continueButtonLabel:"yes",cancelButtonLabel:"no",titleKey:i("changeAuthenticatorConfirmTitle",{clientAuthenticatorType:U}),open:k,toggleDialog:T,onConfirm:()=>Oe({confirmed:!0}),children:e(L,{children:i("changeAuthenticatorConfirm",{clientAuthenticatorType:U})})}),e(ha,{}),S&&e(Ni,{id:y.id,protocol:y.protocol,open:!0,toggleDialog:E}),e(ie,{name:"enabled",control:v.control,defaultValue:!0,render:({field:J})=>e(Ms,{value:J.value,onChange:J.onChange,client:y,save:Oe,toggleDeleteDialog:Ot,toggleDownloadDialog:E})}),e(re,{variant:"light",className:"pf-v5-u-p-0",children:e(Re,{...v,children:r(Kt,{"data-testid":"client-tabs","aria-label":"client-tabs",isBox:!0,mountOnEnter:!0,children:[e(X,{id:"settings","data-testid":"clientSettingsTab",title:e(Z,{children:i("settings")}),...A,children:e(Yi,{client:y,save:()=>Oe(),reset:()=>Lt(y)})}),(!y.publicClient&&!yt(y)||y.protocol==="saml")&&r(X,{id:"keys","data-testid":"keysTab",title:e(Z,{children:i("keys")}),...b,children:[y.protocol==="openid-connect"&&e(Rs,{clientId:D,save:Oe,hasConfigureAccess:y.access?.configure}),y.protocol==="saml"&&e(_s,{clientId:D,save:Oe})]}),!y.publicClient&&!yt(y)&&(d||y.access?.configure||y.access?.view)&&e(X,{id:"credentials",title:e(Z,{children:i("credentials")}),...C,children:e(ks,{client:y,save:Oe,refresh:()=>z(V+1)},V)}),e(X,{id:"roles","data-testid":"rolesTab",title:e(Z,{children:i("roles")}),...B,children:e(Za,{loader:x,paginated:!1,messageBundle:"client",toCreate:ja({realm:s,clientId:y.id}),toDetail:J=>$a({realm:s,clientId:y.id,id:J,tab:"details"}),isReadOnly:!(u||y.access?.configure)})}),!yt(y)&&!y.bearerOnly&&e(X,{id:"clientScopes","data-testid":"clientScopesTab",title:e(Z,{children:i("clientScopes")}),...N,children:r(Kt,{defaultLocation:mn({realm:s,clientId:D,tab:"setup"}),children:[e(X,{id:"setup","data-testid":"clientScopesSetupTab",title:e(Z,{children:i("setup")}),...Q,children:e(Ns,{clientName:y.clientId,clientId:D,protocol:y.protocol,fineGrainedAccess:y.access?.manage})}),e(X,{id:"evaluate","data-testid":"clientScopesEvaluateTab",title:e(Z,{children:i("evaluate")}),...ge,children:e(Hs,{clientId:D,protocol:y.protocol})})]})}),y.authorizationServicesEnabled&&(c||p)&&e(X,{id:"authorization","data-testid":"authorizationTab",title:e(Z,{children:i("authorization")}),...ee,children:r(Kt,{mountOnEnter:!0,unmountOnExit:!0,defaultLocation:hn({realm:s,clientId:D,tab:"settings"}),children:[e(X,{id:"settings","data-testid":"authorizationSettings",title:e(Z,{children:i("settings")}),..._t,children:e(bs,{clientId:D})}),e(X,{id:"resources","data-testid":"authorizationResources",title:e(Z,{children:i("resources")}),...Fe,children:e(hs,{clientId:D,isDisabled:!c})}),e(X,{id:"scopes","data-testid":"authorizationScopes",title:e(Z,{children:i("scopes")}),...Dt,children:e(fs,{clientId:D,isDisabled:!c})}),e(X,{id:"policies","data-testid":"authorizationPolicies",title:e(Z,{children:i("policies")}),...Nt,children:e(us,{clientId:D,isDisabled:!c})}),e(X,{id:"permissions","data-testid":"authorizationPermissions",title:e(Z,{children:i("permissions")}),...gt,children:e(cs,{clientId:D,isDisabled:!c})}),g&&e(X,{id:"evaluate","data-testid":"authorizationEvaluate",title:e(Z,{children:i("evaluate")}),...le,children:e(as,{client:y,save:Oe})}),o("manage-authorization")&&e(X,{id:"export","data-testid":"authorizationExport",title:e(Z,{children:i("export")}),...Ve,children:e(ss,{})})]})}),y.serviceAccountsEnabled&&g&&e(X,{id:"serviceAccount","data-testid":"serviceAccountTab",title:e(Z,{children:i("serviceAccount")}),...w,children:e(Ks,{client:y})}),e(X,{id:"sessions","data-testid":"sessionsTab",title:e(Z,{children:i("sessions")}),...G,children:e(qi,{client:y})}),m&&(u||y.access?.manage)&&e(X,{id:"permissions","data-testid":"permissionsTab",title:e(Z,{children:i("permissions")}),...fe,children:e(Xa,{id:y.id,type:"clients"})}),e(X,{id:"advanced","data-testid":"advancedTab",title:e(Z,{children:i("advanced")}),..._e,children:e(Ui,{save:Oe,client:y})})]})})})]}):e(xe,{})}export{jo as default};
//# sourceMappingURL=ClientDetails-Cuh-h3cY.js.map




© 2015 - 2025 Weber Informatics LLC | Privacy Policy