"use strict";(self.webpackChunk_as_client=self.webpackChunk_as_client||[]).push([[687],{7687:(t,e,a)=>{a.r(e),a.d(e,{default:()=>S});var n=a(4041),r=a(7973),o=a(7969),i=a(3614),s=a(3580),l=a(3578),u=a(7894);const d=({title:t,description:e,children:a})=>n.createElement("div",{"data-testid":"saml-authentication-result",style:{textAlign:"center"}},n.createElement(u.Z,{maxWidth:456,centered:!0},n.createElement(l.A,{variant:"displayLg",m:"0 0 4px 0",color:s.A.neutralTextTitle,weight:"semiBold","data-testid":"saml-authentication-status",center:!0},t),n.createElement(l.A,{variant:"textMd",m:0,color:s.A.neutralTextSubtitle,"data-testid":"saml-authentication-description",center:!0},e),a));var c=a(6391),m=a(5772),p=a(6319),h=a(730),g=a(1411),y=a(1060),w=a(9594);function f(){delete window.SAMLResponse,delete window.RelayState}const S=()=>{const{authenticationStatus:t,authenticationStatusDescription:e,isAuthenticationFailed:a}=function(){const[t]=(0,m.BB)(),[e]=(0,m.Km)(),a=(0,w.jL)(),[r,o]=(0,n.useState)(""),[s,l]=(0,n.useState)(""),[u,d]=(0,n.useState)(!1),S=(0,c.W6)(),A=t=>{o("SAML authentication failed"),d(!0),(0,p.W)(t)&&(0,h.Z)(t.data)&&l(t.data.reason)};return(0,n.useEffect)((()=>{const n={assertion:window.SAMLResponse,relay_state:window.RelayState};var r,s;"string"==typeof(r=n).assertion&&r.assertion.length>0?(s=n.relay_state,s?.startsWith("vpnauth")?e(n).unwrap().then((()=>{f(),o("Authentication successful"),l("You may now close this window and return to your VPN program")})).catch(A):t(n).unwrap().then((t=>{a((0,g.Wj)(t)),f(),y.E.saveToLocalStorage(n.relay_state),S.replace(i.f.downloads)})).catch(A)):S.replace(i.f.login)}),[]),{authenticationStatus:r,authenticationStatusDescription:s,isAuthenticationFailed:u}}();return t?n.createElement(d,{title:t,description:e},a&&n.createElement("div",{style:{marginTop:"var(--spacing-md, 32px)"}},n.createElement(r.A,{to:i.f.login,variant:"ghost"},n.createElement(o.A,null)," Go Back To Login"))):null}},5772:(t,e,a)=>{a.d(e,{BB:()=>l,I8:()=>s,Ir:()=>c,Km:()=>p,SV:()=>d,eR:()=>m,mg:()=>u});var n=a(323),r=a(6270),o=a(5167);const i=a(2644).U.injectEndpoints({endpoints:t=>({loginWithEmailAndPassword:t.mutation({query:t=>({url:n.M.login,method:"POST",body:t}),transformResponse:t=>(0,o.d)(t)}),loginWithSaml:t.mutation({query:t=>({url:n.M.samlAssertion,method:"POST",body:t}),transformResponse:t=>(0,o.d)(t)}),vpnSamlAuth:t.mutation({query:t=>({url:n.M.vpnSamlAuth,method:"POST",body:t})}),getIdpUrl:t.query({query:t=>({url:n.M.getIdpUrl,params:{relay_state:t}})}),submitMfaChallenge:t.mutation({query:t=>({url:n.M.mfaChallenge,method:"POST",body:t}),transformResponse:t=>(0,o.d)(t)}),changePassword:t.mutation({query:({newPassword:t,token:e,userName:a})=>({url:n.M.passwordChange,method:"POST",body:{username:a,new_password:t},headers:{[r.j]:e}})}),enrollInMfa:t.mutation({query:({token:t,authToken:e})=>({url:n.M.mfaEnroll,method:"POST",body:{token:t},headers:{[r.j]:e}}),transformResponse:t=>(0,o.d)(t)})})}),{useLoginWithEmailAndPasswordMutation:s,useLoginWithSamlMutation:l,useSubmitMfaChallengeMutation:u,useChangePasswordMutation:d,useEnrollInMfaMutation:c,useLazyGetIdpUrlQuery:m,useVpnSamlAuthMutation:p}=i},7894:(t,e,a)=>{a.d(e,{Z:()=>d});var n=a(4041),r=a(8081),o=a(9192),i=a(3580),s=a(738);const l=(0,r.AH)(["margin-right:auto;margin-left:auto;"]),u=r.Ay.div([""," max-width:",";padding:var(--spacing-md,32px) var(--spacing-xs,16px);background:#fff;border:1px solid ",";border-radius:1rem;"," ",""],(0,o.A)("centered")`
       ${l}
    `,(({maxWidth:t})=>(t=>{if(void 0!==t)return"number"==typeof t?`${t}px`:t})(t)),i.A.neutralBorder,s.Ay.moreThen(s.nm.SM)`
        padding: var(--spacing-md, 32px);
        ${(0,o.A)("withShadow")`
            box-shadow: 0px 1px 3px rgba(16, 24, 40, 0.1), 0px 1px 2px rgba(16, 24, 40, 0.06);
        `}
    `,s.Ay.moreThen(s.nm.MD)`
        padding: var(--spacing-md, 32px) var(--spacing-lg, 48px);
    `),d=t=>{const{children:e,...a}=t;return n.createElement(u,a,e)}}}]);