• Stars
    star
    129
  • Rank 279,262 (Top 6 %)
  • Language
    Shell
  • License
    Apache License 2.0
  • Created over 6 years ago
  • Updated almost 2 years ago

Reviews

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

Repository Details

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

ORY Ecosystem Deployment Examples

CircleCI

This repository contains deployment examples and templates for the ORY Ecosystem. This repository does not contain examples for the ORY Editor, but ORY Hydra, ORY Oathkeeper, and ORY Keto.

Overview

Each example typically consists of these parts:

  • docker-compose.yml: The definition for docker-compose.
  • supervisord.conf: Configuration for supervisord which runs multiple services at once in one Docker container.
  • config: Contains configuration items (typically JSON files) for OAuth 2.0 Clients, Access Control Policies, and so on.
  • Dockerfile: A customized Dockerfile that is capable of running supervisord as well as each service.

Please be aware that you can't run multiple examples at once as ports will clash. Use make rm-<example-name> to kill and remove the containers of a running example before starting up another one.

Scripts

We wrote several helper scripts capable of:

  • Substituting environment variables in JSON files
  • Retrying statements on failure
  • Importing JSON files to the respective services (ORY Hydra, ORY Keto, ORY Oathkeeper)

You will encounter several environment variables in each docker-compose.yml file. These are either used for the services directly (e.g. HYDRA_DATABASE_URL) or are used for variable substitution in the configuration files (e.g. HYDRA_SUBJECT_PREFIX).

Typically, environment variables are prefixed with the service name they are used for - so HYDRA_DATABASE_URL is the DATABASE_URL environment variable for ORY Hydra. We use variable substitution in the supervisord.conf file to achieve that.

Examples

This repository provides several examples. Each example is documented in detail in the example's README.

  • Full Stack: This example sets up all ORY services, the exemplary User Login and Consent Application, the exemplary OAuth 2.0 Consumer Application, and an exemplary Resource Server as well as example policies and OAuth 2.0 Clients.
  • Basic ORY Hydra setup: This example sets up ORY Hydra and our exemplary User Login and Consent Application. It is the minimal required set up for ORY Hydra which you can use to start experimenting.
  • Backwards-compatible template: This example provides a Docker Image that offers a backwards compatible (for versions 0.11.0 / 0.10.0) experience by combining ORY Oathkeeper, ORY Keto, and ORY Hydra in the same Docker Image.

Apps

This repository contains two exemplary applications, both written in NodeJS with Express. The idea here is to show you the different ways you can authorize requests on both sides (consumer, resource server) and shows the difference in approaches of protecting your services with ORY Keto, ORY Oathkeeper, ORY Hydra, or any combination of the three.

The application's code has been documented, and we encourage you to read it. Please note that almost all SDKs used (like Passport.js) are built on open standards such as OAuth 2.0. If you do not write applications in NodeJS you will be able to find SDKs with similar functionality in other languages.

Please note that the code is making use of some ES6 features, such as arrow functions, as well as async/await. Additionally, don't be fooled by ~100 Lines of Code. We packed everything in one file so you have a better time navigating the source code. The most interesting files will be the ones contained in the routes directory. All other files are either boilerplate ExpressJS or HTML views, with minimal changes to the ExpressJS middleware in each respective ./app.js file.

Resource Server

A resource server is an application that, for example, exposes a CRUD API for modifying blog articles. Resource servers are usually protected - you don't want a hacker to be able to delete all your blog articles - and require valid credentials (authentication) as well as a certain permission (e.g. alice is allowed to modify this article) in order to execute the action.

There are different types of credentials (Cookie, JSON Web Token, OAuth 2.0 Access Token, ...) that can be used to protect a resource server. Therefore, the resource server has several different routes:

  • /introspect: This route requires that an OAuth 2.0 Access Token is included in the HTTP header (Authorization: bearer <token>) and uses the OAuth 2.0 Token Introspection flow to validate the token.
  • /oathkeeper: This route also accepts a bearer token (Authorization: bearer <token>) but this time it has to be a JSON Web Token signed by ORY Oathkeeper.
  • /warden/: This route uses the ORY Keto Warden API to check if a request is allowed to perform the request. It consists of two subroutes:
    • /warden/access-token: This endpoint requires an OAuth 2.0 Access Token in the HTTP header (Authorization: bearer <token>) and checks if the token's subject is allowed to perform the requested action using ORY Keto.
    • /warden/subject: This endpoint requires HTTP Basic Auth (Authorization: basic ...) and checks if the provided credentials match the username/password pairs (peter:password1, bob:password2) and if so, asks the ORY Keto Warden API if the user (e.g. peter, bob, alice) is allowed to perform the action.

Consumer Application

The consumer application is a web server that fetches data from the backend ("resource server") and displays it. In this particular case, the application makes requests to different Resource Server endpoints.

