Convert Figma logo to code with AI

oauth2-proxy logooauth2-proxy

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

11,694
1,754
11,694
241

Top Related Projects

27,937

Open Source Identity and Access Management For Modern Applications and Services

24,840

The Single Sign-On Multi-Factor portal for web apps, now OpenID Certified™

an SSO and OAuth / OIDC login solution for Nginx using the auth_request module

3,112

sso, aka S.S.Octopus, aka octoboi, is a single sign-on solution for securing internal services

Minimal forward authentication service that provides Google/OpenID oauth based login and authentication for the traefik reverse proxy

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

Quick Overview

OAuth2 Proxy is an open-source reverse proxy and static file server that provides authentication using Providers (Google, GitHub, and others) to validate accounts by email, domain or group. It's designed to protect applications and resources by requiring authentication before allowing access, and can be used to add OAuth2 authentication to any application that supports HTTP.

Pros

  • Supports multiple OAuth providers (Google, GitHub, Azure, etc.)
  • Easy integration with existing applications without modifying their code
  • Provides single sign-on (SSO) capabilities
  • Highly configurable with numerous options for customization

Cons

  • Can add latency to requests due to the additional authentication step
  • Setup and configuration can be complex for beginners
  • Requires careful security considerations to avoid misconfigurations
  • Limited to OAuth2 authentication, may not suit all use cases

Getting Started

  1. Install OAuth2 Proxy:
# Using Go
go install github.com/oauth2-proxy/oauth2-proxy/v7@latest

# Using Docker
docker pull quay.io/oauth2-proxy/oauth2-proxy:latest
  1. Create a configuration file (oauth2_proxy.cfg):
provider = "github"
client_id = "<your-client-id>"
client_secret = "<your-client-secret>"
cookie_secret = "<random-string>"
email_domains = [ "*" ]
upstreams = [ "http://127.0.0.1:8080/" ]
  1. Run OAuth2 Proxy:
oauth2-proxy --config=oauth2_proxy.cfg
  1. Configure your application to use OAuth2 Proxy as a reverse proxy, typically by setting it as the upstream server in your web server configuration.

For more detailed instructions and advanced configurations, refer to the official documentation on the OAuth2 Proxy GitHub repository.

Competitor Comparisons

27,937

Open Source Identity and Access Management For Modern Applications and Services

Pros of Keycloak

  • Full-featured Identity and Access Management (IAM) solution
  • Supports multiple authentication protocols (OAuth 2.0, OpenID Connect, SAML)
  • Provides user federation, identity brokering, and social login

Cons of Keycloak

  • More complex setup and configuration
  • Higher resource requirements
  • Steeper learning curve for implementation and management

Code Comparison

OAuth2-Proxy configuration example:

provider = "oidc"
client_id = "my-client"
client_secret = "my-secret"
oidc_issuer_url = "https://accounts.google.com"

Keycloak configuration example:

{
  "realm": "my-realm",
  "auth-server-url": "http://localhost:8080/auth",
  "ssl-required": "external",
  "resource": "my-client",
  "credentials": {
    "secret": "my-secret"
  }
}

OAuth2-Proxy is a lightweight reverse proxy that provides authentication using OAuth 2.0 providers, while Keycloak is a comprehensive IAM solution. OAuth2-Proxy is simpler to set up and use for basic authentication needs, whereas Keycloak offers more advanced features and flexibility but requires more resources and expertise to implement and manage effectively.

24,840

The Single Sign-On Multi-Factor portal for web apps, now OpenID Certified™

Pros of Authelia

  • More comprehensive authentication solution, offering multi-factor authentication (2FA/MFA) out of the box
  • Supports multiple identity providers and user storage backends (LDAP, file-based)
  • Provides a built-in web portal for user management and self-service password reset

Cons of Authelia

  • More complex setup and configuration compared to OAuth2 Proxy
  • Requires additional infrastructure components (e.g., Redis for session storage)
  • May have a steeper learning curve for administrators new to advanced authentication systems

Code Comparison

OAuth2 Proxy configuration example:

providers:
  - provider: github
    client_id: <client_id>
    client_secret: <client_secret>

Authelia configuration example:

authentication_backend:
  ldap:
    url: ldap://ldap.example.com
    base_dn: dc=example,dc=com
    user: cn=admin,dc=example,dc=com
    password: password

Both projects use YAML for configuration, but Authelia's configuration is typically more extensive due to its broader feature set.

