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

theme.keycloak.v2.admin.resources.assets.DiscoveryEndpointField-D6J04Afm.js Maven / Gradle / Ivy

There is a newer version: 26.0.7
Show newest version
import{jsxs as g,Fragment as x,jsx as d}from"react/jsx-runtime";import{useState as y,useMemo as F}from"react";import{u as I,a as C,aj as T,ac as j,ad as k,a4 as H,x as S,cr as P}from"./index-C1LIsRX7.js";const f=(r,t,i={})=>{if(!Number.isFinite(t))throw new TypeError("Expected `wait` to be a finite number");let a,e,l=[];return function(...u){return new Promise(s=>{const n=i.before&&!e;clearTimeout(e),e=setTimeout(()=>{e=null;const p=i.before?a:r.apply(this,u);for(s of l)s(p);l=[]},t),n?(a=r.apply(this,u),s(a)):l.push(s)})}};f.promise=r=>{let t;return async function(...i){if(t)return t;try{return t=r.apply(this,i),await t}finally{t=void 0}}};const O=({id:r,fileUpload:t,children:i})=>{const{adminClient:a}=I(),{t:e}=C(),{setValue:l,clearErrors:u,formState:{errors:s}}=T(),[n,p]=y(!0),[v,m]=y(!1),[E,h]=y(),b=c=>{Object.keys(c).map(o=>l(`config.${o}`,c[o]))},D=async c=>{m(!0);try{const o=await a.identityProviders.importFromUrl({providerId:r,fromUrl:c});b(o),h(o)}catch(o){return o.message}finally{m(!1)}},w=F(()=>f(D,1e3),[]);return g(x,{children:[d(j,{label:e(r==="oidc"?"useDiscoveryEndpoint":"useEntityDescriptor"),fieldId:"kc-discovery-endpoint",labelIcon:d(k,{helpText:e(r==="oidc"?"useDiscoveryEndpointHelp":"useEntityDescriptorHelp"),fieldLabelId:"discoveryEndpoint"}),children:d(H,{id:"kc-discovery-endpoint-switch",label:e("on"),labelOff:e("off"),isChecked:n,onChange:(c,o)=>{u("discoveryError"),p(o)},"aria-label":e(r==="oidc"?"useDiscoveryEndpoint":"useEntityDescriptor")})}),n&&d(S,{name:"discoveryEndpoint",label:e(r==="oidc"?"discoveryEndpoint":"samlEntityDescriptor"),labelIcon:e(r==="oidc"?"discoveryEndpointHelp":"samlEntityDescriptorHelp"),type:"url",placeholder:r==="oidc"?"https://hostname/auth/realms/master/.well-known/openid-configuration":"",validated:s.discoveryError||s.discoveryEndpoint?"error":E?"success":"default",customIcon:v?d(P,{isInline:!0}):void 0,rules:{required:e("required"),validate:c=>w(c)}}),!n&&t,n&&!s.discoveryError&&i(!0),!n&&i(!1)]})};export{O as D};
//# sourceMappingURL=DiscoveryEndpointField-D6J04Afm.js.map




© 2015 - 2025 Weber Informatics LLC | Privacy Policy