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

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

There is a newer version: 25.0.1
Show newest version
import{u as I,a as F,r as n,g as k,j as r,F as u,h as m,S as w,aV as S}from"./index-0cda761d.js";import{K as T}from"./KeycloakTextInput-ada01047.js";const R=({id:o,fileUpload:E,children:c})=>{const{t:s}=I("identity-providers"),{setValue:f,register:h,setError:x,watch:D,clearErrors:a,formState:{errors:t}}=F(),l=D("discoveryEndpoint"),[i,g]=n.useState(!0),[p,d]=n.useState(!1),[y,b]=n.useState(),j=e=>{Object.keys(e).map(v=>f(`config.${v}`,e[v]))};return n.useEffect(()=>{if(!l){d(!1);return}(async()=>{a("discoveryError");try{const e=await k.identityProviders.importFromUrl({providerId:o,fromUrl:l});j(e),b(e)}catch(e){x("discoveryError",{type:"manual",message:e.message})}d(!1)})()},[p]),r.jsxs(r.Fragment,{children:[r.jsx(u,{label:s(o==="oidc"?"useDiscoveryEndpoint":"useEntityDescriptor"),fieldId:"kc-discovery-endpoint",labelIcon:r.jsx(m,{helpText:`identity-providers-help:${o==="oidc"?"useDiscoveryEndpoint":"useEntityDescriptor"}`,fieldLabelId:"identity-providers:discoveryEndpoint"}),children:r.jsx(w,{id:"kc-discovery-endpoint-switch",label:s("common:on"),labelOff:s("common:off"),isChecked:i,onChange:e=>{a("discoveryError"),g(e)},"aria-label":s(o==="oidc"?"useDiscoveryEndpoint":"useEntityDescriptor")})}),i&&r.jsx(u,{label:s(o==="oidc"?"discoveryEndpoint":"samlEntityDescriptor"),fieldId:"kc-discovery-endpoint",labelIcon:r.jsx(m,{helpText:`identity-providers-help:${o==="oidc"?"discoveryEndpoint":"samlEntityDescriptor"}`,fieldLabelId:"identity-providers:discoveryEndpoint"}),validated:t.discoveryError||t.discoveryEndpoint?"error":y?"success":"default",helperTextInvalid:t.discoveryEndpoint?s("common:required"):s("noValidMetaDataFound",{error:t.discoveryError?.message}),isRequired:!0,children:r.jsx(T,{type:"url","data-testid":"discoveryEndpoint",id:"kc-discovery-endpoint",placeholder:o==="oidc"?"https://hostname/auth/realms/master/.well-known/openid-configuration":"",validated:t.discoveryError||t.discoveryEndpoint?"error":y?"success":"default",customIconUrl:p?S.resourceUrl+"/discovery-load-indicator.svg":"",...h("discoveryEndpoint",{required:!0,onBlur:()=>d(!0)})})}),!i&&E,i&&!t.discoveryError&&c(!0),!i&&c(!1)]})};export{R as D};
//# sourceMappingURL=DiscoveryEndpointField-7c916640.js.map




© 2015 - 2024 Weber Informatics LLC | Privacy Policy