Skip to content

Commit cd6daed

Browse files
authored
0.4.0 (#203)
* warden: token introspection is urlencoded, not json - closes #199 * warden: move IntrospectToken from warden sdk to oauth2 - closes #201 * warden: rename InspectToken to IntrospectToken - closes #200 * oauth2: introspection should return custom session values - closes #205 * oauth2: consent strategy should use at_ext for access token session data - closes #198 * docs: move docs from gitbook to github - closes #204
1 parent c8c67dc commit cd6daed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+1514
-717
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@ node_modules/
88
.DS_Store
99
vendor/
1010
.hydra.yml
11-
cover.out
11+
cover.out
12+
output/
13+
_book/

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ language: go
1111
go:
1212
- 1.5
1313
- 1.6
14+
- 1.7
1415

1516
install:
1617
- go get github.com/mattn/goveralls golang.org/x/tools/cmd/cover github.com/pierrre/gotestcover github.com/Masterminds/glide

README.md

Lines changed: 36 additions & 413 deletions
Large diffs are not rendered by default.

book.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
{
2-
"root": "./docs/"
2+
"root": "./docs",
3+
"author": "Aeneas Rekkas",
4+
"gitbook": ">=3.2.0"
35
}

cmd/cli/handler_warden.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func (h *WardenHandler) IsAuthorized(cmd *cobra.Command, args []string) {
3434
}
3535

3636
scopes, _ := cmd.Flags().GetStringSlice("scopes")
37-
res, err := h.M.InspectToken(context.Background(), args[0], scopes...)
37+
res, err := h.M.TokenValid(context.Background(), args[0], scopes...)
3838
pkg.Must(err, "Could not validate token: %s", err)
3939

4040
out, err := json.MarshalIndent(res, "", "\t")

docs/README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# What is [Hydra](https://github.com/ory-am/hydra)?
2+
3+
At first, there was the monolith. The monolith worked well with the bespoke authentication module.
4+
Then, the web evolved into an elastic cloud that serves thousands of different user agents
5+
in every part of the world.
6+
7+
Hydra is driven by the need for a **scalable in memory
8+
OAuth2 and OpenID Connect** layer, that integrates with every Identity Provider you can imagine.
9+
10+
Hydra is available through [Docker](https://hub.docker.com/r/oryam/hydra/) and at [GitHub](https://github.com/ory-am/hydra).
11+
12+
### Feature Overview
13+
14+
1. **Availability:** Hydra uses pub/sub to have the latest data available in memory. The in-memory architecture allows for heavy duty workloads.
15+
2. **Scalability:** Hydra scales effortlessly on every platform you can imagine, including Heroku, Cloud Foundry, Docker,
16+
Google Container Engine and many more.
17+
3. **Integration:** Hydra wraps your existing stack like a blanket and keeps it safe. Hydra uses cryptographic tokens for authenticate users and request their consent, no APIs required.
18+
The deprecated php-3.0 authentication service your intern wrote? It works with that too, don't worry.
19+
We wrote an example with React to show you how this could look like: [React.js Identity Provider Example App](https://github.com/ory-am/hydra-idp-react).
20+
4. **Security:** Hydra leverages the security first OAuth2 framework **[Fosite](https://github.com/ory-am/fosite)**,
21+
encrypts important data at rest, and supports HTTP over TLS (https) out of the box.
22+
5. **Ease of use:** Developers and Operators are human. Therefore, Hydra is easy to install and manage. Hydra does not care if you use React, Angular, or Cocoa for your user interface.
23+
To support you even further, there are APIs available for *cryptographic key management, social log on, policy based access control, policy management, and two factor authentication (tbd)*
24+
Hydra is packaged using [Docker](https://hub.docker.com/r/oryam/hydra/).
25+
6. **Open Source:** Hydra is licensed Apache Version 2.0
26+
7. **Professional:** Hydra implements peer reviewed open standards published by [The Internet Engineering Task Force (IETF®)](https://www.ietf.org/) and the [OpenID Foundation](https://openid.net/)
27+
and under supervision of the [LMU Teaching and Research Unit Programming and Modelling Languages](http://www.en.pms.ifi.lmu.de). No funny business.
28+
8. **Real Time:** Operation is a lot easier with real time monitoring. Because Hydra leverages RethinkDB, you get real time monitoring for free.
29+

docs/SUMMARY.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Summary
2+
3+
* [Introduction](README.md)
4+
* [Basics](basics.md)
5+
* [Architecture](basics/architecture.md)
6+
* [Security](basics/security.md)
7+
* [Interoperability](basics/interoperability.md)
8+
* [5 Minutes Tutorial](demo.md)
9+
* [Installation](install.md)
10+
* Core Capabilities
11+
* [OAuth2 & OpenID Connect](oauth2.md)
12+
* [OAuth2 Basics](oauth2/basics.md)
13+
* [OpenID Connect Basics](oauth2/openid.md)
14+
* [Consent Flow](oauth2/consent.md)
15+
* [JSON Web Keys](jwk.md)
16+
* [Access Control](access-control.md)
17+
* [Policy Introduction](access-control/policies.md)
18+
* [The Warden](access-control/warden.md)
19+
* [OAuth2 Token Introspection](access-control/introspection.md)
20+
* [Manage Social Logins](sso.md)
21+
* [SDK](sdk.md)
22+
* [Go SDK](sdk/go.md)
23+
* [FAQ](faq.md)
24+
* [What does *"eventually consistent"* mean?](faq/consistency.md)
25+
* [Where is the HTTP API Documentation?](faq/http-api.md)
26+
* [How can I disable HTTPS for testing?](faq/disable-https.md)
27+
* [How can I import TLS certificates?](faq/https-tls-import.md)
28+
* [Can I set the log level to warn, error, debug, ...?](faq/log-level.md)
29+
* [Should I use OAuth2 tokens for authentication?](faq/oauth2-auth.md)
30+
* [What will happen if an error occurs during an OAuth2 flow?](faq/oauth2-error.md)
31+
* [Why isn't the redirect url working?](faq/redirect-uri.md)
32+
* [How can I import a custom CA for RethinkDB?](faq/rethink-ca.md)
33+
* [How do I know if OAuth2 / Hydra is the right choice for me?](faq/when-use.md)

docs/access-control.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Access Control
2+
3+
Hydra offers various access control methods. Resource providers (e.g. photo/user/asset/balance/... service) use
4+
5+
1. **Warden Token Validation** to validate access tokens
6+
2. **Warden Access Control with Access Tokens** to validate access tokens and decide
7+
if the token's subject is allowed to perform the request
8+
3. **Warden Access Control without Access Tokens** to decide if any subject is allowed
9+
to perform a request
10+
11+
whereas third party apps (think of a facebook app) use
12+
13+
1. **OAuth2 Token Introspection** to validate access tokens.
14+
15+
There are two common ways to solve access control in a distributed environment (e.g. microservices).
16+
17+
1. Your services are behind a gateway (e.g. access control, rate limiting, and load balancer)
18+
that does the access control for them. This is known as a "trusted network/subnet".
19+
2. Clients (e.g. Browser) talk to your services
20+
directly. The services are responsible for checking access privileges themselves.
21+
22+
In both cases, you would use on of the warden endpoints.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# OAuth2 Token Introspection
2+
3+
OAuth2 Token Introspection is an [IETF](https://tools.ietf.org/html/rfc7662) standard.
4+
It defines a method for a protected resource to query
5+
an OAuth 2.0 authorization server to determine the active state of an
6+
OAuth 2.0 token and to determine meta-information about this token.
7+
OAuth 2.0 deployments can use this method to convey information about
8+
the authorization context of the token from the authorization server
9+
to the protected resource.
10+
11+
In order to make a successful Token Introspection request, the audience of the access token you are introspecting
12+
*must* match the subject of the access token you are using to access the introspection endpoint.
13+
14+
The Token Introspection endpoint is documented in more detail [here](http://docs.hdyra.apiary.io/#reference/oauth2/oauth2-token-introspection).

docs/access-control/policies.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# Access Control Policies
2+
3+
Hydra uses the Access Control Library [Ladon](https://github.com/ory-am/ladon).
4+
For a deep dive, it is a good idea to read the [Ladon Docs](https://github.com/ory-am/ladon#ladon).
5+
6+
In Hydra, policy based access control is when you decide if:
7+
8+
- Aaron (subject) is allowed (effect) to create (action) a new forum post (resource) when accessing the forum website from IP 192.168.178.3 (context).
9+
- Richard (subject) is allowed (effect) to delete (action) a status update (resource) when he is the author (context).
10+
11+
Or, more *generalized:* **Who** is **able** to do **what** on **something** with some **context**.
12+
13+
* **Who (Subject)**: An arbitrary unique subject name, for example "ken" or "printer-service.mydomain.com".
14+
* **Able (Effect)**: The effect which is always "allow" or "deny".
15+
* **What (Action)**: An arbitrary action name, for example "delete", "create" or "scoped:action:something".
16+
* **Something (Resource)**: An arbitrary unique resource name, for example "something", "resources:articles:1234" or some uniform resource name like "urn:isbn:3827370191".
17+
* **Context (Context)**: The current context which may environment information like the IP Address, request date, the resource owner name, the department ken is working in and anything you like.
18+
19+
Policies are JSON documents managed via the [Policy API](http://docs.hdyra.apiary.io/#reference/policies).
20+
21+
```
22+
{
23+
// A required unique identifier. Used primarily for database retrieval.
24+
"id": "68819e5a-738b-41ec-b03c-b58a1b19d043",
25+
26+
// A optional human readable description.
27+
"description": "something humanly readable",
28+
29+
// A subject can be an user or a service. It is the "who" in "who is allowed to do what on something".
30+
// As you can see here, you can use regular expressions inside < >.
31+
"subjects": ["user", "<peter|max>"],
32+
33+
34+
// Should access be allowed or denied?
35+
// Note: If multiple policies match an access request, ladon.DenyAccess will always override ladon.AllowAccess
36+
// and thus deny access.
37+
"effect": "allow",
38+
39+
// Which resources this policy affects.
40+
// Again, you can put regular expressions in inside < >.
41+
"resources": ["articles:<[0-9]+>"],
42+
43+
// Which actions this policy affects. Supports RegExp
44+
// Again, you can put regular expressions in inside < >.
45+
"actions": ["create","update"],
46+
47+
// Under which conditions this policy is "active".
48+
"conditions": {
49+
"owner": {
50+
// In this example, the policy is only "active" when the requested subject is the owner of the resource as well.
51+
"type": "EqualsSubjectCondition",
52+
"options": {}
53+
}
54+
}
55+
}
56+
```
57+
58+
## Examples
59+
60+
### Let everyone read public JWKs
61+
62+
```
63+
[
64+
{
65+
"description": "Allow everyone including anonymous users to read JSON Web Keys having Key ID *public*.",
66+
"subject": ["<.*>"],
67+
"effect": "allow",
68+
"resources": [
69+
"rn:hydra:keys:<[^:]+>:public"
70+
],
71+
"permissions": [
72+
"get"
73+
]
74+
}
75+
]
76+
```
77+
78+
### Deny anyone from reading private JWKs
79+
80+
```
81+
[
82+
{
83+
"description": "Explicitly deny everyone reading JSON Web Keys with Key ID *private*.",
84+
"subject": ["<.*>"],
85+
"effect": "allow",
86+
"resources": [
87+
"rn:hydra:keys:<[^:]+>:private"
88+
],
89+
"permissions": [
90+
"get"
91+
]
92+
}
93+
]
94+
```

0 commit comments

Comments
 (0)