diff --git a/README.md b/README.md index ea750a4d4..b71bf53c7 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ The process goes something like this: * [Akamai](pkg/provider/akamai/README.md) * OneLogin * NetIQ - * Browser, this uses [playwright-go](github.com/mxschmitt/playwright-go) to run a sandbox chromium window. + * Browser, this uses [playwright-go](https://github.com/mxschmitt/playwright-go) to run a sandbox chromium window. Using ALL_PROXY environment variable you can set a proxy. HTTP and SOCKS proxies are supported, for example `http://myproxy.com:3128` or `socks5://myproxy.com:3128`. Short form `myproxy.com:3128` is considered an HTTP proxy. * [Auth0](pkg/provider/auth0/README.md) NOTE: Currently, MFA not supported * AWS SAML Provider configured diff --git a/pkg/provider/browser/browser.go b/pkg/provider/browser/browser.go index d2947bfee..462087507 100644 --- a/pkg/provider/browser/browser.go +++ b/pkg/provider/browser/browser.go @@ -3,6 +3,7 @@ package browser import ( "errors" "net/url" + "os" "github.com/mxschmitt/playwright-go" "github.com/sirupsen/logrus" @@ -31,6 +32,7 @@ func (cl *Client) Authenticate(loginDetails *creds.LoginDetails) (string, error) // TODO: provide some overrides for this window launchOptions := playwright.BrowserTypeLaunchOptions{ Headless: playwright.Bool(false), + Proxy: GetProxy("ALL_PROXY"), } // currently using Chromium as it is widely supported for Identity providers @@ -83,3 +85,10 @@ func (cl *Client) Validate(loginDetails *creds.LoginDetails) error { return nil } + +func GetProxy(envVar string) *playwright.BrowserTypeLaunchOptionsProxy { + if value, ok := os.LookupEnv(envVar); ok { + return &playwright.BrowserTypeLaunchOptionsProxy{Server: playwright.String(value)} + } + return nil +}