hydra

command module
v0.11.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 23, 2018 License: Apache-2.0 Imports: 3 Imported by: 0

README

ORY Hydra - Open Source OAuth 2 and OpenID Connect server

Chat | Forums | Newsletter

Guide | API Docs | Code Docs

Support us on patreon!


ORY Hydra is a hardened OAuth2 and OpenID Connect server optimized for low-latency, high throughput, and low resource consumption. ORY Hydra is not an identity provider (user sign up, user log in, password reset flow), but connects to your existing identity provider through a consent app. Implementing the consent app in a different language is easy, and exemplary consent apps (Go, Node) and SDKs are provided.

Besides mitigating various attack vectors, such as database compromisation and OAuth 2.0 weaknesses, ORY Hydra is able to securely manage JSON Web Keys, and has a sophisticated policy-based access control you can use if you want to. Click here to read more about security.

Build Status Coverage Status Go Report Card CII Best Practices


Table of Contents

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 fosite, or as fully featured identity solutions with user management and user interfaces, such as Dex.

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 authboss, auth0.com or your proprietary PHP authentication.

OAuth2 and OpenID Connect: Open Standards!

ORY Hydra implements Open Standards set by the IETF:

and the OpenID Foundation:

ORY Gatekeeper

ORY Gatekeeper Console

Gatekeeper is a firewall for APIs. It detects and prevents malicious requests and makes sure that no unauthorized requests reach your servers. Gatekeeper is set up in minutes, works with existing APIs, and makes use of ORY's popular open source ecosystem.

Learn more about Gatekeeper and try it for free!

Quickstart

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

  • The documentation is available on GitBook.
  • The REST API documentation is available at Apiary.

5 minutes tutorial: Run your very own OAuth2 environment

The tutorial teaches you to set up ORY Hydra, a Postgres instance and an exemplary identity provider written in React using docker compose. It will take you about 5 minutes to complete the tutorial.

OAuth2 Flow

Installation

There are various ways of installing ORY Hydra on your system.

Download binaries

The client and server binaries are downloadable at releases. There is currently no installer available. You have to add the ORY Hydra binary to the PATH environment variable yourself or put the binary in a location that is already in your path (/usr/bin, ...). If you do not understand what that all of this means, ask in our chat channel. We are happy to help.

Using Docker

Starting the host is easiest with docker. The host process handles HTTP requests and is backed by a database. Read how to install docker on Linux, OSX or Windows. ORY Hydra is available on Docker Hub.

You can use ORY Hydra without a database, but be aware that restarting, scaling or stopping the container will lose all data:

$ docker run -e "DATABASE_URL=memory" -e "ISSUER=https://localhost:4444/" -d --name my-hydra -p 4444:4444 oryd/hydra
ec91228cb105db315553499c81918258f52cee9636ea2a4821bdb8226872f54b

Note: We had to create a new docker hub repository. Tags prior to 0.7.5 are available here.

Using the client command line interface: You can ssh into the ORY Hydra container and execute the ORY Hydra command from there:

$ docker exec -i -t <hydra-container-id> /bin/sh
# e.g. docker exec -i -t ec91228 /bin/sh

root@ec91228cb105:/go/src/github.com/ory/hydra# hydra
Hydra is a twelve factor OAuth2 and OpenID Connect provider

[...]
Building from source

If you wish to compile ORY Hydra yourself, you need to install and set up Go 1.9+ and add $GOPATH/bin to your $PATH as well as golang/dep. To do so, run the following commands in a shell (bash, sh, cmd.exe, ...):

go get -d -u github.com/ory/hydra
cd $GOPATH/src/github.com/ory/hydra
dep ensure
go install github.com/ory/hydra
hydra

Notes

  • We changed organization name from ory-am to ory. In order to keep backwards compatibility, we did not rename Go packages.
  • You can ignore warnings similar to package github.com/ory/hydra/cmd/server: case-insensitive import collision: "github.com/Sirupsen/logrus" and "github.com/sirupsen/logrus".

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 and send us an email to hi@ory.am instead.

Telemetry

ORY Hydra collects summarized, anonymized telemetry which can optionally be turned off. Click here to learn more.

Sponsors

ORY Hydra is open source with a permissive license. We are a dedicated, young but also experienced team of developers in the area of cloud computing and internet security. Please support our mission for a safer web and become a sponsor, buy an engineer membership, or tell us why and how you are using ORY Hydra.

Sponsorship

Become a ORY Hydra sponsor now and help keep the project open source, free, and maintained. Additionally, sponsors unlock

  • Access to ORY's private slack community.
  • Featured logo & link in the readme and on the website.
  • placement in release announcements.