an SSO and OAuth / OIDC login solution for Nginx using the auth_request module

Pros of Vouch Proxy

  • More flexible authentication options, including support for multiple IdPs
  • Built-in support for JWT token creation and validation
  • Easier to integrate with existing applications due to its modular design

Cons of Vouch Proxy

  • Less mature project with fewer contributors and stars on GitHub
  • Limited documentation compared to OAuth2 Proxy
  • Potentially more complex setup and configuration process

Code Comparison

OAuth2 Proxy configuration example:

providers:
  - provider: github
    client_id: <client_id>
    client_secret: <client_secret>
    scope: user:email

Vouch Proxy configuration example:

oauth:
  provider: github
  client_id: <client_id>
  client_secret: <client_secret>
  callback_url: https://vouch.yourdomain.com/auth
  scopes:
    - user:email

Both projects aim to provide authentication and authorization for web applications, but they differ in their approach and feature set. OAuth2 Proxy is more focused on being a reverse proxy with built-in OAuth support, while Vouch Proxy is designed to be a standalone authentication service that can be integrated with various reverse proxies and applications.

OAuth2 Proxy has a larger community and more extensive documentation, making it potentially easier to get started with and troubleshoot. However, Vouch Proxy offers more flexibility in terms of authentication providers and token handling, which may be beneficial for more complex setups or when working with multiple identity providers.

3,112

sso, aka S.S.Octopus, aka octoboi, is a single sign-on solution for securing internal services

Pros of SSO

  • Designed for multi-tenant environments with support for multiple upstream identity providers
  • Includes a comprehensive web UI for user management and access control
  • Offers more granular access controls and customizable authorization policies

Cons of SSO

  • More complex setup and configuration compared to OAuth2 Proxy
  • Requires additional infrastructure components (e.g., Redis for session storage)
  • Less actively maintained, with fewer recent updates and contributions

Code Comparison

SSO configuration example:

upstreams:
  - id: example
    name: Example App
    domain: example.com
    from: example.com
    to: http://localhost:8080

OAuth2 Proxy configuration example:

http_address = "0.0.0.0:4180"
upstreams = [ "http://localhost:8080" ]
email_domains = [ "*" ]
client_id = "123456.apps.googleusercontent.com"
client_secret = "cookie_secret"

Both projects aim to provide authentication and authorization for web applications, but SSO offers more advanced features for complex, multi-tenant environments, while OAuth2 Proxy focuses on simplicity and ease of use for single-application setups. SSO may be better suited for large organizations with diverse access requirements, whereas OAuth2 Proxy is often sufficient for smaller projects or individual applications.

Minimal forward authentication service that provides Google/OpenID oauth based login and authentication for the traefik reverse proxy

Pros of traefik-forward-auth

  • Lightweight and specifically designed for use with Traefik
  • Simple configuration and integration with Traefik's middleware system
  • Supports multiple providers out of the box (Google, GitHub, etc.)

Cons of traefik-forward-auth

  • Limited feature set compared to oauth2-proxy
  • Less active development and community support
  • Fewer authentication options and customization possibilities

Code Comparison

traefik-forward-auth configuration example:

labels:
  - "traefik.http.middlewares.auth.forwardauth.address=http://traefik-forward-auth:4181"
  - "traefik.http.middlewares.auth.forwardauth.authResponseHeaders=X-Forwarded-User"
  - "traefik.http.middlewares.auth.forwardauth.trustForwardHeader=true"

oauth2-proxy configuration example:

http:
  middlewares:
    oauth2-proxy:
      forwardAuth:
        address: "http://oauth2-proxy:4180/oauth2/auth"
        trustForwardHeader: true
        authResponseHeaders:
          - "X-Auth-Request-User"
          - "X-Auth-Request-Email"

Both projects serve similar purposes but cater to different use cases. traefik-forward-auth is more focused on simplicity and Traefik integration, while oauth2-proxy offers more features and flexibility for various reverse proxy setups.

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

Pros of oauth2-proxy

  • Active development with regular updates and bug fixes
  • Extensive documentation and community support
  • Wide range of supported providers and authentication methods

Cons of oauth2-proxy

  • Complexity in configuration for advanced use cases
  • Limited built-in support for certain enterprise-specific features
  • Potential performance overhead for high-traffic applications

Code Comparison

