1 line
29 KiB
JavaScript
1 line
29 KiB
JavaScript
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7880],{5251:(e,t,s)=>{s.d(t,{Fm:()=>p,Qs:()=>m,cj:()=>l,h:()=>u,kN:()=>o,qp:()=>h});var a=s(4208);s(91356);var n=s(79531),i=s(12551),r=s(58113);function l({...e}){return(0,a.jsx)(n.bL,{"data-slot":"sheet",...e})}function o({...e}){return(0,a.jsx)(n.bm,{"data-slot":"sheet-close",...e})}function d({...e}){return(0,a.jsx)(n.ZL,{"data-slot":"sheet-portal",...e})}function c({className:e,...t}){return(0,a.jsx)(n.hJ,{"data-slot":"sheet-overlay",className:(0,r.cn)("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),...t})}function u({className:e,children:t,side:s="right",overlayClassName:l,hideClose:o=!1,...p}){return(0,a.jsxs)(d,{children:[(0,a.jsx)(c,{className:l}),(0,a.jsxs)(n.UC,{"data-slot":"sheet-content",className:(0,r.cn)("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500","right"===s&&"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm","left"===s&&"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm","top"===s&&"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b","bottom"===s&&"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",e),...p,children:[t,o?null:(0,a.jsxs)(n.bm,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none",children:[(0,a.jsx)(i.A,{className:"size-4"}),(0,a.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}function p({className:e,...t}){return(0,a.jsx)("div",{"data-slot":"sheet-header",className:(0,r.cn)("flex flex-col gap-1.5 p-4",e),...t})}function h({className:e,...t}){return(0,a.jsx)(n.hE,{"data-slot":"sheet-title",className:(0,r.cn)("text-foreground font-semibold",e),...t})}function m({className:e,...t}){return(0,a.jsx)(n.VY,{"data-slot":"sheet-description",className:(0,r.cn)("text-muted-foreground text-sm",e),...t})}},18166:(e,t,s)=>{s.d(t,{Cf:()=>u,Es:()=>h,HM:()=>d,L3:()=>m,c7:()=>p,lG:()=>l,rr:()=>x});var a=s(4208);s(91356);var n=s(79531),i=s(12551),r=s(58113);function l({...e}){return(0,a.jsx)(n.bL,{"data-slot":"dialog",...e})}function o({...e}){return(0,a.jsx)(n.ZL,{"data-slot":"dialog-portal",...e})}function d({...e}){return(0,a.jsx)(n.bm,{"data-slot":"dialog-close",...e})}function c({className:e,...t}){return(0,a.jsx)(n.hJ,{"data-slot":"dialog-overlay",className:(0,r.cn)("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),...t})}function u({className:e,overlayClassName:t,children:s,showCloseButton:l=!0,...d}){return(0,a.jsxs)(o,{"data-slot":"dialog-portal",children:[(0,a.jsx)(c,{className:t}),(0,a.jsxs)(n.UC,{"data-slot":"dialog-content",className:(0,r.cn)("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",e),...d,children:[s,l&&(0,a.jsxs)(n.bm,{"data-slot":"dialog-close",className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[(0,a.jsx)(i.A,{}),(0,a.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}function p({className:e,...t}){return(0,a.jsx)("div",{"data-slot":"dialog-header",className:(0,r.cn)("flex flex-col gap-2 text-center sm:text-left",e),...t})}function h({className:e,...t}){return(0,a.jsx)("div",{"data-slot":"dialog-footer",className:(0,r.cn)("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function m({className:e,...t}){return(0,a.jsx)(n.hE,{"data-slot":"dialog-title",className:(0,r.cn)("text-lg leading-none font-semibold",e),...t})}function x({className:e,...t}){return(0,a.jsx)(n.VY,{"data-slot":"dialog-description",className:(0,r.cn)("text-muted-foreground text-sm",e),...t})}},27880:(e,t,s)=>{s.r(t),s.d(t,{AuthenticationSection:()=>G});var a=s(4208),n=s(91356),i=s(58564),r=s(25729),l=s(93497),o=s(52366),d=s(91505),c=s(90773),u=s(78606),p=s(18584);let h={google:{title:"Google Workspace / Google Cloud",steps:["Console Google Cloud → APIs & Services → Credentials.","Cr\xe9er un client OAuth \xab Web application \xbb.","Ajouter l'URI de redirection Authentik (copier depuis le formulaire).","Renseigner Client ID et Client Secret ici.","Restreindre aux comptes de votre organisation via domaines autoris\xe9s (claim hd).","Scopes recommand\xe9s : openid email profile."]},github:{title:"GitHub OAuth App",steps:["GitHub → Settings → Developer settings → OAuth Apps → New OAuth App.","Authorization callback URL = URI de redirection Authentik.","Copier Client ID et g\xe9n\xe9rer un Client Secret.","Limiter l'acc\xe8s avec la liste d'organisations GitHub autoris\xe9es si besoin."]},linkedin:{title:"LinkedIn OAuth 2.0",steps:["LinkedIn Developer Portal → cr\xe9er une application.","Ajouter l'URI de redirection Authentik dans Authorized redirect URLs.","Activer les produits Sign In with LinkedIn / OpenID Connect.","Copier Client ID et Client Secret."]},microsoft:{title:"Microsoft Entra ID (Azure AD)",steps:["Portail Azure → App registrations → New registration.","Type de compte : organisation uniquement si SSO entreprise.","Redirect URI (Web) = URI Authentik.","Cr\xe9er un client secret dans Certificates & secrets.","Renseigner le tenant ID dans organisations autoris\xe9es (claim tid)."]},custom:{title:"OAuth / OpenID Connect personnalis\xe9",steps:["Cr\xe9er une application OAuth chez votre fournisseur.","Renseigner authorization, token et profile/userinfo URLs.","URI de redirection = callback Authentik affich\xe9 dans le formulaire.","Scopes minimum : openid email profile."]}},m={title:"Fournisseur SAML (Azure AD, Okta, Google Workspace…)",steps:["Cr\xe9er une application SAML c\xf4t\xe9 IdP entreprise.","Renseigner l'Entity ID / Audience = slug Authentik ou valeur fournie.","ACS / SSO URL = URL de connexion Authentik pour cette source.","Importer metadata URL/XML ou renseigner SSO URL + certificat signing.","Mapper l'email dans les attributs SAML (NameID ou mail)."]},x={title:"LDAP / Active Directory",steps:["Pr\xe9parer un compte de bind en lecture (bind DN + mot de passe).","Indiquer server_uri (ldap:// ou ldaps://) et base_dn de recherche.","Activer StartTLS si le serveur ne supporte que LDAP clair + TLS.","Optionnel : filtre utilisateur (ex. (sAMAccountName=%(user)s)).","Laisser sync_users d\xe9sactiv\xe9 pour l'authentification seule."]};var g=s(66987),v=s(37820),f=s(17745),j=s(39927),b=s(94927),_=s(29546),y=s(51355),N=s(61554),k=s(18166),C=s(13746),A=s(19096),w=s(89342),z=s(5251),S=s(12154),L=s(84956),I=s(89032);let R={google:"Google",github:"GitHub",linkedin:"LinkedIn",microsoft:"Microsoft",custom:"Autre / custom"};function U(e){return e.split(/[\n,]/).map(e=>e.trim()).filter(Boolean)}function D(e){return(e??[]).join("\n")}function J(e){return e.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function O({onRegisterBeforeSave:e}){let t,s=(0,v.U)(e=>e.identityProviders),i=(0,v.U)(e=>e.setIdentityProviders),E=(0,v.U)(e=>e.meta),[P,G]=(0,n.useState)(s),[M,T]=(0,n.useState)(!1),[F,$]=(0,n.useState)(null),[q,V]=(0,n.useState)("oauth"),H=(0,f.n)({mutationFn:e=>b.uE.post(`/admin/org/identity-providers/${encodeURIComponent(e)}/test`)}),B=(t=(0,j.jE)(),(0,f.n)({mutationFn:e=>b.uE.post(`/admin/org/identity-providers/${encodeURIComponent(e)}/sync`),onSuccess:e=>{t.setQueryData(_.cn,e)}})),K=(0,f.n)({mutationFn:e=>b.uE.get(`/admin/org/identity-providers/redirect-uri/${encodeURIComponent(e)}`)});(0,n.useEffect)(()=>{G(s)},[s]);let W=E?.effective.identity_providers?.oauth_redirect_template??"http://localhost/auth/source/oauth/callback/{slug}/",Y=null!=F?P.providers[F]:null,Z=(0,n.useMemo)(()=>{var e,t;return Y?(e=Y.type,t=Y.oauth?.provider,"oauth"===e?h[t??"custom"]:"saml"===e?m:x):null},[Y]);function Q(e,t){G(s=>{let a=[...s.providers];return a[e]={...a[e],...t},{...s,providers:a}})}function X(e){let t=E?.secrets?.identity_providers;return t&&"object"==typeof t?t[e.id]??{}:{}}async function ee(e){try{await H.mutateAsync(e.id),I.oR.success("Configuration valide")}catch(e){I.oR.error(e instanceof Error?e.message:"Test \xe9chou\xe9")}}async function et(e){try{await B.mutateAsync(e.id),I.oR.success("Synchronisation Authentik lanc\xe9e")}catch{I.oR.error("Synchronisation \xe9chou\xe9e")}}async function es(e){try{let t=await K.mutateAsync(e);await navigator.clipboard.writeText(t.redirect_uri),I.oR.success("URI de redirection copi\xe9e")}catch{let t=W.replace("{slug}",e);await navigator.clipboard.writeText(t),I.oR.success("URI de redirection copi\xe9e")}}return(0,n.useEffect)(()=>(e?.(()=>i(P)),()=>e?.(null)),[P,e,i]),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.Kk,{title:"Inscription self-service Authentik",description:"Flow ulti-enrollment : autoriser la cr\xe9ation de compte locale en parall\xe8le du SSO entreprise.",checked:P.allow_self_enrollment,onCheckedChange:e=>G(t=>({...t,allow_self_enrollment:e}))}),(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)(A.J,{children:"Fournisseurs configur\xe9s"}),(0,a.jsxs)(N.$,{variant:"outline",size:"sm",onClick:()=>T(!0),children:[(0,a.jsx)(l.A,{className:"mr-2 size-4"}),"Ajouter"]})]}),0===P.providers.length?(0,a.jsx)("p",{className:"rounded-lg border border-dashed p-6 text-sm text-muted-foreground",children:"Aucun fournisseur. Ajoutez Google Workspace, Azure AD SAML, LDAP AD ou un OAuth custom."}):(0,a.jsx)("div",{className:"grid gap-3",children:P.providers.map((e,t)=>(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3 rounded-lg border border-mail-border p-4",children:[(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)("span",{className:"text-sm font-medium",children:e.name||e.slug||"Nouveau fournisseur"}),(0,a.jsx)(y.E,{variant:"outline",children:e.type.toUpperCase()}),function(e){switch(e){case"synced":return(0,a.jsx)(y.E,{variant:"secondary",children:"Synchronis\xe9"});case"error":return(0,a.jsx)(y.E,{variant:"destructive",children:"Erreur sync"});default:return(0,a.jsx)(y.E,{variant:"outline",children:"En attente"})}}(e.sync_status)]}),(0,a.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Slug : ",e.slug||"—",e.sync_error?` \xb7 ${e.sync_error}`:""]})]}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)(S.d,{checked:e.enabled,onCheckedChange:e=>Q(t,{enabled:e})}),(0,a.jsx)(N.$,{variant:"outline",size:"sm",onClick:()=>$(t),children:"Modifier"}),(0,a.jsx)(N.$,{variant:"outline",size:"icon",disabled:H.isPending,onClick:()=>ee(e),children:(0,a.jsx)(o.A,{className:"size-4"})}),(0,a.jsx)(N.$,{variant:"outline",size:"icon",disabled:B.isPending,onClick:()=>et(e),children:B.isPending?(0,a.jsx)(d.A,{className:"size-4 animate-spin"}):(0,a.jsx)(c.A,{className:"size-4"})}),(0,a.jsx)(N.$,{variant:"ghost",size:"icon",onClick:()=>{G(e=>({...e,providers:e.providers.filter((e,s)=>s!==t)})),F===t&&$(null)},children:(0,a.jsx)(u.A,{className:"size-4"})})]})]},e.id))}),(0,a.jsx)(k.lG,{open:M,onOpenChange:T,children:(0,a.jsxs)(k.Cf,{children:[(0,a.jsx)(k.c7,{children:(0,a.jsx)(k.L3,{children:"Ajouter un fournisseur"})}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(A.J,{children:"Type"}),(0,a.jsxs)(w.l6,{value:q,onValueChange:e=>V(e),children:[(0,a.jsx)(w.bq,{className:"mt-1 h-9",children:(0,a.jsx)(w.yv,{})}),(0,a.jsxs)(w.gC,{children:[(0,a.jsx)(w.eb,{value:"oauth",children:(0,a.jsx)(g.c,{brand:"oauth",children:"OAuth (Google, GitHub, LinkedIn…)"})}),(0,a.jsx)(w.eb,{value:"saml",children:(0,a.jsx)(g.c,{brand:"saml",children:"SAML (Azure AD, Okta…)"})}),(0,a.jsx)(w.eb,{value:"ldap",children:(0,a.jsx)(g.c,{brand:"ldap",children:"LDAP / Active Directory"})})]})]})]}),(0,a.jsx)(N.$,{onClick:()=>{let e,t;return e={id:crypto.randomUUID(),name:"",slug:"",type:q,enabled:!0,sync_status:"pending",allowed_email_domains:[],allowed_identities:[],allowed_organizations:[],default_groups:[]},t="oauth"===q?{...e,oauth:{provider:"google",client_id:"",client_secret:"",scopes:"openid email profile"}}:"saml"===q?{...e,saml:{metadata_url:"",entity_id:"",sso_url:""}}:{...e,ldap:{server_uri:"",bind_dn:"",bind_password:"",base_dn:"",user_filter:"",start_tls:!0,sync_users:!1}},void(G(e=>({...e,providers:[...e.providers,t]})),T(!1),$(P.providers.length))},children:"Cr\xe9er"})]})]})}),(0,a.jsx)(z.cj,{open:null!=F,onOpenChange:e=>!e&&$(null),children:(0,a.jsx)(z.h,{className:"flex w-full flex-col gap-0 overflow-y-auto p-0 sm:max-w-2xl",children:Y&&null!=F?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(z.Fm,{className:"border-b px-6 py-5",children:(0,a.jsx)(z.qp,{children:"Configurer le fournisseur"})}),(0,a.jsxs)("div",{className:"grid gap-6 px-6 py-6 lg:grid-cols-[1fr_240px]",children:[(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"grid gap-4 sm:grid-cols-2",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(A.J,{children:"Nom"}),(0,a.jsx)(C.p,{className:"mt-1 h-9",value:Y.name,onChange:e=>{let t=e.target.value;Q(F,{name:t,slug:Y.slug||J(t)})}})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(A.J,{children:"Slug Authentik"}),(0,a.jsx)(C.p,{className:"mt-1 h-9",value:Y.slug,onChange:e=>Q(F,{slug:J(e.target.value)})})]})]}),"oauth"===Y.type?(0,a.jsxs)("div",{className:"space-y-4 rounded-lg border border-mail-border p-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(A.J,{children:"Pr\xe9s\xe9lection"}),(0,a.jsxs)(w.l6,{value:Y.oauth?.provider??"google",onValueChange:e=>Q(F,{oauth:{...Y.oauth??{client_id:"",client_secret:"",scopes:"openid email profile",provider:"google"},provider:e}}),children:[(0,a.jsx)(w.bq,{className:"mt-1 h-9",children:(0,a.jsx)(w.yv,{children:Y.oauth?.provider?(0,a.jsx)(g.c,{brand:Y.oauth.provider,children:R[Y.oauth.provider]}):null})}),(0,a.jsxs)(w.gC,{children:[(0,a.jsx)(w.eb,{value:"google",children:(0,a.jsx)(g.c,{brand:"google",children:"Google"})}),(0,a.jsx)(w.eb,{value:"github",children:(0,a.jsx)(g.c,{brand:"github",children:"GitHub"})}),(0,a.jsx)(w.eb,{value:"linkedin",children:(0,a.jsx)(g.c,{brand:"linkedin",children:"LinkedIn"})}),(0,a.jsx)(w.eb,{value:"microsoft",children:(0,a.jsx)(g.c,{brand:"microsoft",children:"Microsoft"})}),(0,a.jsx)(w.eb,{value:"custom",children:(0,a.jsx)(g.c,{brand:"custom",children:"Autre / custom"})})]})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(A.J,{children:"Client ID"}),(0,a.jsx)(C.p,{className:"mt-1 h-9",value:Y.oauth?.client_id??"",onChange:e=>Q(F,{oauth:{...Y.oauth,client_id:e.target.value}})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(A.J,{children:"Client Secret"}),(0,a.jsx)(C.p,{className:"mt-1 h-9",type:"password",placeholder:X(Y).oauth_client_secret?.configured?"Laisser vide pour conserver":"Secret OAuth",value:Y.oauth?.client_secret??"",onChange:e=>Q(F,{oauth:{...Y.oauth,client_secret:e.target.value}})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(A.J,{children:"Scopes"}),(0,a.jsx)(C.p,{className:"mt-1 h-9",value:Y.oauth?.scopes??"",onChange:e=>Q(F,{oauth:{...Y.oauth,scopes:e.target.value}})})]}),Y.oauth?.provider==="custom"?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(A.J,{children:"Authorization URL"}),(0,a.jsx)(C.p,{className:"mt-1 h-9",value:Y.oauth.authorization_url??"",onChange:e=>Q(F,{oauth:{...Y.oauth,authorization_url:e.target.value}})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(A.J,{children:"Token URL"}),(0,a.jsx)(C.p,{className:"mt-1 h-9",value:Y.oauth.token_url??"",onChange:e=>Q(F,{oauth:{...Y.oauth,token_url:e.target.value}})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(A.J,{children:"Profile URL"}),(0,a.jsx)(C.p,{className:"mt-1 h-9",value:Y.oauth.profile_url??"",onChange:e=>Q(F,{oauth:{...Y.oauth,profile_url:e.target.value}})})]})]}):null,(0,a.jsxs)("div",{children:[(0,a.jsx)(A.J,{children:"URI de redirection"}),(0,a.jsxs)("div",{className:"mt-1 flex gap-2",children:[(0,a.jsx)(C.p,{className:"h-9",readOnly:!0,value:W.replace("{slug}",Y.slug||"votre-slug")}),(0,a.jsx)(N.$,{type:"button",variant:"outline",size:"icon",onClick:()=>es(Y.slug),children:(0,a.jsx)(p.A,{className:"size-4"})})]})]})]}):null,"saml"===Y.type?(0,a.jsxs)("div",{className:"space-y-4 rounded-lg border border-mail-border p-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(A.J,{children:"Metadata URL"}),(0,a.jsx)(C.p,{className:"mt-1 h-9",value:Y.saml?.metadata_url??"",onChange:e=>Q(F,{saml:{...Y.saml,metadata_url:e.target.value}})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(A.J,{children:"Entity ID / Issuer"}),(0,a.jsx)(C.p,{className:"mt-1 h-9",value:Y.saml?.entity_id??"",onChange:e=>Q(F,{saml:{...Y.saml,entity_id:e.target.value}})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(A.J,{children:"SSO URL"}),(0,a.jsx)(C.p,{className:"mt-1 h-9",value:Y.saml?.sso_url??"",onChange:e=>Q(F,{saml:{...Y.saml,sso_url:e.target.value}})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(A.J,{children:"Certificat signing (PEM)"}),(0,a.jsx)(L.T,{className:"mt-1 min-h-24 font-mono text-xs",placeholder:X(Y).saml_signing_cert?.configured?"Laisser vide pour conserver":"-----BEGIN CERTIFICATE-----",value:Y.saml?.signing_cert??"",onChange:e=>Q(F,{saml:{...Y.saml,signing_cert:e.target.value}})})]})]}):null,"ldap"===Y.type?(0,a.jsxs)("div",{className:"space-y-4 rounded-lg border border-mail-border p-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(A.J,{children:"Server URI"}),(0,a.jsx)(C.p,{className:"mt-1 h-9",placeholder:"ldaps://ad.company.com:636",value:Y.ldap?.server_uri??"",onChange:e=>Q(F,{ldap:{...Y.ldap,server_uri:e.target.value}})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(A.J,{children:"Bind DN"}),(0,a.jsx)(C.p,{className:"mt-1 h-9",value:Y.ldap?.bind_dn??"",onChange:e=>Q(F,{ldap:{...Y.ldap,bind_dn:e.target.value}})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(A.J,{children:"Bind password"}),(0,a.jsx)(C.p,{className:"mt-1 h-9",type:"password",placeholder:X(Y).ldap_bind_password?.configured?"Laisser vide pour conserver":"Mot de passe LDAP",value:Y.ldap?.bind_password??"",onChange:e=>Q(F,{ldap:{...Y.ldap,bind_password:e.target.value}})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(A.J,{children:"Base DN"}),(0,a.jsx)(C.p,{className:"mt-1 h-9",value:Y.ldap?.base_dn??"",onChange:e=>Q(F,{ldap:{...Y.ldap,base_dn:e.target.value}})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(A.J,{children:"Filtre utilisateur"}),(0,a.jsx)(C.p,{className:"mt-1 h-9",placeholder:"(sAMAccountName=%(user)s)",value:Y.ldap?.user_filter??"",onChange:e=>Q(F,{ldap:{...Y.ldap,user_filter:e.target.value}})})]}),(0,a.jsx)(r.Kk,{title:"StartTLS",checked:Y.ldap?.start_tls??!0,onCheckedChange:e=>Q(F,{ldap:{...Y.ldap,start_tls:e}})}),(0,a.jsx)(r.Kk,{title:"Synchroniser les utilisateurs LDAP",checked:Y.ldap?.sync_users??!1,onCheckedChange:e=>Q(F,{ldap:{...Y.ldap,sync_users:e}})})]}):null,(0,a.jsxs)("div",{className:"space-y-3 rounded-lg border border-mail-border p-4",children:[(0,a.jsx)("p",{className:"text-sm font-medium",children:"Restrictions d'acc\xe8s"}),(0,a.jsxs)("div",{children:[(0,a.jsx)(A.J,{children:"Domaines email autoris\xe9s"}),(0,a.jsx)(L.T,{className:"mt-1 min-h-20",placeholder:"company.com subsidiary.fr",value:D(Y.allowed_email_domains),onChange:e=>Q(F,{allowed_email_domains:U(e.target.value)})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(A.J,{children:"Identit\xe9s autoris\xe9es (emails)"}),(0,a.jsx)(L.T,{className:"mt-1 min-h-20",placeholder:"admin@company.com",value:D(Y.allowed_identities),onChange:e=>Q(F,{allowed_identities:U(e.target.value)})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(A.J,{children:"Organisations autoris\xe9es"}),(0,a.jsx)(L.T,{className:"mt-1 min-h-20",placeholder:"tenant-id Azure, domaine Google hd, org GitHub…",value:D(Y.allowed_organizations),onChange:e=>Q(F,{allowed_organizations:U(e.target.value)})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(A.J,{children:"Groupes Authentik par d\xe9faut"}),(0,a.jsx)(C.p,{className:"mt-1 h-9",placeholder:"ulti-users, ulti-admins",value:D(Y.default_groups).replace(/\n/g,", "),onChange:e=>Q(F,{default_groups:U(e.target.value.replace(/,/g,"\n"))})})]})]})]}),Z?(0,a.jsxs)("aside",{className:"rounded-lg border bg-muted/30 p-4",children:[(0,a.jsx)("p",{className:"text-sm font-medium",children:Z.title}),(0,a.jsx)("ol",{className:"mt-3 list-decimal space-y-2 pl-4 text-xs text-muted-foreground",children:Z.steps.map(e=>(0,a.jsx)("li",{children:e},e))})]}):null]})]}):null})})]})}var E=s(4023),P=s(82595);function G(){let e=(0,v.U)(e=>e.authentik),t=(0,v.U)(e=>e.setAuthentik),s=(0,v.U)(e=>e.meta?.effective.authentik),l=(0,P.V)("authentik","enabled"),o=(0,P.V)("authentik","api_url"),d=(0,P.V)("authentik","client_id"),c=l?s?.enabled??e.enabled:e.enabled,u=o?s?.api_url??e.api_url:e.api_url,p=d?s?.client_id??e.client_id:e.client_id,h=(0,n.useRef)(null),m=(0,n.useCallback)(e=>{h.current=e},[]);return(0,a.jsx)(i.f,{title:"Authentification",description:"SSO Authentik, provisionnement des comptes Ultimail et fournisseurs d'identit\xe9 upstream.",policySection:["authentik","identity_providers"],beforeSave:async()=>{h.current?.()},children:(0,a.jsxs)(E.I,{columns:2,children:[(0,a.jsxs)(r.KT,{title:"Authentik",description:"Connexion via le fournisseur d'identit\xe9 organisationnel.",hint:l?(0,a.jsx)(P.f,{section:"authentik",field:"enabled"}):null,action:(0,a.jsx)(S.d,{checked:c,disabled:l,onCheckedChange:e=>t({enabled:e})}),children:[(0,a.jsx)(r.u8,{label:"URL API Authentik",hint:o?(0,a.jsx)(P.f,{section:"authentik",field:"api_url"}):void 0,children:(0,a.jsx)(C.p,{className:"h-9",value:u,disabled:o,onChange:e=>t({api_url:e.target.value}),placeholder:"https://auth.example.com/api/v3"})}),(0,a.jsxs)(r.wB,{columns:1,children:[(0,a.jsx)(r.u8,{label:"Slug application",children:(0,a.jsx)(C.p,{className:"h-9",value:e.slug,onChange:e=>t({slug:e.target.value})})}),(0,a.jsx)(r.u8,{label:"Client ID OIDC",hint:d?(0,a.jsx)(P.f,{section:"authentik",field:"client_id"}):void 0,children:(0,a.jsx)(C.p,{className:"h-9",value:p,disabled:d,onChange:e=>t({client_id:e.target.value})})})]}),(0,a.jsx)(r.u8,{label:"Groupes par d\xe9faut (s\xe9par\xe9s par des virgules)",children:(0,a.jsx)(C.p,{className:"h-9",value:e.default_groups,onChange:e=>t({default_groups:e.target.value})})}),(0,a.jsx)(r.Kk,{title:"Forcer le SSO",description:"D\xe9sactive la connexion locale sauf pour les administrateurs.",checked:e.enforce_sso,onCheckedChange:e=>t({enforce_sso:e})}),(0,a.jsx)(r.Kk,{title:"Mot de passe local de secours",description:"Autoriser un fallback mot de passe si Authentik est indisponible.",checked:e.allow_password_fallback,onCheckedChange:e=>t({allow_password_fallback:e})})]}),(0,a.jsx)(r.KT,{title:"Fournisseurs d'identit\xe9",description:"Sources upstream Authentik (OAuth, SAML, LDAP) avec restrictions d'acc\xe8s.",children:(0,a.jsx)(O,{onRegisterBeforeSave:m})})]})})}},66987:(e,t,s)=>{s.d(t,{c:()=>l});var a=s(4208),n=s(84834),i=s(47391),r=s(58113);function l({brand:e,icon:t,children:s,className:o,iconClassName:d,suffix:c}){let u=t??(e?(0,i.r)(e):void 0);return(0,a.jsxs)("span",{className:(0,r.cn)("inline-flex min-w-0 items-center gap-2",o),children:[u?(0,a.jsx)(n.In,{icon:u,className:(0,r.cn)("size-4 shrink-0",d),"aria-hidden":!0}):null,(0,a.jsxs)("span",{className:"truncate",children:[s,c]})]})}},82595:(e,t,s)=>{s.d(t,{V:()=>o,f:()=>l});var a=s(4208),n=s(77510),i=s(37820),r=s(54430);function l({section:e,field:t}){let s=(0,i.U)(e=>e.meta?.deployLocked);return(0,r.me)(s,e,t)?(0,a.jsxs)("p",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[(0,a.jsx)(n.A,{className:"size-3 shrink-0","aria-hidden":!0}),"G\xe9r\xe9 par Docker Compose — modifier les variables d'environnement du d\xe9ploiement."]}):null}function o(e,t){let s=(0,i.U)(e=>e.meta?.deployLocked);return(0,r.me)(s,e,t)}},84956:(e,t,s)=>{s.d(t,{T:()=>i});var a=s(4208);s(91356);var n=s(58113);function i({className:e,...t}){return(0,a.jsx)("textarea",{"data-slot":"textarea",className:(0,n.cn)("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),...t})}},89342:(e,t,s)=>{s.d(t,{TR:()=>m,bq:()=>p,eb:()=>x,gC:()=>h,l6:()=>d,mi:()=>g,s3:()=>c,yv:()=>u});var a=s(4208);s(91356);var n=s(29477),i=s(9519),r=s(35019),l=s(30758),o=s(58113);function d({...e}){return(0,a.jsx)(n.bL,{"data-slot":"select",...e})}function c({...e}){return(0,a.jsx)(n.YJ,{"data-slot":"select-group",...e})}function u({...e}){return(0,a.jsx)(n.WT,{"data-slot":"select-value",...e})}function p({className:e,size:t="default",variant:s="default",children:r,...l}){return(0,a.jsxs)(n.l9,{"data-slot":"select-trigger","data-size":t,"data-variant":s,className:(0,o.cn)("data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground flex w-fit cursor-pointer items-center justify-between gap-2 rounded-md bg-transparent text-sm whitespace-nowrap transition-[color,box-shadow] outline-none disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4","default"===s&&"border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 border px-3 py-2 shadow-xs focus-visible:ring-[3px]","ghost"===s&&"border-0 shadow-none hover:bg-transparent focus-visible:ring-0 dark:bg-transparent dark:hover:bg-transparent dark:data-[state=open]:bg-transparent",e),...l,children:[r,(0,a.jsx)(n.In,{asChild:!0,children:(0,a.jsx)(i.A,{className:"size-4 opacity-50"})})]})}function h({className:e,children:t,position:s="popper",...i}){return(0,a.jsx)(n.ZL,{children:(0,a.jsxs)(n.UC,{"data-slot":"select-content",className:(0,o.cn)("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md","popper"===s&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:s,...i,children:[(0,a.jsx)(v,{}),(0,a.jsx)(n.LM,{className:(0,o.cn)("p-1","popper"===s&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),(0,a.jsx)(f,{})]})})}function m({className:e,...t}){return(0,a.jsx)(n.JU,{"data-slot":"select-label",className:(0,o.cn)("text-muted-foreground px-2 py-1.5 text-xs",e),...t})}function x({className:e,children:t,...s}){return(0,a.jsxs)(n.q7,{"data-slot":"select-item",className:(0,o.cn)("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-pointer items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...s,children:[(0,a.jsx)("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:(0,a.jsx)(n.VF,{children:(0,a.jsx)(r.A,{className:"size-4"})})}),(0,a.jsx)(n.p4,{children:t})]})}function g({className:e,...t}){return(0,a.jsx)(n.wv,{"data-slot":"select-separator",className:(0,o.cn)("bg-border pointer-events-none -mx-1 my-1 h-px",e),...t})}function v({className:e,...t}){return(0,a.jsx)(n.PP,{"data-slot":"select-scroll-up-button",className:(0,o.cn)("flex cursor-pointer items-center justify-center py-1",e),...t,children:(0,a.jsx)(l.A,{className:"size-4"})})}function f({className:e,...t}){return(0,a.jsx)(n.wn,{"data-slot":"select-scroll-down-button",className:(0,o.cn)("flex cursor-pointer items-center justify-center py-1",e),...t,children:(0,a.jsx)(i.A,{className:"size-4"})})}}}]); |