1import{t}from"./_plugin-vue_export-helper-BWo4d3c0.js";import{C as s,D as a,E as e,J as i,N as n,O as l,Pt as o,Qt as r,S as d,W as u,X as h,at as c,b as p,g as S,x as g}from"./@vuepic/vue-datepicker-Bh7MiwqO.js";import{i as m}from"./axiosRetry-CxUOTDw3.js";import{S as f}from"./Enum-B5Agrs9-.js";import{t as y}from"./RoundedButton-CvwmDNkp.js";import{n as v}from"./InputTextField-_pENQ0G6.js";import{t as _}from"./AppInput-Bhk_lXoE.js";import{t as b}from"./AppSelect-DAP3HR2q.js";import{d as P}from"./functionOption-DiwjrLjQ.js";import{I as w,Qt as k,st as C}from"./index-D5_3PXIH.js";import{t as O}from"./icon_content-paste-D66AHzLg.js";import{t as E}from"./ManagementPageContainer-BYEUxtdk.js";import"./ManagementPageContainer-D3Q9KTX8.js";import{t as $}from"./AppToggleSwitch-C1Xk1FzI.js";import{t as U}from"./FileSelector-bsqq-qXJ.js";var I="Google Workspace",x="Azure AD",F="text/xml";n();var A=l({name:"SSOAuthentication",components:{ManagementPageContainer:E,AppToggleSwitch:$,RoundedButton:y,FileSelector:U,AppSelect:b,AppInput:_,AppFormLabel:v},data(){return{ssoFlag:!1,ssoStatus:"disabled",isSSOEnabled:!1,endPointUrl:"",signoutUrl:"",idProvider:x,idProviderOptions:[{value:x,label:this.$t("sso.hasPlan.idProviderOptions.metaDataUrl")},{value:I,label:this.$t("sso.hasPlan.idProviderOptions.metaDataFile")}],ssoSettingInfo:{entity_id:"",acs_url:"",idp_info:{provider_name:"",metadata_url:"",metadata_filename:"",metadata_file:"",signout_url:void 0}},fileName:"",file:null}},computed:{currentUser(){return this.$store.getters["auth/currentUser"]},isSSOPlan(){return this.currentUser.contract_plan.sso_login_available},isSSOOption(){return!!this.currentUser.company_options&&this.currentUser.company_options.some((t=>t.option.kind===P.SSO))},isProviderAzure(){return this.idProvider===x},isSSOStatusDisabled(){return"disabled"===this.ssoStatus},isSSOStatusEditing(){return"editing"===this.ssoStatus},isSSOStatusEnabled(){return"enabled"===this.ssoStatus},samlSetting(){return[{label:this.$t("sso.hasPlan.entityID"),url:this.ssoSettingInfo.entity_id},{label:this.$t("sso.hasPlan.responseUrl"),url:this.ssoSettingInfo.acs_url}]}},watch:{$route:{async handler(){await this.$store.dispatch("auth/getCurrentLoginUser")},immediate:!0}},async created(){(this.isSSOPlan||this.isSSOOption)&&(await this.getFlag(),this.initializePage())},methods:{handleFileUpload(t){t?.name&&(this.fileName=t?.name),this.file=t}
1,async initializePage(){await this.getSettingInfo(),this.ssoFlag?(this.isSSOEnabled=!0,this.ssoStatus="enabled"):this.ssoStatus="disabled"},handleIsSSOEnabled(t){this.isSSOEnabled=t},async getFlag(){try{const t=await m.workspace.allow_sso.get();this.ssoFlag=t.body.allow_sso}catch(t){throw console.error(t),t}},async getSettingInfo(){try{const t=await m.workspace.sso_settings_info.get();this.ssoSettingInfo=t.body,this.signoutUrl=this.ssoSettingInfo.idp_info.signout_url,this.endPointUrl=this.ssoSettingInfo.idp_info.metadata_url,this.endPointUrl?(this.idProvider=x,this.fileName=""):(this.idProvider=I,this.fileName=this.ssoSettingInfo.idp_info.metadata_filename,this.file=this.createFileFromMetafile(this.ssoSettingInfo.idp_info.metadata_file))}catch(t){console.error(t)}},createFileFromMetafile(t){if(!t)return null;const s=new Blob([t],{type:F});return new File([s],this.fileName||"metadata.xml",{type:F})},async handleClickEdit(){await this.getSettingInfo(),this.ssoStatus="editing"},handleClickCancel(){this.isSSOEnabled=this.ssoFlag,this.initializePage()},async registerIdentityProvider(){this.idProvider===I?this.file&&await m.workspace.register_identity_provider.post({body:{metadata_file:this.file,signout_url:this.signoutUrl}}):await m.workspace.register_identity_provider.post({body:{metadata_url:this.endPointUrl??"",signout_url:this.signoutUrl}})},async enableSSO(){try{await this.registerIdentityProvider(),await m.workspace.allow_sso.put({body:{allow_sso:this.isSSOEnabled}}),this.getSettingInfo(),this.ssoStatus="enabled"}catch(t){this.hanldeUploadError(t)}},async disableSSO(){try{await m.workspace.allow_sso.put({body:{allow_sso:this.isSSOEnabled}}),this.ssoStatus="disabled"}catch(t){await k(this.$i18n,t)}},async handleClickSave(){this.isSSOEnabled?await this.enableSSO():await this.disableSSO(),await this.getFlag()},showAlertWithToast(t){this.$store.dispatch("toast/addDangerMessage",{title:t})},hanldeUploadError(t){switch(t.response.data.error){case"IDP already exists in user pool":return void this.showAlertWithToast(this.$t("sso.error.metaDataUpload.idpExists"));case"Metadata is empty":return void this.showAlertWithToast(this.$t("sso.error.metaDataUpload.empty"));case"Invalid XML":return void this.showAlertWithToast(this.$t("sso.error.metaDataUpload.invalid"));default:return void k(this.$i18n,t)}},async onCopyClick(t){try{await C(t),this.$store.dispatch("toast/addSuccessMessage",{title:this.$t("sso.alert.copy")})}catch(s){console.error(s)}},onClickSupportPage(){window.open(f.PaidContact,"_blank","noreferrer")}}});o(),n();var V={key:0,class:"has-plan p--6"},j={class:"has-plan__header"},B={class:"has-plan__body"},M={key:0},D={class:"my--6"},H={key:1},T={class:"sso-table my--4"},N={key:0},z={key:1},L={key:0},W={key:0},Z={key:1},q={key:0},R={key:1,class:"ellipsis"},J={key:2},Q={key:0},X={class:"flex items-center"},G={class:"ml--2"},K={class:"file-upload-hint"},Y={key:1},tt={key:3},st={key:0},at={key:1,class:"ellipsis"},et={key:0,class:"has-plan__btn-layout"},it={key:1},nt={key:2,class:"has-plan__warning"},lt={class:"has-plan__header"},ot={class:"sso-table saml-setting my--4"},rt=["onClick"],dt={key:1,class:"no-plan"};var ut=t(A,[["render",function(t,n,l,o,m,f){const y=h("rounded-button"),v=h("app-toggle-switch"),_=h("app-form-label"),b=h("app-select"),P=h("app-input"),w=h("file-selector"),k=h("management-page-container");return u(),g(k,{class:"page"},{default:c((()=>[t.isSSOPlan||t.isSSOOption?(u(),s("div",V,[p("div",j,r(t.$t("sso.hasPlan.title")),1),p("div",B,[t.isSSOStatusDisabled?(u(),s("div",M,[p("p",D,[e(r(t.$t("sso.hasPlan.ssoAuthentication.title"))+" ",1),p("strong",null,r(t.$t("sso.hasPlan.ssoAuthentication.switch.disabled")),1)]),a(y,{variant:"primary",tracking:"sso-sso.hasPlan.changeBtn-unset",onClick:n[0]||(n[0]=s=>t.ssoStatus="editing")},{default:c((()=>[e(r(t.$t("sso.hasPlan.changeBtn")),1)])),_:1})])):(u(),s("div",H,[p("table",T,[p("tr",null,[p("td",null,r(t.$t("sso.hasPlan.ssoAuthentication.title")),1),p("td",null,[t.isSSOStatusEditing?(u(),s("div",N,[a(v,{modelValue:t.isSSOEnabled,"onUpdate:modelValue":n[1]||(n[1]=s=>t.isSSOEnabled=s),class:"toggle-switch","on-text":t.$t("sso.hasPlan.ssoAuthentication.switch.enabled"),"off-text":t.$t("sso.hasPlan.ssoAuthentication.switch.disabled"),"on-change":t.handleIsSSOEnabled},null,8,["modelValue","on-text","off-text","on-change"])])):d("",!0),t.isSSOStatusEnabled?(u(),s("div",z,[p("strong",null,r(t.$t("sso.hasPlan.ssoAuthentication.switch.enabled")),1)])):d("",!0)])]),t.isSSOEnabled?(u(),s(S,{key:0},[t.isSSOStatusEnabled?d("",!0):(u(),s("tr",L,[p("td",null,[a(_,{required:"","input-style":{"font-weight":"400"}},{default:c((()=>[e(r(t.$t("sso.hasPlan.idProvider")),1)])),_:1})]),p("td",null,[t.isSSOStatusEditing?(u(),s("div",W,[a(b,{modelValue:t.idProvider,"onUpdate:modelValue":n[2]||(n[2]=s=>t.idProvider=s),options:t.idProviderOptions,class:"sso-table__select"},null,8,["modelValue","options"])])):d("",!0)])])),t.isProviderAzure?(u(),s("tr",Z,[p("td",null,[t.isSSOStatusEditing?(u(),g(_,{key:0,required:"","input-style":{"font-weight":"400"}},{default:c((()=>[e(r(t.$t("sso.hasPlan.endPointUrl")),1)])),_:1})):(u(),s(S,{key:1},[e(r(t.$t("sso.hasPlan.endPointUrl")),1)],64))]),p("td",null,[t.isSSOStatusEditing?(u(),s("div",q,[a(P,{modelValue:t.endPointUrl,"onUpdate:modelValue":n[3]||(n[3]=s=>t.endPointUrl=s),type:"text"},null,8,["modelValue"])])):d("",!0),t.isSSOStatusEnabled?(u(),s("div",R,[p("strong",null,r(t.ssoSett
1ingInfo.idp_info.metadata_url),1)])):d("",!0)])])):(u(),s("tr",J,[p("td",null,[t.isSSOStatusEditing?(u(),g(_,{key:0,required:"","input-style":{"font-weight":"400"}},{default:c((()=>[e(r(t.$t("sso.hasPlan.metaFile.title")),1)])),_:1})):(u(),s(S,{key:1},[e(r(t.$t("sso.hasPlan.metaFile.title")),1)],64))]),p("td",null,[t.isSSOStatusEditing?(u(),s("div",Q,[p("div",X,[a(w,{"accept-types":[".xml"],onChange:t.handleFileUpload},null,8,["onChange"]),p("span",G,r(t.fileName),1)]),p("p",K,r(t.$t("sso.hasPlan.metaFile.hint")),1)])):d("",!0),t.isSSOStatusEnabled?(u(),s("div",Y,[p("strong",null,r(t.$t("sso.hasPlan.metaFile.status")),1)])):d("",!0)])])),t.isSSOStatusEditing||t.signoutUrl?(u(),s("tr",tt,[p("td",null,r(t.$t("sso.hasPlan.signoutUrl")),1),p("td",null,[t.isSSOStatusEditing?(u(),s("div",st,[a(P,{modelValue:t.signoutUrl,"onUpdate:modelValue":n[4]||(n[4]=s=>t.signoutUrl=s),type:"text"},null,8,["modelValue"])])):d("",!0),t.isSSOStatusEnabled?(u(),s("div",at,[p("strong",null,r(t.ssoSettingInfo.idp_info.signout_url),1)])):d("",!0)])])):d("",!0)],64)):d("",!0)]),t.isSSOStatusEditing?(u(),s("div",et,[a(y,{variant:"secondary",onClick:t.handleClickCancel},{default:c((()=>[e(r(t.$t("sso.hasPlan.cancelBtn")),1)])),_:1},8,["onClick"]),a(y,{variant:"primary",tracking:"sso-sso.hasPlan.saveBtn",onClick:t.handleClickSave},{default:c((()=>[e(r(t.$t("sso.hasPlan.saveBtn")),1)])),_:1},8,["onClick"])])):d("",!0),t.isSSOStatusEnabled?(u(),s("div",it,[a(y,{variant:"primary",tracking:"sso-sso.hasPlan.changeBtn-set",class:"mb--10",onClick:t.handleClickEdit},{default:c((()=>[e(r(t.$t("sso.hasPlan.changeBtn")),1)])),_:1},8,["onClick"])])):d("",!0)])),t.isSSOStatusEnabled?d("",!0):(u(),s("div",nt,[n[5]||(n[5]=p("img",{src:"data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M3.72445%2017.5001H16.2745C17.5578%2017.5001%2018.3578%2016.1084%2017.7161%2015.0001L11.4411%204.1584C10.7994%203.05007%209.19945%203.05007%208.55778%204.1584L2.28278%2015.0001C1.64112%2016.1084%202.44112%2017.5001%203.72445%2017.5001ZM9.99945%2011.6667C9.54112%2011.6667%209.16612%2011.2917%209.16612%2010.8334V9.16673C9.16612%208.7084%209.54112%208.3334%209.99945%208.3334C10.4578%208.3334%2010.8328%208.7084%2010.8328%209.16673V10.8334C10.8328%2011.2917%2010.4578%2011.6667%209.99945%2011.6667ZM10.8328%2015.0001H9.16612V13.3334H10.8328V15.0001Z'%20fill='%23E1B61C'/%3e%3c/svg%3e",alt:""},null,-1)),p("p",null,r(t.$t("sso.alert.cannotLogin")),1)])),p("div",null,[p("div",lt,r(t.$t("sso.hasPlan.samlTitle")),1),p("table",ot,[(u(!0),s(S,null,i(t.samlSetting,(e=>(u(),s("tr",{key:e.label},[p("td",null,r(e.label),1),p("td",null,[a(P,{"model-value":e.url,disabled:""},{"append-icon":c((()=>[p("button",{class:"copy-button",onClick:s=>t.onCopyClick(e.url)},n[6]||(n[6]=[p("img",{src:"data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M19%202H14.82C14.4%200.84%2013.3%200%2012%200C10.7%200%209.6%200.84%209.18%202H5C3.9%202%203%202.9%203%204V20C3%2021.1%203.9%2022%205%2022H19C20.1%2022%2021%2021.1%2021%2020V4C21%202.9%2020.1%202%2019%202ZM12%202C12.55%202%2013%202.45%2013%203C13%203.55%2012.55%204%2012%204C11.45%204%2011%203.55%2011%203C11%202.45%2011.45%202%2012%202ZM18%2020H6C5.45%2020%205%2019.55%205%2019V5C5%204.45%205.45%204%206%204H7V5C7%206.1%207.9%207%209%207H15C16.1%207%2017%206.1%2017%205V4H18C18.55%204%2019%204.45%2019%205V19C19%2019.55%2018.55%2020%2018%2020Z'%20fill='%23707070'/%3e%3c/svg%3e",alt:"copy"},null,-1)]),8,rt)])),_:2},1032,["model-value"])])])))),128))])])])])):(u(),s("div",dt,[p("p",null,r(t.$t("sso.noPlan.unavailable")),1),a(y,{variant:"primary",class:"contact",tracking:"sso-sso.noPlan.contactBtn",onClick:t.onClickSupportPage},{default:c((()=>[e(r(t.$t("sso.noPlan.contactBtn")),1)])),_:1},8,["onClick"])]))])),_:1})}],["__scopeId","data-v-7cf88e97"]]);export{ut as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.