D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
usr
/
share
/
grafana
/
public
/
build
/
Filename :
AdminAuthentication.920a54880a6bbca62a3d.js
back
Copy
"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[8741],{53201:(Y,E,a)=>{a.r(E),a.d(E,{AuthConfigPageUnconnected:()=>$,default:()=>Q});var r=a(42844),S=a(89949),n=a(27702),T=a(27173),v=a(86312),m=a(66310),P=a(44644),I=a(74639),F=a(66670),z=a(60801);const j=({title:t,buttonIcon:o,buttonLink:i,buttonTitle:l,buttonDisabled:d,description:s,onClick:f})=>{const g=(0,m.wW)(B),c=s?n.createElement("span",{key:"proTipFooter"},s):"",p=s?"":g.button,C=n.createElement(F.Qj,{size:"lg",href:i,icon:o,className:p,"data-testid":I.wl.components.CallToActionCard.buttonV2(l),disabled:d,onClick:()=>f&&f()},l);return n.createElement(z._,{className:g.cta,message:t,footer:c,callToActionElement:C})},B=t=>({cta:(0,r.css)` text-align: center; `,button:(0,r.css)` margin-bottom: ${t.spacing(2.5)}; `}),H=j;var A=a(50230),U=a(80011),W=a(73453),h=a(25357);const x="admin/authentication/",K="48px";function b({providerId:t,displayName:o,enabled:i,configFoundInIniFile:l,configPath:d,authType:s,badges:f,onClick:g}){const c=(0,m.wW)(k);return d=x+(d||t),n.createElement(A.Z,{href:d,className:c.container,onClick:()=>g&&g()},n.createElement(A.Z.Heading,{className:c.name},o),l&&n.createElement(n.Fragment,null,n.createElement("span",{className:c.initext},n.createElement(U.u,{content:"Note: Settings enabled in the .ini configuration file will overwritten by the current settings."},n.createElement(n.Fragment,null,n.createElement(W.J,{name:"adjust-circle"}),"Configuration found in .ini file")))),n.createElement("div",{className:c.footer},s&&n.createElement(h.C,{text:s,color:"blue",icon:"info-circle"}),i?n.createElement(h.C,{text:"Enabled",color:"green",icon:"check"}):n.createElement(h.C,{text:"Not enabled",color:"red"})))}const k=t=>({container:(0,r.css)` min-height: ${t.spacing(16)}; display: flex; flex-direction: column; justify-content: space-between; padding: ${t.spacing(2)}; `,header:(0,r.css)` display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: ${t.spacing(2)}; `,footer:(0,r.css)` display: flex; justify-content: space-between; `,name:(0,r.css)` align-self: flex-start; font-size: ${t.typography.h4.fontSize}; color: ${t.colors.text.primary}; margin: 0; `,initext:(0,r.css)` font-size: ${t.typography.bodySmall.fontSize}; color: ${t.colors.text.secondary}; padding: ${t.spacing(1)} 0; // Add some padding max-width: 90%; // Add a max-width to prevent text from stretching too wide `});var w=a(73289),L=a(66574),V=a(18771),y=a(12352),u=a(4242);function R(){return async t=>{if(L.Vt.hasPermission(V.AccessControlAction.SettingsRead)){t((0,u.uX)());const o=await(0,w.i)().get("/api/admin/settings");return t((0,u.AW)(o)),await t(Z()),t((0,u._E)()),o}}}function Z(){return async t=>{const o=(0,y.getRegisteredAuthProviders)(),i={},l=[];for(const s of o)l.push((0,y.getAuthProviderStatus)(s.id));const d=await Promise.all(l);for(let s=0;s<o.length;s++){const f=o[s],g=d[s];i[f.id]=g}t((0,u.AB)(i))}}function q(t){return async o=>{if(contextSrv.hasPermission(AccessControlAction.SettingsWrite))try{return await lastValueFrom(getBackendSrv().fetch({url:"/api/admin/settings",method:"PUT",data:t,showSuccessAlert:!1,showErrorAlert:!1})),o(resetError()),!0}catch(i){if(console.log(i),isFetchError(i)){i.isHandled=!0;const l={message:i.data?.message,errors:i.data?.errors};return o(setError(l)),!1}}return!1}}function G(t){return x+(t.configPath||t.id)}function O(t){const{isLoading:o,providerStatuses:i}=t.authConfig;return{isLoading:o,providerStatuses:i}}const D={loadSettings:R},J=(0,T.connect)(O,D),$=({providerStatuses:t,isLoading:o,loadSettings:i})=>{const l=(0,m.wW)(M);(0,n.useEffect)(()=>{i()},[i]);const d=(0,y.getRegisteredAuthProviders)(),s=d.filter(e=>t[e.id]?.enabled),f=d.filter(e=>t[e.id]?.configured&&!t[e.id]?.enabled),g=d.filter(e=>!t[e.id]?.enabled&&!t[e.id]?.configured&&!t[e.id]?.hide),c=g?.length?g[0]:null,p=n.createElement("a",{className:"external-link",href:"https://grafana.com/docs/grafana/next/setup-grafana/configure-security/configure-authentication/saml-ui/",target:"_blank",rel:"noopener noreferrer"},"documentation."),C=n.createElement("span",null,"Manage your auth settings and configure single sign-on. Find out more in our ",p),X=()=>{(0,v.ff)("authentication_ui_created",{provider:c?.type})},N=e=>{(0,v.ff)("authentication_ui_provider_clicked",{provider:e.type})};return n.createElement(P.T,{navId:"authentication",subTitle:C},n.createElement(P.T.Contents,{isLoading:o},n.createElement("h3",{className:l.sectionHeader},"Configured authentication"),!!s?.length&&n.createElement("div",{className:l.cardsContainer},s.map(e=>n.createElement(b,{key:e.id,providerId:e.id,displayName:e.displayName,authType:e.type,enabled:t[e.id]?.enabled,configFoundInIniFile:t[e.id]?.configFoundInIniFile,configPath:e.configPath,onClick:()=>N(e)}))),!s?.length&&c&&!(0,S.isEmpty)(t)&&n.createElement(H,{title:`You have no ${c.type} configuration created at the moment`,buttonIcon:"plus-circle",buttonLink:G(c),buttonTitle:`Configure ${c.type}`,description:`Important: if you have ${c.type} configuration enabled via the .ini file Grafana is using it. Configuring ${c.type} via UI will take precedence over any configuration in the .ini file. No changes will be written into .ini file.`,onClick:X}),!!f?.length&&n.createElement("div",{className:l.cardsContainer},f.map(e=>n.createElement(b,{key:e.id,providerId:e.id,displayName:e.displayName,authType:e.protocol,enabled:t[e.id]?.enabled,configFoundInIniFile:t[e.id]?.configFoundInIniFile,configPath:e.configPath,onClick:()=>N(e)})))))},M=t=>({cardsContainer:(0,r.css)` display: grid; grid-template-columns: repeat(auto-fill, minmax(288px, 1fr)); gap: ${t.spacing(3)}; margin-bottom: ${t.spacing(3)}; margin-top: ${t.spacing(2)}; `,sectionHeader:(0,r.css)` margin-bottom: ${t.spacing(3)}; `,settingsSection:(0,r.css)` margin-top: ${t.spacing(4)}; `,settingName:(0,r.css)` padding-left: 25px; `,doclink:(0,r.css)` padding-bottom: 5px; padding-top: -5px; font-size: ${t.typography.bodySmall.fontSize}; a { color: ${t.colors.info.name}; // use theme link color or any other color text-decoration: underline; // underline or none, as you prefer } `,settingValue:(0,r.css)` white-space: break-spaces; `}),Q=J($)}}]); //# sourceMappingURL=AdminAuthentication.920a54880a6bbca62a3d.js.map