You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
27 KiB

import{cr as F,cs as V,c_ as Q,cq as i,cu as O,cv as d,cS as J,cy as g,cz as y,cA as t,cB as n,cw as z,cL as $,cK as h,cC as C,de as T,cG as q,cI as ae,eB as de,cD as W,cE as G,cX as Y,cM as I,cW as ce,cP as le,cZ as re,dm as ue,cH as pe}from"./index-6b91f299.js";import{a as D,p as B}from"./platform-source-78d6c6c0.js";const _e={class:"authentication-setting__main main-calc-height"},me={class:"form-container p-24"},ge={class:"text-right"},fe=F({__name:"LDAP",setup(M){const a=V({id:"",auth_type:"LDAP",config_data:{ldap_server:"",base_dn:"",password:"",ou:"",ldap_filter:"",ldap_mapping:""},is_active:!0}),v=V(),_=V(!1),f=Q({"config_data.ldap_server":[{required:!0,message:i("views.system.authentication.ldap.serverPlaceholder"),trigger:"blur"}],"config_data.base_dn":[{required:!0,message:i("views.system.authentication.ldap.bindDNPlaceholder"),trigger:"blur"}],"config_data.password":[{required:!0,message:i("views.user.userForm.form.password.requiredMessage"),trigger:"blur"}],"config_data.ou":[{required:!0,message:i("views.system.authentication.ldap.ouPlaceholder"),trigger:"blur"}],"config_data.ldap_filter":[{required:!0,message:i("views.system.authentication.ldap.ldap_filterPlaceholder"),trigger:"blur"}],"config_data.ldap_mapping":[{required:!0,message:i("views.system.authentication.ldap.ldap_mappingPlaceholder"),trigger:"blur"}]}),w=async(e,l)=>{e&&await e.validate((u,s)=>{u&&(l?D.postAuthSetting(a.value,_).then(k=>{T(i("views.system.testSuccess"))}):D.putAuthSetting(a.value.auth_type,a.value,_).then(k=>{T(i("common.saveSuccess"))}))})};function r(){D.getAuthSetting(a.value.auth_type,_).then(e=>{e.data&&JSON.stringify(e.data)!=="{}"&&(a.value=e.data,e.data.config_data.ldap_mapping&&(a.value.config_data.ldap_mapping=JSON.stringify(JSON.parse(e.data.config_data.ldap_mapping))))})}return O(()=>{r()}),(e,l)=>{const u=d("el-input"),s=d("el-form-item"),k=d("el-checkbox"),E=d("el-form"),P=d("el-button"),c=d("el-scrollbar"),m=J("loading");return g(),y("div",_e,[t(c,null,{default:n(()=>[z((g(),y("div",me,[t(E,{ref_key:"authFormRef",ref:v,rules:f,model:a.value,"label-position":"top","require-asterisk-position":"right"},{default:n(()=>[t(s,{label:e.$t("views.system.authentication.ldap.address"),prop:"config_data.ldap_server"},{default:n(()=>[t(u,{modelValue:a.value.config_data.ldap_server,"onUpdate:modelValue":l[0]||(l[0]=o=>a.value.config_data.ldap_server=o),placeholder:e.$t("views.system.authentication.ldap.serverPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),t(s,{label:e.$t("views.system.authentication.ldap.bindDN"),prop:"config_data.base_dn"},{default:n(()=>[t(u,{modelValue:a.value.config_data.base_dn,"onUpdate:modelValue":l[1]||(l[1]=o=>a.value.config_data.base_dn=o),placeholder:e.$t("views.system.authentication.ldap.bindDNPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),t(s,{label:e.$t("views.system.password"),prop:"config_data.password"},{default:n(()=>[t(u,{modelValue:a.value.config_data.password,"onUpdate:modelValue":l[2]||(l[2]=o=>a.value.config_data.password=o),placeholder:e.$t("views.user.userForm.form.password.placeholder"),"show-password":""},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),t(s,{label:e.$t("views.system.authentication.ldap.ou"),prop:"config_data.ou"},{default:n(()=>[t(u,{modelValue:a.value.config_data.ou,"onUpdate:modelValue":l[3]||(l[3]=o=>a.value.config_data.ou=o),placeholder:e.$t("views.system.authentication.ldap.ouPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),t(s,{label:e.$t("views.system.authentication.ldap.ldap_filter"),prop:"config_data.ldap_filter"},{default:n(()=>[t(u,{modelValue:a.value.config_data.ldap_filter,"onUpdate:modelValue":l[4]||(l[4]=o=>a.value.config_data.ldap_filter=o),placeholder:e.$t("views.system.authentication.ldap.ldap_filterPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),t(s,{label:e.$t("views.system.authentication.ldap.ldap_mapping"),prop:"config_data.ldap_mapping"},{default:n(()=>[t(u,{modelValue:a.value.config_data.ldap_mapping,"onUpdate:modelValue":l[5]||(l[5]=o=>a.value.config_data.ldap_mapping=o),placeholder:'{"name":"name","email":"mail","username":"cn"}'},null,8,["modelValue"])]),_:1},8,["label"]),t(s,null,{default:n(()=>[t(k,{modelValue:a.value.is_active,"onUpdate:modelValue":l[6]||(l[6]=o=>a.value.is_active=o)},{default:n(()=>[$(h(e.$t("views.system.authentication.ldap.enableAuthentication")),1)]),_:1},8,["modelValue"])]),_:1})]),_:1},8,["rules","model"]),C("div",ge,[t(P,{onClick:l[7]||(l[7]=o=>w(v.value,"test")),disabled:_.value},{default:n(()=>[$(h(e.$t("views.system.test")),1)]),_:1},8,["disabled"]),t(P,{onClick:l[8]||(l[8]=o=>w(v.value)),type:"primary",disabled:_.value},{default:n(()=>[$(h(e.$t("common.save")),1)]),_:1},8,["disabled"])])])),[[m,_.value]])]),_:1})])}}}),he={class:"authentication-setting__main main-calc-height"},ve={class:"form-container p-24"},be={class:"text-right"},ye=F({__name:"CAS",setup(M){const a=V({id:"",auth_type:"CAS",config_data:{ldpUri:"",validateUrl:"",redirectUrl:""},is_active:!0}),v=V(),_=V(!1),f=Q({"config_data.ldpUri":[{required:!0,message:i("views.system.authentication.cas.ldpUriPlaceholder"),trigger:"blur"}],"config_data.validateUrl":[{required:!0,message:i("views.system.authentication.cas.validateUrlPlaceholder"),trigger:"blur"}],"config_data.redirectUrl":[{required:!0,message:i("views.system.authentication.cas.redirectUrlPlaceholder"),trigger:"blur"}]}),w=async e=>{e&&await e.validate((l,u)=>{l&&D.putAuthSetting(a.value.auth_type,a.value,_).then(s=>{T(i("common.saveSuccess"))})})};function r(){D.getAuthSetting(a.value.auth_type,_).then(e=>{e.data&&JSON.stringify(e.data)!=="{}"&&(e.data.config_data.validateUrl||(e.data.config_data.validateUrl=e.data.config_data.ldpUri),a.value=e.data)})}return O(()=>{r()}),(e,l)=>{const u=d("el-input"),s=d("el-form-item"),k=d("el-checkbox"),E=d("el-form"),P=d("el-button"),c=d("el-scrollbar"),m=J("loading");return g(),y("div",he,[t(c,null,{default:n(()=>[z((g(),y("div",ve,[t(E,{ref_key:"authFormRef",ref:v,rules:f,model:a.value,"label-position":"top","require-asterisk-position":"right"},{default:n(()=>[t(s,{label:e.$t("views.system.authentication.cas.ldpUri"),prop:"config_data.ldpUri"},{default:n(()=>[t(u,{modelValue:a.value.config_data.ldpUri,"onUpdate:modelValue":l[0]||(l[0]=o=>a.value.config_data.ldpUri=o),placeholder:e.$t("views.system.authentication.cas.ldpUriPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),t(s,{label:e.$t("views.system.authentication.cas.validateUrl"),prop:"config_data.validateUrl"},{default:n(()=>[t(u,{modelValue:a.value.config_data.validateUrl,"onUpdate:modelValue":l[1]||(l[1]=o=>a.value.config_data.validateUrl=o),placeholder:e.$t("views.system.authentication.cas.validateUrlPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),t(s,{label:e.$t("views.system.authentication.cas.redirectUrl"),prop:"config_data.redirectUrl"},{default:n(()=>[t(u,{modelValue:a.value.config_data.redirectUrl,"onUpdate:modelValue":l[2]||(l[2]=o=>a.value.config_data.redirectUrl=o),placeholder:e.$t("views.system.authentication.cas.redirectUrlPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),t(s,null,{default:n(()=>[t(k,{modelValue:a.value.is_active,"onUpdate:modelValue":l[3]||(l[3]=o=>a.value.is_active=o)},{default:n(()=>[$(h(e.$t("views.system.authentication.cas.enableAuthentication")),1)]),_:1},8,["modelValue"])]),_:1})]),_:1},8,["rules","model"]),C("div",be,[t(P,{onClick:l[4]||(l[4]=o=>w(v.value)),type:"primary",disabled:_.value},{default:n(()=>[$(h(e.$t("common.save")),1)]),_:1},8,["disabled"])])])),[[m,_.value]])]),_:1})])}}}),we={class:"authentication-setting__main main-calc-height"},ke={class:"form-container p-24"},Ve={class:"text-right"},$e=F({__name:"OIDC",setup(M){const a=V({id:"",auth_type:"OIDC",config_data:{authEndpoint:"",tokenEndpoint:"",userInfoEndpoint:"",clientId:"",clientSecret:"",redirectUrl:""},is_active:!0}),v=V(),_=V(!1),f=Q({"config_data.authEndpoint":[{required:!0,message:i("views.system.authentication.oidc.authEndpointPlaceholder"),trigger:"blur"}],"config_data.tokenEndpoint":[{required:!0,message:i("views.system.authentication.oidc.tokenEndpointPlaceholder"),trigger:"blur"}],"config_data.userInfoEndpoint":[{required:!0,message:i("views.system.authentication.oidc.userInfoEndpointPlaceholder"),trigger:"blur"}],"config_data.clientId":[{required:!0,message:i("views.system.authentication.oidc.clientIdPlaceholder"),trigger:"blur"}],"config_data.clientSecret":[{required:!0,message:i("views.system.authentication.oidc.clientSecretPlaceholder"),trigger:"blur"}],"config_data.redirectUrl":[{required:!0,message:i("views.system.authentication.oidc.redirectUrlPlaceholder"),trigger:"blur"}],"config_data.logoutEndpoint":[{required:!0,message:i("views.system.authentication.oidc.logoutEndpointPlaceholder"),trigger:"blur"}]}),w=async(e,l)=>{e&&await e.validate((u,s)=>{u&&D.putAuthSetting(a.value.auth_type,a.value,_).then(k=>{T(i("common.saveSuccess"))})})};function r(){D.getAuthSetting(a.value.auth_type,_).then(e=>{e.data&&JSON.stringify(e.data)!=="{}"&&(a.value=e.data)})}return O(()=>{r()}),(e,l)=>{const u=d("el-input"),s=d("el-form-item"),k=d("el-checkbox"),E=d("el-form"),P=d("el-button"),c=d("el-scrollbar"),m=J("loading");return g(),y("div",we,[t(c,null,{default:n(()=>[z((g(),y("div",ke,[t(E,{ref_key:"authFormRef",ref:v,rules:f,model:a.value,"label-position":"top","require-asterisk-position":"right"},{default:n(()=>[t(s,{label:e.$t("views.system.authentication.oidc.authEndpoint"),prop:"config_data.authEndpoint"},{default:n(()=>[t(u,{modelValue:a.value.config_data.authEndpoint,"onUpdate:modelValue":l[0]||(l[0]=o=>a.value.config_data.authEndpoint=o),placeholder:e.$t("views.system.authentication.oidc.authEndpointPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),t(s,{label:e.$t("views.system.authentication.oidc.tokenEndpoint"),prop:"config_data.tokenEndpoint"},{default:n(()=>[t(u,{modelValue:a.value.config_data.tokenEndpoint,"onUpdate:modelValue":l[1]||(l[1]=o=>a.value.config_data.tokenEndpoint=o),placeholder:e.$t("views.system.authentication.oidc.tokenEndpointPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),t(s,{label:e.$t("views.system.authentication.oidc.userInfoEndpoint"),prop:"config_data.userInfoEndpoint"},{default:n(()=>[t(u,{modelValue:a.value.config_data.userInfoEndpoint,"onUpdate:modelValue":l[2]||(l[2]=o=>a.value.config_data.userInfoEndpoint=o),placeholder:e.$t("views.system.authentication.oidc.userInfoEndpointPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),t(s,{label:e.$t("views.system.authentication.oidc.clientId"),prop:"config_data.clientId"},{default:n(()=>[t(u,{modelValue:a.value.config_data.clientId,"onUpdate:modelValue":l[3]||(l[3]=o=>a.value.config_data.clientId=o),placeholder:e.$t("views.system.authentication.oidc.clientIdPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),t(s,{label:e.$t("views.system.authentication.oidc.clientSecret"),prop:"config_data.clientSecret"},{default:n(()=>[t(u,{modelValue:a.value.config_data.clientSecret,"onUpdate:modelValue":l[4]||(l[4]=o=>a.value.config_data.clientSecret=o),placeholder:e.$t("views.system.authentication.oidc.clientSecretPlaceholder"),"show-password":""},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),t(s,{label:e.$t("views.system.authentication.oidc.redirectUrl"),prop:"config_data.redirectUrl"},{default:n(()=>[t(u,{modelValue:a.value.config_data.redirectUrl,"onUpdate:modelValue":l[5]||(l[5]=o=>a.value.config_data.redirectUrl=o),placeholder:e.$t("views.system.authentication.oidc.redirectUrlPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),t(s,null,{default:n(()=>[t(k,{modelValue:a.value.is_active,"onUpdate:modelValue":l[6]||(l[6]=o=>a.value.is_active=o)},{default:n(()=>[$(h(e.$t("views.system.authentication.oidc.enableAuthentication")),1)]),_:1},8,["modelValue"])]),_:1})]),_:1},8,["rules","model"]),C("div",Ve,[t(P,{onClick:l[7]||(l[7]=o=>w(v.value)),type:"primary",disabled:_.value},{default:n(()=>[$(h(e.$t("common.save")),1)]),_:1},8,["disabled"])])])),[[m,_.value]])]),_:1})])}}}),Ue="/ui/assets/logo_dingtalk-ba6ce262.svg",Ce="/ui/assets/logo_lark-040c9608.svg",Pe="/ui/assets/logo_wechat-work-74043648.svg",Se="/ui/assets/logo_wechat-8623e982.svg",Ee={class:"flex align-center",style:{"margin-left":"-8px"}},Ae={class:"dialog-footer"},Ie=F({__name:"EditModal",emits:["refresh"],setup(M,{expose:a,emit:v}){const _=V(!1),f=V(!1),w=V(),r=Q({key:"",logoSrc:"",name:"",isActive:!1,isValid:!1,config:{}}),e=p=>({corp_id:"Corp ID",app_key:(r==null?void 0:r.key)!="lark"?"APP Key":"App ID",app_secret:"APP Secret",agent_id:"Agent ID",callback_url:i("views.application.applicationAccess.callback")})[p]||(p?p.charAt(0).toUpperCase()+p.slice(1):""),l=p=>{switch(p){case"app_key":return[{required:!0,message:i("views.system.authentication.scanTheQRCode.appKeyPlaceholder"),trigger:["blur","change"]}];case"app_secret":return[{required:!0,message:i("views.system.authentication.scanTheQRCode.appSecretPlaceholder"),trigger:["blur","change"]}];case"corp_id":return[{required:!0,message:i("views.system.authentication.scanTheQRCode.corpIdPlaceholder"),trigger:["blur","change"]}];case"agent_id":return[{required:!0,message:i("views.system.authentication.scanTheQRCode.agentIdPlaceholder"),trigger:["blur","change"]}];case"callback_url":return[{required:!0,message:i("views.application.applicationAccess.callbackTip"),trigger:["blur","change"]},{pattern:/^https?:\/\/.+/,message:i("views.system.authentication.scanTheQRCode.callbackWarning"),trigger:["blur","change"]}];default:return[]}};a({open:async p=>{var N;_.value=!0,f.value=!0,Object.assign(r,p);let U=window.location.origin;switch(p.key){case"wecom":r.config.app_key&&(r.config.agent_id=r.config.app_key,delete r.config.app_key),r.config.callback_url=`${U}/api/wecom`;break;case"dingtalk":r.config.agent_id&&(r.config.corp_id=r.config.agent_id,delete r.config.agent_id),r.config={corp_id:r.config.corp_id,app_key:r.config.app_key,app_secret:r.config.app_secret,callback_url:U};break;case"lark":r.config.callback_url=`${U}/api/feishu`;break}(N=w.value)==null||N.clearValidate()}});const s=()=>{var p;(p=w.value)==null||p.validate(U=>{U?o():Y(i("views.system.authentication.scanTheQRCode.validateFailedTip"))})},k=()=>{var p;_.value=!1,(p=w.value)==null||p.clearValidate(),m("refresh")};function E(){B.validateConnection(r,f).then(p=>{p.data?T(i("views.system.authentication.scanTheQRCode.validateSuccess")):Y(i("views.system.authentication.scanTheQRCode.validateFailed"))})}const P=new Set(["app_secret","client_secret","secret"]),c=p=>P.has(p),m=v;function o(){B.updateConfig(r,f).then(p=>{var U;T(i("common.saveSuccess")),m("refresh"),_.value=!1,(U=w.value)==null||U.clearValidate()})}return(p,U)=>{const N=d("el-input"),K=d("el-form-item"),L=d("el-button"),j=d("el-drawer");return g(),q(j,{modelValue:_.value,"onUpdate:modelValue":U[0]||(U[0]=H=>_.value=H),size:"60%","append-to-body":!0,"destroy-on-close":!0,onClose:k},{header:n(()=>[C("div",Ee,[C("h4",null,h(r.name+p.$t("views.system.authentication.scanTheQRCode.setting")),1)])]),footer:n(()=>[C("span",Ae,[t(L,{onClick:k},{default:n(()=>[$(h(p.$t("common.cancel")),1)]),_:1}),t(L,{onClick:E},{default:n(()=>[$(h(p.$t("views.system.authentication.scanTheQRCode.validate")),1)]),_:1}),t(L,{type:"primary",onClick:s},{default:n(()=>[$(h(p.$t("common.save")),1)]),_:1})])]),default:n(()=>[t(ae(de),{model:r.config,"label-width":"120px","label-position":"top","require-asterisk-position":"right",ref_key:"formRef",ref:w},{default:n(()=>[(g(!0),y(W,null,G(r.config,(H,A)=>(g(),q(K,{key:A,label:e(A),prop:A,rules:l(A)},{default:n(()=>[t(N,{modelValue:r.config[A],"onUpdate:modelValue":X=>r.config[A]=X,type:c(A)?"password":"text","show-password":c(A)},null,8,["modelValue","onUpdate:modelValue","type","show-password"])]),_:2},1032,["label","prop","rules"]))),128))]),_:1},8,["model"])]),_:1},8,["modelValue"])}}}),Re={class:"scan-height"},qe={class:"flex-between"},De={class:"flex align-center"},Te=["src"],Ne={class:"ml-8"},Qe={key:1},Fe={class:"mr-4"},Me={key:0,class:"border-t mt-16"},Oe={class:"mt-4 mb-16 flex align-center"},Le={key:0,class:"vertical-middle lighter break-all ellipsis-1"},Be={key:1,class:"vertical-middle lighter break-all ellipsis-1"},Je={key:2,class:"vertical-middle lighter break-all ellipsis-1"},ze=F({__name:"SCAN",setup(M){const a=V(),v=V(!1),_=Q(w()),f=Q({});O(()=>{l()});function w(){return[r("wecom",i("views.system.authentication.scanTheQRCode.wecom")),r("dingtalk",i("views.system.authentication.scanTheQRCode.dingtalk")),r("lark",i("views.system.authentication.scanTheQRCode.lark"))]}function r(c,m){let o="";switch(c){case"wecom":o="wechat-work";break;case"dingtalk":o="dingtalk";break;case"lark":o="lark";break;default:o="";break}const p={...c==="wecom"?{corp_id:"",agent_id:""}:{app_key:""},app_secret:"",callback_url:""};return{key:c,logoSrc:new URL(Object.assign({"../../../assets/logo_dingtalk.svg":Ue,"../../../assets/logo_lark.svg":Ce,"../../../assets/logo_wechat-work.svg":Pe,"../../../assets/logo_wechat.svg":Se})[`../../../assets/logo_${o}.svg`],self.location).href,name:m,isActive:!1,isValid:!1,config:p}}function e(c,m){return{corp_id:"Corp ID",app_key:(m==null?void 0:m.key)!="lark"?"APP Key":"App ID",app_secret:"APP Secret",agent_id:"Agent ID",callback_url:i("views.application.applicationAccess.callback")}[c]||(c?c.charAt(0).toUpperCase()+c.slice(1):"")}function l(){v.value=!0,B.getPlatformInfo(v).then(c=>{c&&_.forEach(m=>{const o=c.data.find(p=>p.platform===m.key);if(o){if(Object.assign(m,{isValid:o.is_valid,isActive:o.is_active,config:o.config}),m.key==="dingtalk"){const{corp_id:p,app_key:U,app_secret:N}=m.config;m.config={corp_id:p,app_key:U,app_secret:N,callback_url:m.config.callback_url}}f[m.key]={},f[m.key].app_secret=!1}})})}function u(c){B.validateConnection(c,v).then(m=>{m.data?T(i("views.system.authentication.scanTheQRCode.validateSuccess")):Y(i("views.system.authentication.scanTheQRCode.validateFailed"))})}function s(){l()}function k(c){B.updateConfig(c,v).then(m=>{T(i("common.saveSuccess"))})}function E(c){f[c]||(f[c]={}),f[c].app_secret=!f[c].app_secret}function P(c){var m;(m=a.value)==null||m.open(c)}return(c,m)=>{const o=d("el-tag"),p=d("el-button"),U=d("el-switch"),N=d("el-text"),K=d("AppIcon"),L=d("Hide"),j=d("el-icon"),H=d("View"),A=d("el-col"),X=d("el-row"),oe=d("el-collapse-transition"),ne=d("el-card"),ie=d("el-scrollbar"),se=J("loading");return z((g(),y("div",Re,[t(ie,null,{default:n(()=>[(g(!0),y(W,null,G(_,b=>(g(),y("div",{key:b.key,class:"mb-16"},[t(ne,{class:"border-none mb-16",shadow:"none"},{default:n(()=>[C("div",qe,[C("div",De,[C("img",{src:b.logoSrc,alt:"",width:"24px"},null,8,Te),C("h5",Ne,h(b.name),1),b.isValid?(g(),q(o,{key:0,type:"success",class:"ml-8"},{default:n(()=>[$(h(c.$t("views.system.authentication.scanTheQRCode.effective")),1)]),_:1})):I("",!0)]),C("div",null,[b.isValid?I("",!0):(g(),q(p,{key:0,type:"primary",onClick:R=>P(b)},{default:n(()=>[$(h(c.$t("views.system.authentication.scanTheQRCode.access")),1)]),_:2},1032,["onClick"])),b.isValid?(g(),y("span",Qe,[C("span",Fe,h(b.isActive?c.$t("views.system.authentication.scanTheQRCode.alreadyTurnedOn"):c.$t("views.system.authentication.scanTheQRCode.notEnabled")),1),t(U,{size:"small",modelValue:b.isActive,"onUpdate:modelValue":R=>b.isActive=R,disabled:!b.isValid,onChange:R=>k(b)},null,8,["modelValue","onUpdate:modelValue","disabled","onChange"])])):I("",!0)])]),t(oe,null,{default:n(()=>[b.isValid?(g(),y("div",Me,[t(X,{gutter:12,class:"mt-16"},{default:n(()=>[(g(!0),y(W,null,G(b.config,(R,S)=>(g(),q(A,{key:S,span:12},{default:n(()=>{var x,ee;return[t(N,{type:"info"},{default:n(()=>[$(h(e(S,b)),1)]),_:2},1024),C("div",Oe,[S!=="app_secret"?(g(),y("span",Le,h(R),1)):I("",!0),S==="app_secret"&&!((x=f[b.key])!=null&&x[S])?(g(),y("span",Be,"************")):I("",!0),S==="app_secret"&&((ee=f[b.key])!=null&&ee[S])?(g(),y("span",Je,h(R),1)):I("",!0),t(p,{type:"primary",text:"",onClick:()=>ae(ce)(R)},{default:n(()=>[t(K,{iconName:"app-copy"})]),_:2},1032,["onClick"]),S==="app_secret"?(g(),q(p,{key:3,type:"primary",text:"",onClick:Z=>E(b.key)},{default:n(()=>{var Z,te;return[S==="app_secret"&&!((Z=f[b.key])!=null&&Z[S])?(g(),q(j,{key:0},{default:n(()=>[t(L)]),_:1})):I("",!0),S==="app_secret"&&((te=f[b.key])!=null&&te[S])?(g(),q(j,{key:1},{default:n(()=>[t(H)]),_:1})):I("",!0)]}),_:2},1032,["onClick"])):I("",!0)])]}),_:2},1024))),128))]),_:2},1024),t(p,{type:"primary",onClick:R=>P(b)},{default:n(()=>[$(h(c.$t("common.edit")),1)]),_:2},1032,["onClick"]),t(p,{onClick:R=>u(b)},{default:n(()=>[$(h(c.$t("views.system.authentication.scanTheQRCode.validate")),1)]),_:2},1032,["onClick"])])):I("",!0)]),_:2},1024)]),_:2},1024)]))),128)),t(Ie,{ref_key:"EditModelRef",ref:a,onRefresh:s},null,512)]),_:1})])),[[se,v.value]])}}});const je=le(ze,[["__scopeId","data-v-001ab2e6"]]),He={class:"authentication-setting__main main-calc-height"},We={class:"form-container p-24"},Ge={class:"text-right"},Ke=F({__name:"OAuth2",setup(M){const a=V({id:"",auth_type:"OAuth2",config_data:{authEndpoint:"",tokenEndpoint:"",userInfoEndpoint:"",scope:"",clientId:"",clientSecret:"",redirectUrl:"",fieldMapping:""},is_active:!0}),v=V(),_=V(!1),f=Q({"config_data.authEndpoint":[{required:!0,message:i("views.system.authentication.oauth2.authEndpointPlaceholder"),trigger:"blur"}],"config_data.tokenEndpoint":[{required:!0,message:i("views.system.authentication.oauth2.tokenEndpointPlaceholder"),trigger:"blur"}],"config_data.userInfoEndpoint":[{required:!0,message:i("views.system.authentication.oauth2.userInfoEndpointPlaceholder"),trigger:"blur"}],"config_data.scope":[{required:!0,message:i("views.system.authentication.oauth2.scopePlaceholder"),trigger:"blur"}],"config_data.clientId":[{required:!0,message:i("views.system.authentication.oauth2.clientIdPlaceholder"),trigger:"blur"}],"config_data.clientSecret":[{required:!0,message:i("views.system.authentication.oauth2.clientSecretPlaceholder"),trigger:"blur"}],"config_data.redirectUrl":[{required:!0,message:i("views.system.authentication.oauth2.redirectUrlPlaceholder"),trigger:"blur"}],"config_data.fieldMapping":[{required:!0,message:i("views.system.authentication.oauth2.filedMappingPlaceholder"),trigger:"blur"}]}),w=async(e,l)=>{e&&await e.validate((u,s)=>{u&&D.putAuthSetting(a.value.auth_type,a.value,_).then(k=>{T(i("common.saveSuccess"))})})};function r(){D.getAuthSetting(a.value.auth_type,_).then(e=>{e.data&&JSON.stringify(e.data)!=="{}"&&(a.value=e.data)})}return O(()=>{r()}),(e,l)=>{const u=d("el-input"),s=d("el-form-item"),k=d("el-checkbox"),E=d("el-form"),P=d("el-button"),c=d("el-scrollbar"),m=J("loading");return g(),y("div",He,[t(c,null,{default:n(()=>[z((g(),y("div",We,[t(E,{ref_key:"authFormRef",ref:v,rules:f,model:a.value,"label-position":"top","require-asterisk-position":"right"},{default:n(()=>[t(s,{label:e.$t("views.system.authentication.oauth2.authEndpoint"),prop:"config_data.authEndpoint"},{default:n(()=>[t(u,{modelValue:a.value.config_data.authEndpoint,"onUpdate:modelValue":l[0]||(l[0]=o=>a.value.config_data.authEndpoint=o),placeholder:e.$t("views.system.authentication.oauth2.authEndpointPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),t(s,{label:e.$t("views.system.authentication.oauth2.tokenEndpoint"),prop:"config_data.tokenEndpoint"},{default:n(()=>[t(u,{modelValue:a.value.config_data.tokenEndpoint,"onUpdate:modelValue":l[1]||(l[1]=o=>a.value.config_data.tokenEndpoint=o),placeholder:e.$t("views.system.authentication.oauth2.tokenEndpointPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),t(s,{label:e.$t("views.system.authentication.oauth2.userInfoEndpoint"),prop:"config_data.userInfoEndpoint"},{default:n(()=>[t(u,{modelValue:a.value.config_data.userInfoEndpoint,"onUpdate:modelValue":l[2]||(l[2]=o=>a.value.config_data.userInfoEndpoint=o),placeholder:e.$t("views.system.authentication.oauth2.userInfoEndpointPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),t(s,{label:e.$t("views.system.authentication.oauth2.scope"),prop:"config_data.scope"},{default:n(()=>[t(u,{modelValue:a.value.config_data.scope,"onUpdate:modelValue":l[3]||(l[3]=o=>a.value.config_data.scope=o),placeholder:e.$t("views.system.authentication.oauth2.scopePlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),t(s,{label:e.$t("views.system.authentication.oauth2.clientId"),prop:"config_data.clientId"},{default:n(()=>[t(u,{modelValue:a.value.config_data.clientId,"onUpdate:modelValue":l[4]||(l[4]=o=>a.value.config_data.clientId=o),placeholder:e.$t("views.system.authentication.oauth2.clientIdPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),t(s,{label:e.$t("views.system.authentication.oauth2.clientSecret"),prop:"config_data.clientSecret"},{default:n(()=>[t(u,{modelValue:a.value.config_data.clientSecret,"onUpdate:modelValue":l[5]||(l[5]=o=>a.value.config_data.clientSecret=o),placeholder:e.$t("views.system.authentication.oauth2.clientSecretPlaceholder"),"show-password":""},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),t(s,{label:e.$t("views.system.authentication.oauth2.redirectUrl"),prop:"config_data.redirectUrl"},{default:n(()=>[t(u,{modelValue:a.value.config_data.redirectUrl,"onUpdate:modelValue":l[6]||(l[6]=o=>a.value.config_data.redirectUrl=o),placeholder:e.$t("views.system.authentication.oauth2.redirectUrlPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),t(s,{label:e.$t("views.system.authentication.oauth2.filedMapping"),prop:"config_data.fieldMapping"},{default:n(()=>[t(u,{modelValue:a.value.config_data.fieldMapping,"onUpdate:modelValue":l[7]||(l[7]=o=>a.value.config_data.fieldMapping=o),placeholder:e.$t("views.system.authentication.oauth2.filedMappingPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),t(s,null,{default:n(()=>[t(k,{modelValue:a.value.is_active,"onUpdate:modelValue":l[8]||(l[8]=o=>a.value.is_active=o)},{default:n(()=>[$(h(e.$t("views.system.authentication.oauth2.enableAuthentication")),1)]),_:1},8,["modelValue"])]),_:1})]),_:1},8,["rules","model"]),C("div",Ge,[t(P,{onClick:l[9]||(l[9]=o=>w(v.value)),type:"primary",disabled:_.value},{default:n(()=>[$(h(e.$t("common.save")),1)]),_:1},8,["disabled"])])])),[[m,_.value]])]),_:1})])}}}),Xe={class:"authentication-setting p-16-24"},Ze=F({__name:"index",setup(M){const{user:a}=re(),v=ue(),_=V("LDAP"),f=[{label:i("views.system.authentication.ldap.title"),name:"LDAP",component:fe},{label:i("views.system.authentication.cas.title"),name:"CAS",component:ye},{label:i("views.system.authentication.oidc.title"),name:"OIDC",component:$e},{label:i("views.system.authentication.oauth2.title"),name:"OAuth2",component:Ke},{label:i("views.system.authentication.scanTheQRCode.title"),name:"SCAN",component:je}];function w(){}return O(()=>{a.isExpire()&&v.push({path:"/application"})}),(r,e)=>{const l=d("el-tab-pane"),u=d("el-tabs");return g(),y("div",Xe,[C("h4",null,h(r.$t("views.system.authentication.title")),1),t(u,{modelValue:_.value,"onUpdate:modelValue":e[0]||(e[0]=s=>_.value=s),class:"mt-4",onTabClick:w},{default:n(()=>[(g(),y(W,null,G(f,(s,k)=>t(l,{key:k,label:s.label,name:s.name},{default:n(()=>[(g(),q(pe(s.component)))]),_:2},1032,["label","name"])),64))]),_:1},8,["modelValue"])])}}});const et=le(Ze,[["__scopeId","data-v-719ed3c4"]]);export{et as default};