Convert Figma logo to code with AI

ory logooathkeeper

A cloud native Identity & Access Proxy / API (IAP) and Access Control Decision API that authenticates, authorizes, and mutates incoming HTTP(s) requests. Inspired by the BeyondCorp / Zero Trust white paper. Written in Go.

3,230
354
3,230
76

Top Related Projects

22,126

Open Source Identity and Access Management For Modern Applications and Services

15,556

The most scalable and customizable OpenID Certified™ OpenID Connect and OAuth Provider on the market. Become an OpenID Connect and OAuth2 Provider over night. Broad support for related RFCs. Written in Go, cloud native, headless, API-first. Available as a service on Ory Network and for self-hosters.

17,484

An authorization library that supports access control models like ACL, RBAC, ABAC in Golang: https://discord.gg/S5UjpzGZjN

10,852

Apereo CAS - Identity & Single Sign On for all earthlings and beyond.

21,425

The Single Sign-On Multi-Factor portal for web apps

Quick Overview

Ory Oathkeeper is an Identity & Access Proxy (IAP) and Access Control Decision API that authorizes HTTP requests based on sets of rules. It acts as a reverse proxy, can be used as a Kubernetes sidecar, and is capable of authenticating and authorizing incoming HTTP requests using various methods.

Pros

  • Highly flexible and customizable authentication and authorization system
  • Supports multiple authentication methods (e.g., OAuth2, JWT, COOKIE)
  • Can be easily integrated into existing infrastructure as a reverse proxy or sidecar
  • Provides a RESTful API for programmatic access and management

Cons

  • Steep learning curve due to its complex configuration options
  • Limited documentation for advanced use cases
  • May introduce additional latency in the request/response cycle
  • Requires careful setup to avoid security misconfigurations

Getting Started

To get started with Ory Oathkeeper, follow these steps:

  1. Install Ory Oathkeeper:

    brew install ory/tap/oathkeeper
    
  2. Create a configuration file config.yaml:

    serve:
      proxy:
        port: 4455
    
    access_rules:
      repositories:
        - file:///path/to/rules.json
    
    authenticators:
      anonymous:
        enabled: true
      noop:
        enabled: true
    
    authorizers:
      allow:
        enabled: true
    
    mutators:
      noop:
        enabled: true
    
  3. Create a rules file rules.json:

    [
      {
        "id": "example-rule",
        "upstream": {
          "url": "http://my-backend-service"
        },
        "match": {
          "url": "http://my-app/<**>",
          "methods": ["GET"]
        },
        "authenticators": [{ "handler": "anonymous" }],
        "authorizer": { "handler": "allow" },
        "mutators": [{ "handler": "noop" }]
      }
    ]
    
  4. Start Oathkeeper:

    oathkeeper serve --config config.yaml
    

This basic setup creates an Oathkeeper instance that proxies requests to a backend service, allowing anonymous access to GET requests. Adjust the configuration and rules to fit your specific use case.

Competitor Comparisons

22,126

Open Source Identity and Access Management For Modern Applications and Services

Pros of Keycloak

  • More comprehensive identity and access management solution with built-in user management, authentication, and authorization features
  • Extensive documentation and large community support
  • Offers a user-friendly admin console for easier configuration and management

Cons of Keycloak

  • Heavier and more resource-intensive compared to Oathkeeper's lightweight design
  • Steeper learning curve due to its broader feature set
  • Less flexibility for integration into existing systems compared to Oathkeeper's modular approach

Code Comparison

Oathkeeper configuration example:

access_rules:
  - id: "my-rule"
    match:
      url: "http://<**>/api/<**>"
      methods:
        - GET
    authenticators:
      - handler: jwt
    authorizer:
      handler: allow
    mutators:
      - handler: noop

Keycloak configuration example:

{
  "realm": "my-realm",
  "auth-server-url": "http://localhost:8080/auth",
  "ssl-required": "external",
  "resource": "my-client",
  "public-client": true,
  "confidential-port": 0
}

Both projects offer robust security solutions, but Keycloak provides a more comprehensive suite of identity management features, while Oathkeeper focuses on lightweight, flexible access control and API security.