The consumer application has several routes (e.g. /articles/secure-backend-with-oauth2-token-introspection) which use different endpoints at the Resource Server. The idea here is to show you the different ways you can authorize requests on both sides (consumer, resource server).

Some endpoints in the consumer application require a valid OAuth 2.0 Access Token from the user. When accessing one of those endpoints, you will be redirected to ORY Hydra and asked to login in and grant the application the required scopes. Make sure to select all scopes or the examples might not work.

Development

In case you wish to develop one of the projects and test them out with the examples here, first build the docker images for each project:

docker build -t oryd/hydra:dev $GOPATH/src/github.com/ory/hydra/
docker build -t oryd/oathkeeper:dev $GOPATH/src/github.com/ory/oathkeeper/
docker build -t oryd/keto:dev $GOPATH/src/github.com/ory/keto/

then run Docker Compose in the example you would wish to test and set the version tags to dev:

$ cd some/example
$ LOGIN_CONSENT_VERSION=v1.0.0-beta.2 HYDRA_VERSION=dev KETO_VERSION=dev OATHKEEPER_VERSION=dev docker-compose up --build -d

More Repositories

1

hydra

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.
Go
14,588
star
2

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
3

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,745
star
4

dockertest

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

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,220
star
6

fosite

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

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
8

k8s

Kubernetes Helm Charts for the ORY ecosystem.
Mustache
330
star
9

kratos-selfservice-ui-node

TypeScript
278
star
10

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
11

go-acc

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

sdk

The place where ORY's SDKs are being auto-generated
PHP
137
star
13

docs

The Ory documentation
TypeScript
132
star
14

graceful

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

examples

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

x

Libraries used in the Ory ecosystem
Go
86
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
85
star
18

herodot

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

kratos-selfservice-ui-react-nextjs

A full reference implementation for designing your own login, registration, recovery, verification, ... pages using Ory Kratos' APIs.
TypeScript
81
star
20

network

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

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
22

fosite-example

Go
66
star
23

kratos-client-go

Shell
55
star
24

cli

Create bulk action scripts, automate your tasks, manage your projects, and seamlessly interact with the Ory Network using the Ory command line interface (CLI).
Go
42
star
25

hydra-consent-app-go

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

jobs

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

hydra-consent-app-express

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

hydra-client-go

Shell
34
star
29

oathkeeper-maester

Kuberenetes CRD Controller for Ory Oathkeeper. โš ๏ธ Maintained by the community, not an official Ory project!
Go
33
star
30

osin-storage

PostgreSQL storage backend for RangelReale osin OAuth2
Go
33
star
31

hydra-maester

Kuberenetes CRD Controller for Ory Hydra. โš ๏ธ Maintained by the community, not an official Ory project!
Go
32
star
32

web

www.ory.sh
TypeScript
25
star
33

hydra-client-java

Java
25
star
34

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
35

status

DEPRECATED
Markdown
21
star
36

closed-reference-notifier

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

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
38

go-convenience

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

defcon-30-ctf

Go
17
star
40

meta

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

redux-saga-fetch

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

hydra-client-php

PHP
15
star
43

integrations

TypeScript
14
star
44

kratos-client-php

PHP
14
star
45

keto-client-go

Shell
14
star
46

build-buf-action

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

encrypt-dir

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

summit

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

common

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

client-go

Shell
11
star
51

docusaurus-template

DEPRECATED
JavaScript
10
star
52

works

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

oathkeeper-client-go

Shell
10
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

client-dotnet

Autogenerated client SDK.
C#
6
star
63

hydra-auth0-consent-sdk

A NodeJS library for working with Auth0 as an Identity Provider
JavaScript
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

kratos-client-dart

Autogenerated kratos SDK.
Dart
5
star
68

ory-sdk-archive

Shell
5
star
69

pagination

Go
5
star
70

client-php

PHP
5
star
71

milestone-action

JavaScript
5
star
72

eslint-config-ory-am-react

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

themes

TypeScript
5
star
74

open-source-support

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

kratos-maester

5
star
76

hydra-client-dart

Autogenerated hydra SDK.
Dart
4
star
77

hydra-client-js

Autogenerated hydra SDK.
4
star
78

homebrew-tap

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

label-sync-action

JavaScript
4
star
80

summit-platform

TypeScript
4
star
81

kratos-client-python

Autogenerated kratos SDK.
Python
4
star
82

keto-maester

4
star
83

metrics-middleware

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

sdk-js

JavaScript
4
star
85

client-java

Java
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

scoop

3
star
90

ory-client-go

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

hydra-client-dotnet

Autogenerated hydra SDK.
C#
3
star
99

homebrew-kratos

Ruby
3
star
100

keto-client-python

Autogenerated keto SDK.
3
star