• Stars
    star
    14,588
  • Rank 1,927 (Top 0.04 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created almost 9 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

OpenID Certified™ OpenID Connect and OAuth Provider written in Go - cloud native, security-first, open source API security for your infrastructure. SDKs for any language. Works with Hardware Security Modules. Compatible with MITREid.

Ory Hydra - Open Source OAuth 2 and OpenID Connect server


CI Tasks for Ory Hydra Go Report Card PkgGoDev CII Best Practices

Ory Hydra is a hardened, OpenID Certified OAuth 2.0 Server and OpenID Connect Provider optimized for low-latency, high throughput, and low resource consumption. Ory Hydra is not an identity provider (user sign up, user login, password reset flow), but connects to your existing identity provider through a login and consent app. Implementing the login and consent app in a different language is easy, and exemplary consent apps (Node) and SDKs for common languages are provided.

Ory Hydra can use Ory Kratos as its identity server.

Ory Hydra on the Ory Network

The Ory Network is the fastest, most secure and worry-free way to use Ory's Services. Ory OAuth2 & OpenID Connect is powered by the Ory Hydra open source federation server, and it's fully API-compatible.

The Ory Network provides the infrastructure for modern end-to-end security:

  • Identity & credential management scaling to billions of users and devices
  • Registration, Login and Account management flows for passkey, biometric, social, SSO and multi-factor authentication
  • Pre-built login, registration and account management pages and components
  • OAuth2 and OpenID provider for single sign on, API access and machine-to-machine authorization
  • Low-latency permission checks based on Google's Zanzibar model and with built-in support for the Ory Permission Language

It's fully managed, highly available, developer & compliance-friendly!

  • GDPR-friendly secure storage with data locality
  • Cloud-native APIs, compatible with Ory's Open Source servers
  • Comprehensive admin tools with the web-based Ory Console and the Ory Command Line Interface (CLI)
  • Extensive documentation, straightforward examples and easy-to-follow guides
  • Fair, usage-based pricing

Sign up for a free developer account today!

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!

Get Started

You can use Docker to run Ory Hydra locally or use the Ory CLI to try out Ory Hydra:

# This example works best in Bash
bash <(curl https://raw.githubusercontent.com/ory/meta/master/install.sh) -b . ory
sudo mv ./ory /usr/local/bin/

# Or with Homebrew installed
brew install ory/tap/cli

create a new project (you may also use Docker)

ory create project --name "Ory Hydra 2.0 Example"
project_id="{set to the id from output}"

and follow the quick & easy steps below.

OAuth 2.0 Client Credentials / Machine-to-Machine

Create an OAuth 2.0 Client, and run the OAuth 2.0 Client Credentials flow:

ory create oauth2-client --project $project_id \
    --name "Client Credentials Demo" \
    --grant-type client_credentials
client_id="{set to client id from output}"
client_secret="{set to client secret from output}"

ory perform client-credentials --client-id=$client_id --client-secret=$client_secret --project $project_id
access_token="{set to access token from output}"

ory introspect token $access_token --project $project_id

OAuth 2.0 Authorize Code + OpenID Connect

Try out the OAuth 2.0 Authorize Code grant right away!

By accepting permissions openid and offline_access at the consent screen, Ory refreshes and OpenID Connect ID token,

ory create oauth2-client --project $project_id \
    --name "Authorize Code with OpenID Connect Demo" \
    --grant-type authorization_code,refresh_token \
    --response-type code \
    --redirect-uri http://127.0.0.1:4446/callback
code_client_id="{set to client id from output}"
code_client_secret="{set to client secret from output}"

ory perform authorization-code \
    --project $project_id \
    --client-id $code_client_id \
    --client-secret $code_client_secret
code_access_token="{set to access token from output}"

ory introspect token $code_access_token --project $project_id

What is Ory Hydra?

Ory Hydra is a server implementation of the OAuth 2.0 authorization framework and the OpenID Connect Core 1.0. Existing OAuth2 implementations usually ship as libraries or SDKs such as node-oauth2-server or Ory Fosite, or as fully featured identity solutions with user management and user interfaces, such as Keycloak.

Implementing and using OAuth2 without understanding the whole specification is challenging and prone to errors, even when SDKs are being used. The primary goal of Ory Hydra is to make OAuth 2.0 and OpenID Connect 1.0 better accessible.

Ory Hydra implements the flows described in OAuth2 and OpenID Connect 1.0 without forcing you to use a "Hydra User Management" or some template engine or a predefined front-end. Instead, it relies on HTTP redirection and cryptographic methods to verify user consent allowing you to use Ory Hydra with any authentication endpoint, be it Ory Kratos, authboss, User Frosting or your proprietary Java authentication.

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 [email protected] 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.

OAuth2 and OpenID Connect: Open Standards!

Ory Hydra implements Open Standards set by the IETF:

and the OpenID Foundation:

OpenID Connect Certified

Ory Hydra is an OpenID Foundation certified OpenID Provider (OP).

Ory Hydra is a certified OpenID Providier

The following OpenID profiles are certified:

To obtain certification, we deployed the reference user login and consent app (unmodified) and Ory Hydra v1.0.0.

Quickstart

This section is a starter guide to working with Ory Hydra. In-depth docs are available as well:

  • The documentation is available here.
  • The REST API documentation is available here.

Installation

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

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

Why should I use Ory Hydra? It's not that hard to implement two OAuth2 endpoints and there are numerous SDKs out there!

OAuth2 and OAuth2 related specifications are over 400 written pages. Implementing OAuth2 is easy, getting it right is hard. Ory Hydra is trusted by companies all around the world, has a vibrant community and faces millions of requests in production each day. Of course, we also compiled a security guide with more details on cryptography and security concepts. Read the security guide now.

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.

Benchmarks

Our continuous integration runs a collection of benchmarks against Ory Hydra. You can find the results here.

Telemetry

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

Documentation

Guide

The full Ory Hydra documentation 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 CHANGELOG.md.

Command line documentation

Run hydra -h or hydra help.

Develop

We love all contributions! Please read our contribution guidelines.

Dependencies

You need Go 1.13+ with GO111MODULE=on and (for the test suites):

  • Docker and Docker Compose
  • Makefile
  • NodeJS / npm

It is possible to develop Ory Hydra on Windows, but please be aware that all guides assume a Unix shell like bash or zsh.

Formatting Code

You can format all code using make format. Our CI checks if your code is properly formatted.

Running Tests

There are three types of tests you can run:

  • Short tests (do not require a SQL database like PostgreSQL)
  • Regular tests (do require PostgreSQL, MySQL, CockroachDB)
  • End to end tests (do require databases and will use a test browser)

All of the above tests can be run using the makefile. See the commands below.

Makefile commands

# quick tests
make quicktest

# regular tests
make test
test-resetdb

# end-to-end tests
make e2e
Short Tests

It is recommended to use the make file to run your tests using make quicktest , however, you can still use the go test command.

Please note:

All tests run against a sqlite in-memory database, thus it is required to use the -tags sqlite,json1 build tag.

Short tests run fairly quickly. You can either test all of the code at once:

go test -v -failfast -short -tags sqlite,json1 ./...

or test just a specific module:

go test -v -failfast -short -tags sqlite,json1 ./client

or a specific test:

go test -v -failfast -short -tags sqlite,json1 -run ^TestName$ ./...
Regular Tests

Regular tests require a database set up. Our test suite is able to work with docker directly (using ory/dockertest) but we encourage to use the Makefile instead. Using dockertest can bloat the number of Docker Images on your system and are quite slow. Instead we recommend doing:

make test

Please be aware that make test recreates the databases every time you run make test. This can be annoying if you are trying to fix something very specific and need the database tests all the time. In that case we suggest that you initialize the databases with:

make test-resetdb
export TEST_DATABASE_MYSQL='mysql://root:secret@(127.0.0.1:3444)/mysql?parseTime=true&multiStatements=true'
export TEST_DATABASE_POSTGRESQL='postgres://postgres:[email protected]:3445/postgres?sslmode=disable'
export TEST_DATABASE_COCKROACHDB='cockroach://[email protected]:3446/defaultdb?sslmode=disable'

Then you can run go test as often as you'd like:

go test -p 1 ./...

# or in a module:
cd client; go test .

E2E Tests

The E2E tests use Cypress to run full browser tests. You can execute these tests with:

make e2e

The runner will not show the Browser window, as it runs in the CI Mode (background). That makes debugging these type of tests very difficult, but thankfully you can run the e2e test in the browser which helps with debugging! Just run:

./test/e2e/circle-ci.bash memory --watch

# Or for the JSON Web Token Access Token strategy:
# ./test/e2e/circle-ci.bash memory-jwt --watch

or if you would like to test one of the databases:

make test-resetdb
export TEST_DATABASE_MYSQL='mysql://root:secret@(127.0.0.1:3444)/mysql?parseTime=true&multiStatements=true'
export TEST_DATABASE_POSTGRESQL='postgres://postgres:[email protected]:3445/postgres?sslmode=disable'
export TEST_DATABASE_COCKROACHDB='cockroach://[email protected]:3446/defaultdb?sslmode=disable'

# You can test against each individual database:
./test/e2e/circle-ci.bash postgres --watch
./test/e2e/circle-ci.bash memory --watch
./test/e2e/circle-ci.bash mysql --watch
# ...

Once you run the script, a Cypress window will appear. Hit the button "Run all Specs"!

The code for these tests is located in ./cypress/integration and ./cypress/support and ./cypress/helpers. The website you're seeing is located in ./test/e2e/oauth2-client.

OpenID Connect Conformity Tests

To run Ory Hydra against the OpenID Connect conformity suite, run

$ test/conformity/start.sh --build

and then in a separate shell

$ test/conformity/test.sh

Running these tests will take a significant amount of time which is why they are not part of the CI pipeline.

Build Docker

You can build a development Docker Image using:

make docker

Run the Docker Compose quickstarts

If you wish to check your code changes against any of the docker-compose quickstart files, run:

make docker
docker compose -f quickstart.yml up # ....

Add a new migration

  1. mkdir persistence/sql/src/YYYYMMDD000001_migration_name/
  2. Put the migration files into this directory, following the standard naming conventions. If you wish to execute different parts of a migration in separate transactions, add split marks (lines with the text --split) where desired. Why this might be necessary is explained in gobuffalo/fizz#104.
  3. Run make persistence/sql/migrations/<migration_id> to generate migration fragments.
  4. If an update causes the migration to have fewer fragments than the number already generated, run make persistence/sql/migrations/<migration_id>-clean. This is equivalent to a rm command with the right parameters, but comes with better tab completion.
  5. Before committing generated migration fragments, run the above clean command and generate a fresh copy of migration fragments to make sure the sql/src and sql/migrations directories are consistent.

Libraries and third-party projects

Official:

Community:

Developer Blog:

  • Visit the Ory Blog for guides, tutorials and articles around Ory Hydra and the Ory ecosystem.

More Repositories

1

kratos

Next-gen identity server (think Auth0, Okta, Firebase) with Ory-hardened authentication, MFA, FIDO2, TOTP, WebAuthn, profile management, identity schemas, social sign in, registration, account recovery, passwordless. Golang, headless, API-only - without templating or theming headaches. Available as a cloud service.
Go
8,361
star
2

keto

Open Source (Go) implementation of "Zanzibar: Google's Consistent, Global Authorization System". Ships gRPC, REST APIs, newSQL, and an easy and granular permission language. Supports ACL, RBAC, and other access models.
Go
4,528
star
3

dockertest

Write better integration tests! Dockertest helps you boot up ephermal docker images for your Go tests with minimal work.
Go
3,676
star
4

oathkeeper

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.
Go
3,140
star
5

ladon

A SDK for access control policies: authorization for the microservice and IoT age. Inspired by AWS IAM policies. Written for Go.
Go
2,280
star
6

fosite

Extensible security first OAuth 2.0 and OpenID Connect SDK for Go.
Go
2,218
star
7

k8s

Kubernetes Helm Charts for the ORY ecosystem.
Mustache
322
star
8

kratos-selfservice-ui-node

TypeScript
278
star
9

hydra-login-consent-node

This is an ExpressJS reference implementation for the ORY Hydra User Login and Consent interface written in TypeScript and ExpressJS.
TypeScript
266
star
10

go-acc

Accurate Code Coverage reporting for Golang (Go)
Go
208
star
11

examples-archive

THIS REPOSITORY IS NOT UP TO DATE. Different docker-based examples for ORY's services (Hydra, Keto, Oathkeeper).
Shell
129
star
12

docs

The Ory documentation
TypeScript
125
star
13

graceful

A best practice http server set up that supports graceful shutdown
Go
123
star
14

sdk

The place where ORY's SDKs are being auto-generated
C#
109
star
15

examples

A curated collection of examples and solutions created and maintained by the Ory Community.
JavaScript
103
star
16

herodot

A lightweight Go library for writing responses and errors to HTTP
Go
82
star
17

elements

Ory Elements is a component library that makes building login, registration and account pages for Ory a breeze. Check out the components library on Chromatic https://www.chromatic.com/library?appId=63b58e306cfd32348fa48d50
TypeScript
77
star
18

network

Ory runs a global end-to-end security infrastructure for humans, robots, and servers. We build and use open source software.
77
star
19

x

Libraries used in the Ory ecosystem
Go
77
star
20

kratos-selfservice-ui-react-native

A reference implementation of an app using ORY Kratos for auth (login), sign up (registration), profile settings (update password), MFA/2FA, account recovery (password reset), and more for React Native. This repository is available as an expo template!
TypeScript
68
star
21

fosite-example

Go
66
star
22

kratos-client-go

Shell
55
star
23

hydra-consent-app-go

A simple consent app for Hydra written in Go - for Hydra =< 1.0.0
Go
41
star
24

cli

The Ory CLI.
Go
38
star
25

jobs

Want to build the next generation identity stack? You've come to the right place!
37
star
26

hydra-consent-app-express

A simple nodejs consent app based on express - for Hydra =< 1.0.0
JavaScript
37
star
27

hydra-client-go

Shell
34
star
28

osin-storage

PostgreSQL storage backend for RangelReale osin OAuth2
Go
33
star
29

oathkeeper-maester

Kuberenetes CRD Controller for Ory Oathkeeper. ⚠️ Maintained by the community, not an official Ory project!
Go
32
star
30

hydra-maester

Kuberenetes CRD Controller for Ory Hydra. ⚠️ Maintained by the community, not an official Ory project!
Go
29
star
31

web

www.ory.sh
TypeScript
25
star
32

hydra-client-java

Java
25
star
33

kratos-nextjs-react-example

Add login, registration, account recovery (password reset), account verification (email verification), social sign in, multi-factor authentication to your Next.js / React App using Ory!
TypeScript
25
star
34

status

DEPRECATED
Markdown
21
star
35

closed-reference-notifier

A GitHub action to open an issue when GitHub references in your code are closed.
TypeScript
20
star
36

hydra-js

DOES NOT WORK WITH VERSIONS > 0.10.0 - A simple library to help you build node-based identity providers that work with Hydra.
JavaScript
18
star
37

go-convenience

Well-tested helpers for dealing with daily problems in Go.
Go
18
star
38

defcon-30-ctf

Go
17
star
39

redux-saga-fetch

A simple wrapper that reduces boilerplate code when using redux-saga in combination with async backend calls.
TypeScript
16
star
40

hydra-client-php

PHP
15
star
41

meta

A place where we plan and schedule our open source activities and track cross-project and ory-wide issues
Shell
15
star
42

integrations

TypeScript
14
star
43

kratos-client-php

PHP
14
star
44

keto-client-go

Shell
14
star
45

build-buf-action

A GitHub action to build and lint protobuf using buildbuf
Shell
13
star
46

encrypt-dir

A very simple cli helper that encrypts files in directories using AES-GCM (128bit)
Go
13
star
47

summit

This repository holds all material related to the Ory Summit, specifically the presentations.
11
star
48

common

Ory's cross-project go libraries, intended for internal use.
Go
11
star
49

client-go

Shell
11
star
50

docusaurus-template

DEPRECATED
JavaScript
10
star
51

works

This repository shows examples of practical solutions using Ory projects and other OSS
Go
10
star
52

oathkeeper-client-go

Shell
10
star
53

kratos-selfservice-ui-react-nextjs

Please head over to: https://github.com/ory/react-nextjs-example
9
star
54

ladon-community

Go
9
star
55

ci

Automation and robots for Ory's CI and CD pipelines
Shell
7
star
56

kratos-client-js

Autogenerated kratos SDK.
7
star
57

keto-client-java

Java
7
star
58

kratos-client-rust

Autogenerated kratos SDK.
Rust
7
star
59

kratos-client-java

Java
6
star
60

oathkeeper-client-php

PHP
6
star
61

keto-client-php

PHP
6
star
62

hydra-auth0-consent-sdk

A NodeJS library for working with Auth0 as an Identity Provider
JavaScript
6
star
63

client-dotnet

Autogenerated client SDK.
C#
6
star
64

kratos-client-ruby

Autogenerated kratos SDK.
Ruby
6
star
65

ory-config

A small Web App for configuring Ory systems built in VueJs 2.x
Vue
6
star
66

ory-sdk-go

Go
6
star
67

pagination

Go
5
star
68

kratos-client-dart

Autogenerated kratos SDK.
Dart
5
star
69

ory-sdk-archive

Shell
5
star
70

client-php

PHP
5
star
71

open-source-support

Are you looking for help above and beyond our community self service support?
5
star
72

milestone-action

JavaScript
5
star
73

eslint-config-ory-am-react

The ESLint configuration used by Ory (React specific)
JavaScript
5
star
74

themes

TypeScript
5
star
75

kratos-maester

5
star
76

hydra-client-js

Autogenerated hydra SDK.
4
star
77

label-sync-action

JavaScript
4
star
78

summit-platform

TypeScript
4
star
79

kratos-client-python

Autogenerated kratos SDK.
Python
4
star
80

keto-maester

4
star
81

metrics-middleware

A simple metrics middleware for segment.io
Go
4
star
82

sdk-js

JavaScript
4
star
83

hydra-client-dart

Autogenerated hydra SDK.
Dart
4
star
84

client-java

Java
4
star
85

homebrew-tap

Location for all of Ory's homebrew packages
Ruby
4
star
86

client-js

Autogenerated client SDK.
4
star
87

eslint-config-ory-am

The ESLint configuration used by Ory
JavaScript
3
star
88

changelog

Ory Changelog Generator
JavaScript
3
star
89

ory-client-go

3
star
90

scoop

3
star
91

slack-invite

3
star
92

oathkeeper-client-dotnet

Autogenerated oathkeeper SDK.
C#
3
star
93

oathkeeper-client-js

Autogenerated oathkeeper SDK.
3
star
94

hydra-oracle-plugin

Go
3
star
95

hydra-client-ruby

Autogenerated hydra SDK.
Ruby
3
star
96

hydra-client-rust

Autogenerated hydra SDK.
Rust
3
star
97

release

Release infrastructure for ORY and related components
HTML
3
star
98

client-python

Autogenerated client SDK.
Python
3
star
99

hydra-client-dotnet

Autogenerated hydra SDK.
C#
3
star
100

homebrew-kratos

Ruby
3
star