15,556

The most scalable and customizable OpenID Certified™ OpenID Connect and OAuth Provider on the market. Become an OpenID Connect and OAuth2 Provider over night. Broad support for related RFCs. Written in Go, cloud native, headless, API-first. Available as a service on Ory Network and for self-hosters.

Pros of Hydra

  • More comprehensive OAuth2 and OpenID Connect server implementation
  • Supports advanced features like JSON Web Key rotation and OAuth2 Token Exchange
  • Higher adoption rate and more active community

Cons of Hydra

  • More complex setup and configuration
  • Steeper learning curve for beginners
  • Potentially overkill for simpler authentication scenarios

Code Comparison

Hydra (Go):

import "github.com/ory/hydra/client"

c := client.NewHTTPClientWithConfig(nil, &client.TransportConfig{
    Schemes:  []string{"http", "https"},
    Host:     "localhost:4444",
    BasePath: "/",
})

Oathkeeper (Go):

import "github.com/ory/oathkeeper/sdk/go/oathkeeper"

configuration := oathkeeper.NewConfiguration()
configuration.Host = "localhost:4456"
client := oathkeeper.NewAPIClient(configuration)

Both Hydra and Oathkeeper are part of the Ory ecosystem, but they serve different purposes. Hydra is a full-featured OAuth2 and OpenID Connect server, while Oathkeeper is an Identity & Access Proxy. Hydra is more suitable for complex authentication scenarios, while Oathkeeper excels at API access control and request authorization. The choice between them depends on the specific requirements of your project and the level of authentication complexity you need.

17,484

An authorization library that supports access control models like ACL, RBAC, ABAC in Golang: https://discord.gg/S5UjpzGZjN

Pros of Casbin

  • More flexible and customizable authorization model
  • Supports multiple programming languages and frameworks
  • Easier to integrate into existing systems due to its lightweight nature

Cons of Casbin

  • Requires more manual configuration and setup
  • Less built-in features for API security and identity management
  • May require additional components for complete access control solution

Code Comparison

Casbin policy definition:

[request_definition]
r = sub, obj, act

[policy_definition]
p = sub, obj, act

[policy_effect]
e = some(where (p.eft == allow))

[matchers]
m = r.sub == p.sub && r.obj == p.obj && r.act == p.act

Oathkeeper rule configuration:

- id: "rule-1"
  match:
    url: "<http://my-app.com/api/users>"
    methods:
      - GET
  authenticators:
    - handler: jwt
  authorizer:
    handler: allow
  mutators:
    - handler: noop

Casbin focuses on defining flexible authorization policies, while Oathkeeper provides a more comprehensive API security solution with built-in authentication, authorization, and request/response mutation capabilities. Casbin's approach allows for more granular control over access rules, but Oathkeeper offers a more streamlined setup for API gateway scenarios.

10,852

Apereo CAS - Identity & Single Sign On for all earthlings and beyond.

Pros of CAS

  • More comprehensive authentication and authorization solution with a wider range of features
  • Extensive documentation and community support
  • Built-in support for various authentication protocols (SAML, OAuth, CAS)

Cons of CAS

  • Steeper learning curve due to its complexity
  • Heavier resource footprint compared to Oathkeeper
  • May be overkill for simpler authentication scenarios

Code Comparison

CAS (Java):

@Bean
public AuthenticationHandler myAuthenticationHandler() {
    return new MyCustomAuthenticationHandler();
}

Oathkeeper (Go):

func (a *Authenticator) Authenticate(r *http.Request) (*authn.Info, error) {
    // Custom authentication logic
}

Both projects allow for custom authentication handlers, but CAS typically requires more configuration and setup due to its comprehensive nature. Oathkeeper's approach is more lightweight and focused on API security.

CAS offers a more feature-rich solution with built-in support for various authentication protocols, making it suitable for complex enterprise environments. However, this comes at the cost of increased complexity and resource usage.

Oathkeeper, on the other hand, provides a more streamlined approach to API security and access control. It's lighter and easier to integrate into microservices architectures but may lack some of the advanced features found in CAS.

21,425

The Single Sign-On Multi-Factor portal for web apps

