HTTP Authentication

In enterprise networks, a Forward proxy often sits between users and the internet. Before allowing outbound traffic, the proxy checks whether the user is authenticated. If not, the browser is redirected through an Auth Service and a SAML Identity Provider (IdP) to verify credentials, then receives a token or cookie for later requests.

Authentication Flow

Setting for Downloading the PAC file on Windows System:
  Network & Internet > Proxy Settings > Use Setup Script (Provide script URL)
  This can be Always enabled(by security policy), so user cannot disable.
HTTP CONNECT

sequenceDiagram
    autonumber

    box Tenant=acme
    actor User
    participant Browser
    end

    participant PAC as PACServer
pac.goskope.com participant DNS box Forward Proxy Cloud participant FP as Forward Proxy
acme.goskope.com:8081 participant Auth participant Policy as Policy Engine end participant IdP participant Google Note over User: System script to
Download PAC
https://pac.goskope.com/acme.pac User->>Browser: Open browser Browser->>PAC: Download PAC file
acme.pac Note over PAC: Send acme.pac PAC-->>Browser: FindProxyForURL()
Send every HTTP to
acme.goskope.com:8081 Note over Browser: Now every HTTP request
will be send to
acme.goskope.com:8081 User->>Browser: Open https://google.com Browser->>DNS: Hostname(acme.goskope.com) Note over DNS: Hostname IP
*.goskope.com 1.2.3.4 DNS->>Browser: IP=1.2.3.4 Browser->>FP: HTTP GET google.com
1.2.3.4:8081 Note over FP: Resolve tenant_id from proxy FQDN
FQDN=acme is sent in HTTP Host Header
FQDN→tenant_id 1001 resolved
acme.goskope.com→1001
contoso.goskope.com→2005 FP-->>Browser: 302 Redirect to Auth Service Browser->>Auth: GET /login Auth-->>Browser: Redirect to IdP Browser->>IdP: GET Login Page IdP-->>Browser: Login Form User->>Browser: Enter credentials Browser->>IdP: POST Credentials IdP->>IdP: Authenticate User IdP-->>Browser: SAML Response samlAssertion{
User = bob@acme.com, Name = Bob Smith, Tenant = acme-corp, Groups = Engg,.. Authenticated = true, LoginTime = 10:30 AM, Expiry = 11:30 AM, Signature, Certs} note over Browser: Browser replays
SAML Response from IDP Browser->>Auth: Send SAML Response {samlAssertion} to Assertion Consumer Service (ACS)=Auth Service Auth->>Auth: Validate SAML Assertion
Check Basic structure,
Signature validation,
Time validity Note over Auth: Create Session
Generate Session Cookie
Session cookie is called UTKN(universal token)
nspatoken is name given by Netskope Auth->>Browser: Set Session-Cookie=XXX Note over Browser: Store cookie in browser Note over Browser: Browser sends HTTP CONNECT
It does not send POST or GET
Read HTTP CONNECT above Browser->>FP: CONNECT google.com
Session Cookie=XXX Note over FP: Proxy will check whether I have Session Cookie=XXX stored?
No Note over FP: Proxy asks Cookie validation from Auth FP->>Auth: Is session cookie valid=XXX Note over Auth: Auth provides
Cookie, its TTL, TenantId Auth-->>FP: Valid, Cookie=XXX, TTL, TenantId=123 Note over FP: Store Cookie,TTL,Tenant in Map Note over FP: For 2nd Request
if (PresentEpoc>TTL)expired
Send 302 Redirect FP->>Policy: Evaluate Policy
tenant=1001,domain=google.com
method=CONNECT Policy-->>FP: ALLOW FP->>Google: Establish upstream TLS Connection Google-->>FP: TLS + HTTPS Response FP-->>Browser: Forward Response Browser-->>User: Google search page User->>Browser: Open github.com Browser->>FP: CONNECT github.com:443
SessionCookie=XXX FP->>FP: tenant_id 1001 (FQDN) + bob@acme.com (cookie) FP->>Policy: Evaluate Policy Policy-->>FP: ALLOW/BLOCK FP-->>Browser: Response

When does the session cookie expire?

The proxy session cookie (nspatoken / UTKN) can stop working for three different reasons. It forces the user back through authentication.
1. User closes the browser (all windows/tabs for that profile). Next browse session has no cookie → proxy redirects to login.
2. Admin policy — e.g. idle 8 hours, max 24 hours. Cookie may still be sent by the browser, but proxy lookup fails → treat as expired → 302 to Auth Service.
3. IdP may require password/MFA again after its own SSO timeout (often hours).
Cookie is regains after re-authenication.

Can the refresh token idea be used for session cookie? No

The refresh token concept (short-lived access JWT + long-lived refresh UUID stored server-side) solves a REST API problem. ie Renew credentials without asking for the password every 15 minutes.
Because browsers usually have one opaque session cookie (nspatoken)

Terms

Term Meaning
Proxy Intercepts HTTP/HTTPS traffic. Checks whether the user has a valid session or JWT before forwarding the request to the internet.
Auth Service Handles login, generates a State ID (CSRF protection), validates the SAML response, creates a JWT, and sets a cookie on the browser.
SAML IdP Identity Provider — validates username/password (or MFA) and returns a signed SAML assertion proving the user’s identity and group membership.
State ID Random value tied to the login attempt. Prevents replay and CSRF attacks by ensuring the SAML response matches the original login request.
JWT JSON Web Token created by the Auth Service after successful login. Contains user identity and groups. The proxy sends this to the Auth Service on each request for validation.
Opaque cookie set by the forward proxy after login. Browser sends it on every CONNECT. Maps to server-side session (user, groups, tenant). Expires per browser session, proxy TTL, or IdP SSO. Regained via re-authentication flow — not via REST refresh token API in typical SWG.