Both repositories contain the same codebase, as they are the same project. Here's a sample of the main OAuth2 proxy configuration from oauth2-proxy:

type Options struct {
    ProxyPrefix  string `flag:"proxy-prefix" cfg:"proxy_prefix"`
    HttpAddress  string `flag:"http-address" cfg:"http_address"`
    HttpsAddress string `flag:"https-address" cfg:"https_address"`
    RedirectURL  string `flag:"redirect-url" cfg:"redirect_url"`
    ClientID     string `flag:"client-id" cfg:"client_id"`
    ClientSecret string `flag:"client-secret" cfg:"client_secret"`
}

This code snippet demonstrates the core configuration options for the OAuth2 proxy, including proxy prefix, addresses, redirect URL, and client credentials.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Continuous Integration Go Report Card GoDoc MIT licensed Maintainability Test Coverage

OAuth2 Proxy

OAuth2-Proxy is a flexible, open-source tool that can act as either a standalone reverse proxy or a middleware component integrated into existing reverse proxy or load balancer setups. It provides a simple and secure way to protect your web applications with OAuth2 / OIDC authentication. As a reverse proxy, it intercepts requests to your application and redirects users to an OAuth2 provider for authentication. As a middleware, it can be seamlessly integrated into your existing infrastructure to handle authentication for multiple applications.

OAuth2-Proxy supports a lot of OAuth2 as well as OIDC providers. Either through a generic OIDC client or a specific implementation for Google, Microsoft Entra ID, GitHub, login.gov and others. Through specialised provider implementations oauth2-proxy can extract more details about the user like preferred usernames and groups. Those details can then be forwarded as HTTP headers to your upstream applications.

Simplified Architecture

Get Started

OAuth2-Proxy's Installation Docs cover how to install and configure your setup. Additionally you can take a further look at the example setup files.

Releases

Binaries

We publish oauth2-proxy as compiled binaries on GitHub for all major architectures as well as more exotic ones like ppc64le as well as s390x.

Check out the latest release.

Images

From v7.6.0 and up the base image has been changed from Alpine to GoogleContainerTools/distroless. This image comes with even fewer installed dependencies and thus should improve security. The image therefore is also slightly smaller than Alpine. For debugging purposes (and those who really need it. e.g. armv6) we still provide images based on Alpine. The tags of these images are suffixed with -alpine.

Since 2023-11-18 we build nightly images directly from the master branch and provide them at quay.io/oauth2-proxy/oauth2-proxy-nightly. These images are considered unstable and therefore should NOT be used for production purposes unless you know what you're doing.

Sponsors

Microsoft Microsoft Azure credits for open source projects

Would you like to sponsor the project then please contact us at sponsors@oauth2-proxy.dev

Getting Involved

Slack

Join the #oauth2-proxy Slack channel to chat with other users of oauth2-proxy or reach out to the maintainers directly. Use the public invite link to get an invite for the Gopher Slack space.

OAuth2-Proxy is a community-driven project. We rely on the contribut️ions of our users to continually improve it. While review times can vary, we appreciate your patience and understanding. As a volunteer-driven project, we strive to keep this project stable and might take longer to merge changes.

If you want to contribute to the project. Please see our Contributing guide.

Who uses OAuth2-Proxy? Have a look at our new ADOPTERS file and feel free to open a PR to add your organisation.

Thanks to all the people who already contributed ❤

Made with contrib.rocks.

Security

If you believe you have found a vulnerability within OAuth2 Proxy or any of its dependencies, please do NOT open an issue or PR on GitHub, please do NOT post any details publicly.

Security disclosures MUST be done in private. If you have found an issue that you would like to bring to the attention of the maintainers, please compose an email and send it to the list of people listed in our MAINTAINERS file.

For more details read our full Security Docs

Security Notice for v6.0.0 and older

If you are running a version older than v6.0.0 we strongly recommend to the current version.

See open redirect vulnerability for details.

Repository History

2018-11-27: This repository was forked from bitly/OAuth2_Proxy. Versions v3.0.0 and up are from this fork and will have diverged from any changes in the original fork. A list of changes can be seen in the CHANGELOG.

2020-03-29: This project was formerly hosted as pusher/oauth2_proxy but has been renamed to oauth2-proxy/oauth2-proxy. Going forward, all images shall be available at quay.io/oauth2-proxy/oauth2-proxy and binaries will be named oauth2-proxy.

License

OAuth2-Proxy is distributed under The MIT License.