Pros of Authelia

  • More comprehensive authentication solution with built-in 2FA, single sign-on, and password policies
  • User-friendly web portal for self-service account management
  • Supports multiple storage backends (SQL, LDAP) for user information

Cons of Authelia

  • Less flexible in terms of customization and extensibility
  • May be overkill for simpler authentication scenarios
  • Steeper learning curve due to more features and configuration options

Code Comparison

Oathkeeper (Go):

func (a *AuthenticatorNoOp) Authenticate(r *http.Request, session *authn.AuthenticationSession, config json.RawMessage) error {
    return nil
}

Authelia (Go):

func (provider *FileUserProvider) CheckUserPassword(username string, password string) (bool, error) {
    user, err := provider.GetDetails(username)
    if err != nil {
        return false, err
    }
    return CheckPasswordHash(password, user.HashedPassword), nil
}

Both projects use Go, but Authelia's code tends to be more focused on user management and authentication specifics, while Oathkeeper's code is more oriented towards request handling and middleware-style operations.

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

ORY Oathkeeper - Cloud Native Identity & Access Proxy

Chat | Discussions | Newsletter

API Docs | Guide | Code Docs

Support this project!

Work in Open Source, Ory is hiring!


Build Status Coverage Status Go Report Card PkgGoDev

ORY Oathkeeper is an Identity & Access Proxy (IAP) and Access Control Decision API that authorizes HTTP requests based on sets of Access Rules. The BeyondCorp Model is designed by Google and secures applications in Zero-Trust networks.

An Identity & Access Proxy is typically deployed in front of (think API Gateway) web-facing applications and is capable of authenticating and optionally authorizing access requests. The Access Control Decision API can be deployed alongside an existing API Gateway or reverse proxy. ORY Oathkeeper's Access Control Decision API works with:

among others.

This service is stable, but under active development and may introduce breaking changes in future releases. Any breaking change will have extensive documentation and upgrade instructions.

Ory Network Hybrid Support Plan

Ory offers a support plan for Ory Network Hybrid, including Ory on private cloud deployments. If you have a self-hosted solution and would like help, consider a support plan! The team at Ory has years of experience in cloud computing. Ory's offering is the only official program for qualified support from the maintainers. For more information see the website or book a meeting!

Project Renaming

The Ory Oathkeeper project was started in 2017 in Germany and owes its name to the Sword Oathkeeper from Game of Thrones. We also understand that the name is politically charged in the US as it is shared with a far-right militia organization in the US called "Oath Keepers".

To take a stand against extremism and avoid any confusion to the name's origin, we will be renaming the project in the near future. Please be patient with us as we work on this complicated change of various CIs, tools, scripts, and automations.


Installation

Head over to the ORY Developer Documentation to learn how to install ORY Oathkeeper on Linux, macOS, Windows, and Docker and how to build ORY Oathkeeper from source.

Who's using it?

The Ory community stands on the shoulders of individuals, companies, and maintainers. The Ory team thanks everyone involved - from submitting bug reports and feature requests, to contributing patches and documentation. The Ory community counts more than 33.000 members and is growing rapidly. The Ory stack protects 60.000.000.000+ API requests every month with over 400.000+ active service nodes. None of this would have been possible without each and everyone of you!

The following list represents companies that have accompanied us along the way and that have made outstanding contributions to our ecosystem. If you think that your company deserves a spot here, reach out to office@ory.sh now!