Sponsorship starts at 600$ per month. We accept smaller contributions as well, but without the benefits listed above.

Sponsors

Auth0.com

We are proud to have Auth0 as a gold sponsor for ORY Hydra. Auth0 solves the most complex identity use cases with an extensible and easy to integrate platform that secures billions of logins every year. At ORY, we use Auth0 in conjunction with ORY Hydra for various internal projects.


Documentation

Guide

The Guide is available on GitBook.

HTTP API documentation

The HTTP API is documented at Apiary.

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 hydra -h or hydra help.

Develop

Developing with ORY Hydra is as easy as:

go get -d -u github.com/ory/hydra
cd $GOPATH/src/github.com/ory/hydra
dep ensure
go test ./...

Then run it with in-memory database:

DATABASE_URL=memory go run main.go host

Notes

  • We changed organization name from ory-am to ory. In order to keep backwards compatibility, we did not rename Go packages.
  • You can ignore warnings similar to package github.com/ory/hydra/cmd/server: case-insensitive import collision: "github.com/sirupsen/logrus" and "github.com/sirupsen/logrus".

Reception

Hydra has received a lot of positive feedback. Let's see what the community is saying:

Nice! Lowering barriers to the use of technologies like these is important.

Pyxl101

OAuth is a framework not a protocol. The security it provides can vary greatly between implementations. Fosite (which is what this is based on) is a very good implementation from a security perspective: https://github.com/ory/fosite#a-word-on-security

abritishguy

[...] Thanks for releasing this by the way, looks really well engineered. [...]

Libraries and third-party projects

Official:

Community:

Blog posts & articles

Documentation

Overview

Package main Hydra OAuth2 & OpenID Connect Server

Please refer to the user guide for in-depth documentation: https://ory.gitbooks.io/hydra/content/

Hydra offers OAuth 2.0 and OpenID Connect Core 1.0 capabilities as a service. Hydra is different, because it works with any existing authentication infrastructure, not just LDAP or SAML. By implementing a consent app (works with any programming language) you build a bridge between Hydra and your authentication infrastructure. Hydra is able to securely manage JSON Web Keys, and has a sophisticated policy-based access control you can use if you want to. Hydra is suitable for green- (new) and brownfield (existing) projects. If you are not familiar with OAuth 2.0 and are working on a greenfield project, we recommend evaluating if OAuth 2.0 really serves your purpose. Knowledge of OAuth 2.0 is imperative in understanding what Hydra does and how it works.

The official repository is located at https://github.com/ory/hydra

### Important REST API Documentation Notes

The swagger generator used to create this documentation does currently not support example responses. To see request and response payloads click on **"Show JSON schema"**: ![Enable JSON Schema on Apiary](https://storage.googleapis.com/ory.am/hydra/json-schema.png)

The API documentation always refers to the latest tagged version of ORY Hydra. For previous API documentations, please refer to https://github.com/ory/hydra/blob/<tag-id>/docs/api.swagger.yaml - for example:

- 0.9.13: https://github.com/ory/hydra/blob/v0.9.13/docs/api.swagger.yaml - 0.8.1: https://github.com/ory/hydra/blob/v0.8.1/docs/api.swagger.yaml

Schemes: http, https
Host:
BasePath: /
Version: Latest
License: Apache 2.0 https://github.com/ory/hydra/blob/master/LICENSE
Contact: ORY <hi@ory.am> https://www.ory.am

Consumes:
- application/json
- application/x-www-form-urlencoded

Produces:
- application/json

SecurityDefinitions:
oauth2:
    type: oauth2
    authorizationUrl: https://your-hydra-instance.com/oauth2/auth
    tokenUrl: https://your-hydra-instance.com/oauth2/token
    flow: accessCode
    scopes:
      hydra.clients: "A scope required to manage OAuth 2.0 Clients"
      hydra.policies: "A scope required to manage access control policies"
      hydra.warden: "A scope required to make access control inquiries"
      hydra.warden.groups: "A scope required to manage warden groups"
      hydra.keys.get: "A scope required to fetch JSON Web Keys"
      hydra.keys.create: "A scope required to create JSON Web Keys"
      hydra.keys.delete: "A scope required to delete JSON Web Keys"
      hydra.keys.update: "A scope required to get JSON Web Keys"
      hydra.consent: "A scope required to fetch and modify consent requests"
      offline: "A scope required when requesting refresh tokens"
      openid: "Request an OpenID Connect ID Token"
basic:
    type: basic

Extensions:
---
x-request-id: string
x-forwarded-proto: string
---

swagger:meta

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL