talira

OAuth2 Proxy

A reverse proxy that provides authentication with Google, Azure, OpenID Connect and many more identity providers

open sourceMITself-hostablefree

Forked from oauth2_proxy (Bitly) in 2018.

OAuth2 Proxy puts an OAuth2 or OpenID Connect login in front of web applications, either as a reverse proxy in front of the upstream app or as an authentication check that nginx's auth_request, Traefik ForwardAuth or Caddy call on every request. It signs people in through a generic OIDC provider or built-in providers for Google, Microsoft Entra ID, GitHub, GitLab, Keycloak, login.gov and others, restricts access by email, domain or group, and passes the user's identity and tokens to the app as HTTP headers. Sessions live in an encrypted cookie or Redis, and it ships as a single Go binary, a container image and an official Helm chart. It began in 2018 as a fork of bitly's oauth2_proxy, is MIT licensed and is a Cloud Native Computing Foundation Sandbox project.

Ways to install

Problems it solves

  • put a Google or GitHub login in front of an internal web app that has no authentication of its own
  • only let people with our company email domain reach the staging site
  • protect Prometheus, Grafana and other admin dashboards with single sign-on from our Okta or Entra ID
  • add OIDC login to an nginx site with auth_request without changing the app
  • Traefik forward auth middleware that sends users to our identity provider
  • restrict a Kubernetes dashboard to members of one GitHub team or GitLab group
  • pass the signed-in user's email and groups to my legacy app as HTTP headers
  • my app can trust an X-Forwarded-User header if something in front of it handles the login
  • self-hosted alternative to Google Identity-Aware Proxy or Cloudflare Access
  • secure an internal tool behind Keycloak without adding an OAuth library to its code
  • one login cookie that covers several subdomains behind the same proxy
  • let API clients with a valid JWT bearer token through while browsers get the login page
  • skip authentication for a health check path but require login everywhere else
  • add login to a static documentation site served from a folder
  • store login sessions in Redis because the cookie gets too big with our identity provider's tokens

View all 20 problems

Features

  • standalone reverse proxy in front of HTTP(S) upstreams, unix sockets or static files
  • authentication check endpoint (/oauth2/auth) for nginx auth_request, Traefik ForwardAuth and Caddy
  • providers: generic OpenID Connect, ADFS, Bitbucket, Cidaas, Cisco Duo, DigitalOcean, Facebook, Gitea, Forgejo, GitHub, GitLab, Google, Keycloak, LinkedIn, login.gov, Entra ID, Nextcloud, SourceHut
  • allow access by email address, email domain, an email list file or group membership
  • passes X-Forwarded-User, X-Forwarded-Email and X-Forwarded-Groups headers, and the ID or access token, to upstreams
  • skip-auth routes by method and path
  • accepts verified JWT bearer tokens from configured issuers
  • optional htpasswd file for username and password sign-in
  • sessions in an encrypted cookie or Redis (standalone, Sentinel or Cluster)
  • Prometheus metrics endpoint, /ping liveness and /ready readiness checks
View 4 more
  • configuration by command line flags, environment variables or a config file
  • prebuilt binaries for Linux, macOS, Windows and FreeBSD, including arm, ppc64le and s390x
  • distroless container images on quay.io, Alpine variants and nightly builds
  • official Helm chart

Limitations

  • Can't offer a choice of several identity providers on one instance: support for multiple providers isn't complete7

Capabilities

Has single sign-onplan not known

Alternatives

The same job

These do what OAuth2 Proxy does.

  1. authentik The authentication glue you need
  2. Tinyauth The tiniest OpenID Certified authorization and authentication server you have ever seen
  3. Pomerium Identity- and context-aware access proxy for internal apps, services and AI agents
  4. Authelia The Single Sign-On Multi-Factor portal for web apps
  5. Cloudflare Access Zero trust network access for self-hosted apps, SaaS applications and infrastructure
  6. Ory Oathkeeper Identity-aware proxy and access control decision API for Zero Trust

Compare OAuth2 Proxy with the top 3