Type Name Logo Website
Adopter * Raspberry PI Foundation Raspberry PI Foundation raspberrypi.org
Adopter * Kyma Project Kyma Project kyma-project.io
Adopter * Tulip Tulip Retail tulip.com
Adopter * Cashdeck / All My Funds All My Funds cashdeck.com.au
Adopter * Hootsuite Hootsuite hootsuite.com
Adopter * Segment Segment segment.com
Adopter * Arduino Arduino arduino.cc
Adopter * DataDetect Datadetect unifiedglobalarchiving.com/data-detect/
Adopter * Sainsbury's Sainsbury's sainsburys.co.uk
Adopter * Contraste Contraste contraste.com
Adopter * Reyah Reyah reyah.eu
Adopter * Zero Project Zero by Commit getzero.dev
Adopter * Padis Padis padis.io
Adopter * Cloudbear Cloudbear cloudbear.eu
Adopter * Security Onion Solutions Security Onion Solutions securityonionsolutions.com
Adopter * Factly Factly factlylabs.com
Adopter * Nortal Nortal nortal.com
Adopter * OrderMyGear OrderMyGear ordermygear.com
Adopter * Spiri.bo Spiri.bo spiri.bo
Adopter * Strivacity Spiri.bo strivacity.com
Adopter * Hanko Hanko hanko.io
Adopter * Rabbit Rabbit rabbit.co.th
Adopter * inMusic InMusic inmusicbrands.com
Adopter * Buhta Buhta buhta.com
Adopter * Connctd Connctd connctd.com
Adopter * Paralus Paralus paralus.io
Adopter * TIER IV TIER IV tier4.jp
Adopter * R2Devops R2Devops r2devops.io
Adopter * LunaSec LunaSec lunasec.io
Adopter * Serlo Serlo serlo.org
Adopter * dyrector.io dyrector.io dyrector.io
Adopter * Stackspin stackspin.net stackspin.net
Adopter * Amplitude amplitude.com amplitude.com
Adopter * Pinniped pinniped.dev pinniped.dev
Adopter * Pvotal pvotal.tech pvotal.tech

Many thanks to all individual contributors

* Uses one of Ory's major projects in production.

Ecosystem

We build Ory on several guiding principles when it comes to our architecture design:

  • Minimal dependencies
  • Runs everywhere
  • Scales without effort
  • Minimize room for human and network errors

Ory's architecture is designed to run best on a Container Orchestration system such as Kubernetes, CloudFoundry, OpenShift, and similar projects. Binaries are small (5-15MB) and available for all popular processor types (ARM, AMD64, i386) and operating systems (FreeBSD, Linux, macOS, Windows) without system dependencies (Java, Node, Ruby, libxml, ...).

Ory Kratos: Identity and User Infrastructure and Management

Ory Kratos is an API-first Identity and User Management system that is built according to cloud architecture best practices. It implements core use cases that almost every software application needs to deal with: Self-service Login and Registration, Multi-Factor Authentication (MFA/2FA), Account Recovery and Verification, Profile, and Account Management.

Ory Hydra: OAuth2 & OpenID Connect Server

Ory Hydra is an OpenID Certified™ OAuth2 and OpenID Connect Provider which easily connects to any existing identity system by writing a tiny "bridge" application. It gives absolute control over the user interface and user experience flows.

Ory Oathkeeper: Identity & Access Proxy

Ory Oathkeeper is a BeyondCorp/Zero Trust Identity & Access Proxy (IAP) with configurable authentication, authorization, and request mutation rules for your web services: Authenticate JWT, Access Tokens, API Keys, mTLS; Check if the contained subject is allowed to perform the request; Encode resulting content into custom headers (X-User-ID), JSON Web Tokens and more!

Ory Keto: Access Control Policies as a Server

Ory Keto is a policy decision point. It uses a set of access control policies, similar to AWS IAM Policies, in order to determine whether a subject (user, application, service, car, ...) is authorized to perform a certain action on a resource.

Security

Disclosing vulnerabilities

If you think you found a security vulnerability, please refrain from posting it publicly on the forums, the chat, or GitHub. You can find all info for responsible disclosure in our security.txt.

Telemetry

Our services collect summarized, anonymized data which can optionally be turned off. Click here to learn more.

Documentation

Guide

The Guide is available here.

HTTP API documentation

The HTTP API is documented here.

Upgrading and Changelog

New releases might introduce breaking changes. To help you identify and incorporate those changes, we document these changes in UPGRADE.md and CHANGELOG.md.

Command line documentation

Run oathkeeper -h or oathkeeper help.

Develop

Developing with ORY Oathkeeper is as easy as:

$ cd ~
$ go get -d -u github.com/ory/oathkeeper
$ cd $GOPATH/src/github.com/ory/oathkeeper
$ export GO111MODULE=on
$ go test ./...