Skip to content

Commit 591f524

Browse files
authored
mutator/id_token: Add claim templating (#246)
1 parent f140837 commit 591f524

File tree

118 files changed

+1705
-1152
lines changed

Some content is hidden

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

118 files changed

+1705
-1152
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
---
22
name: Bug report
33
about: Create a report to help us improve
4-
54
---
65

76
**Describe the bug**
@@ -18,15 +17,15 @@ Steps to reproduce the behavior:
1817
3. Request fails with response: `{"some": "error"}`
1918
-->
2019

21-
*Server logs*
20+
_Server logs_
2221

2322
<!--
2423
```
2524
log=error ....
2625
```
2726
-->
2827

29-
*Server configuration*
28+
_Server configuration_
3029

3130
<!--
3231
PLEASE OMIT SENSITIVE VALUES
@@ -44,8 +43,8 @@ A clear and concise description of what you expected to happen.
4443

4544
**Environment**
4645

47-
* Version: v1.2.3, git sha hash
48-
* Environment: Debian, Docker, ...
46+
- Version: v1.2.3, git sha hash
47+
- Environment: Debian, Docker, ...
4948

5049
**Additional context**
5150

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
---
22
name: Feature request
33
about: Suggest an idea for this project
4-
54
---
65

76
**Is your feature request related to a problem? Please describe.**
87

9-
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
8+
A clear and concise description of what the problem is. Ex. I'm always
9+
frustrated when [...]
1010

1111
**Describe the solution you'd like**
1212

1313
A clear and concise description of what you want to happen.
1414

1515
**Describe alternatives you've considered**
1616

17-
A clear and concise description of any alternative solutions or features you've considered.
17+
A clear and concise description of any alternative solutions or features you've
18+
considered.
1819

1920
**Additional context**
2021

2122
Add any other context or screenshots about the feature request here.
22-

.github/ISSUE_TEMPLATE/support.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
---
22
name: Support request
3-
about: Please use our forums (community.ory.sh) or the chat (ory.sh/chat) to ask for support
4-
3+
about:
4+
Please use our forums (community.ory.sh) or the chat (ory.sh/chat) to ask for
5+
support
56
---
67

7-
Please use issues only to file potential bugs or request features. For everything else please go to
8-
the [ORY Community](https://community.ory.sh/) or join the [ORY Chat](https://www.ory.sh/chat).
8+
Please use issues only to file potential bugs or request features. For
9+
everything else please go to the [ORY Community](https://community.ory.sh/) or
10+
join the [ORY Chat](https://www.ory.sh/chat).

.github/PULL_REQUEST_TEMPLATE.md

+7-3
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,15 @@ them, don't hesitate to ask. We're here to help! This is simply a reminder of wh
2626

2727
- [ ] I have read the [contributing guidelines](../blob/master/CONTRIBUTING.md)
2828
- [ ] I have read the [security policy](../security/policy)
29-
- [ ] I confirm that this pull request does not address a security vulnerability. If this pull request addresses a security
30-
vulnerability, I confirm that I got green light (please contact [security@ory.sh](mailto:security@ory.sh)) from the maintainers to push the changes.
29+
- [ ] I confirm that this pull request does not address a security
30+
vulnerability. If this pull request addresses a security vulnerability, I
31+
confirm that I got green light (please contact
32+
[security@ory.sh](mailto:security@ory.sh)) from the maintainers to push
33+
the changes.
3134
- [ ] I have added tests that prove my fix is effective or that my feature works
3235
- [ ] I have added necessary documentation within the code base (if appropriate)
33-
- [ ] I have documented my changes in the [developer guide](https://github.com/ory/docs) (if appropriate)
36+
- [ ] I have documented my changes in the
37+
[developer guide](https://github.com/ory/docs) (if appropriate)
3438

3539
## Further comments
3640

CHANGELOG.md

+563-202
Large diffs are not rendered by default.

CONTRIBUTING.md

+72-45
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
44
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
5+
56
**Table of Contents**
67

78
- [Introduction](#introduction)
@@ -16,78 +17,104 @@
1617

1718
## Introduction
1819

19-
Please note: We take ORY Oathkeeper's security and our users' trust very seriously. If you believe you have found a
20-
security issue in ORY Oathkeeper, please responsibly disclose by contacting us at hi@ory.sh.
20+
Please note: We take ORY Oathkeeper's security and our users' trust very
21+
seriously. If you believe you have found a security issue in ORY Oathkeeper,
22+
please responsibly disclose by contacting us at hi@ory.sh.
2123

22-
First: if you're unsure or afraid of anything, just ask or submit the issue or pull request anyways. You won't be
23-
yelled at for giving it your best effort. The worst that can happen is that you'll be politely asked to change
24-
something. We appreciate any sort of contributions, and don't want a wall of rules to get in the way of that.
24+
First: if you're unsure or afraid of anything, just ask or submit the issue or
25+
pull request anyways. You won't be yelled at for giving it your best effort. The
26+
worst that can happen is that you'll be politely asked to change something. We
27+
appreciate any sort of contributions, and don't want a wall of rules to get in
28+
the way of that.
2529

26-
That said, if you want to ensure that a pull request is likely to be merged, talk to us! You can find out our thoughts
27-
and ensure that your contribution won't clash or be obviated by ORY Oathkeeper's normal direction. A great way to do this is via
28-
the [ORY Community](https://community.ory.sh/) or join the [ORY Chat](https://www.ory.sh/chat).
30+
That said, if you want to ensure that a pull request is likely to be merged,
31+
talk to us! You can find out our thoughts and ensure that your contribution
32+
won't clash or be obviated by ORY Oathkeeper's normal direction. A great way to
33+
do this is via the [ORY Community](https://community.ory.sh/) or join the
34+
[ORY Chat](https://www.ory.sh/chat).
2935

3036
## Contributing Code
3137

32-
Unless you are fixing a known bug, we **strongly** recommend discussing it with the core team via a GitHub issue or
33-
[in our chat](https://www.ory.sh/chat) before getting started to ensure your work is consistent with
34-
ORY Oathkeeper's roadmap and architecture.
38+
Unless you are fixing a known bug, we **strongly** recommend discussing it with
39+
the core team via a GitHub issue or [in our chat](https://www.ory.sh/chat)
40+
before getting started to ensure your work is consistent with ORY Oathkeeper's
41+
roadmap and architecture.
3542

36-
All contributions are made via pull request. Note that **all patches from all contributors get reviewed**. After a pull
37-
request is made other contributors will offer feedback, and if the patch passes review a maintainer will accept it with
38-
a comment. When pull requests fail testing, authors are expected to update their pull requests to address the failures
39-
until the tests pass and the pull request merges successfully.
43+
All contributions are made via pull request. Note that **all patches from all
44+
contributors get reviewed**. After a pull request is made other contributors
45+
will offer feedback, and if the patch passes review a maintainer will accept it
46+
with a comment. When pull requests fail testing, authors are expected to update
47+
their pull requests to address the failures until the tests pass and the pull
48+
request merges successfully.
4049

41-
At least one review from a maintainer is required for all patches (even patches from maintainers).
50+
At least one review from a maintainer is required for all patches (even patches
51+
from maintainers).
4252

43-
Reviewers should leave a "LGTM" comment once they are satisfied with the patch. If the patch was submitted by a
44-
maintainer with write access, the pull request should be merged by the submitter after review.
53+
Reviewers should leave a "LGTM" comment once they are satisfied with the patch.
54+
If the patch was submitted by a maintainer with write access, the pull request
55+
should be merged by the submitter after review.
4556

4657
## Disclosing vulnerabilities
4758

48-
Please disclose vulnerabilities exclusively to [hi@ory.am](mailto:hi@ory.am). Do not use GitHub issues.
59+
Please disclose vulnerabilities exclusively to [hi@ory.am](mailto:hi@ory.am). Do
60+
not use GitHub issues.
4961

5062
## Code Style
5163

5264
Please follow these guidelines when formatting source code:
5365

54-
* Go code should match the output of `gofmt -s`
66+
- Go code should match the output of `gofmt -s`
5567

5668
## Pull request procedure
5769

58-
To make a pull request, you will need a GitHub account; if you are unclear on this process, see GitHub's
59-
documentation on [forking](https://help.github.com/articles/fork-a-repo) and [pull requests](https://help.github.com/articles/using-pull-requests).
60-
Pull requests should be targeted at the `master` branch. Before creating a pull request, go through this checklist:
70+
To make a pull request, you will need a GitHub account; if you are unclear on
71+
this process, see GitHub's documentation on
72+
[forking](https://help.github.com/articles/fork-a-repo) and
73+
[pull requests](https://help.github.com/articles/using-pull-requests). Pull
74+
requests should be targeted at the `master` branch. Before creating a pull
75+
request, go through this checklist:
6176

6277
1. Create a feature branch off of `master` so that changes do not get mixed up.
63-
1. [Rebase](http://git-scm.com/book/en/Git-Branching-Rebasing) your local changes against the `master` branch.
64-
1. Run the full project test suite with the `go test ./...` (or equivalent) command and confirm that it passes.
78+
1. [Rebase](http://git-scm.com/book/en/Git-Branching-Rebasing) your local
79+
changes against the `master` branch.
80+
1. Run the full project test suite with the `go test ./...` (or equivalent)
81+
command and confirm that it passes.
6582
1. Run `gofmt -s` (if the project is written in Go).
66-
1. Ensure that each commit has a subsystem prefix (ex: `controller: `).
83+
1. Ensure that each commit has a subsystem prefix (ex: `controller:`).
6784

68-
Pull requests will be treated as "review requests," and maintainers will give feedback on the style and substance of the patch.
85+
Pull requests will be treated as "review requests," and maintainers will give
86+
feedback on the style and substance of the patch.
6987

70-
Normally, all pull requests must include tests that test your change. Occasionally, a change will
71-
be very difficult to test for. In those cases, please include a note in your commit message explaining why.
88+
Normally, all pull requests must include tests that test your change.
89+
Occasionally, a change will be very difficult to test for. In those cases,
90+
please include a note in your commit message explaining why.
7291

7392
## Communication
7493

75-
We use [discord](https://www.ory.sh/chat). You are welcome to drop in and ask questions, discuss bugs, etc.
94+
We use [discord](https://www.ory.sh/chat). You are welcome to drop in and ask
95+
questions, discuss bugs, etc.
7696

7797
## Conduct
7898

79-
Whether you are a regular contributor or a newcomer, we care about making this community a safe place for you and
80-
we've got your back.
81-
82-
* We are committed to providing a friendly, safe and welcoming environment for all, regardless of gender,
83-
sexual orientation, disability, ethnicity, religion, or similar personal characteristic.
84-
* Please avoid using nicknames that might detract from a friendly, safe and welcoming environment for all.
85-
* Be kind and courteous. There is no need to be mean or rude.
86-
* We will exclude you from interaction if you insult, demean or harass anyone. In particular, we do not tolerate
87-
behavior that excludes people in socially marginalized groups.
88-
* Private harassment is also unacceptable. No matter who you are, if you feel you have been or are being harassed or
89-
made uncomfortable by a community member, please contact one of the channel ops or a member of the ORY
90-
Oathkeeper core team immediately.
91-
* Likewise any spamming, trolling, flaming, baiting or other attention-stealing behaviour is not welcome.
92-
93-
We welcome discussion about creating a welcoming, safe, and productive environment for the community. If you have any questions, feedback, or concerns [please let us know](https://www.ory.sh/chat).
99+
Whether you are a regular contributor or a newcomer, we care about making this
100+
community a safe place for you and we've got your back.
101+
102+
- We are committed to providing a friendly, safe and welcoming environment for
103+
all, regardless of gender, sexual orientation, disability, ethnicity,
104+
religion, or similar personal characteristic.
105+
- Please avoid using nicknames that might detract from a friendly, safe and
106+
welcoming environment for all.
107+
- Be kind and courteous. There is no need to be mean or rude.
108+
- We will exclude you from interaction if you insult, demean or harass anyone.
109+
In particular, we do not tolerate behavior that excludes people in socially
110+
marginalized groups.
111+
- Private harassment is also unacceptable. No matter who you are, if you feel
112+
you have been or are being harassed or made uncomfortable by a community
113+
member, please contact one of the channel ops or a member of the ORY
114+
Oathkeeper core team immediately.
115+
- Likewise any spamming, trolling, flaming, baiting or other attention-stealing
116+
behaviour is not welcome.
117+
118+
We welcome discussion about creating a welcoming, safe, and productive
119+
environment for the community. If you have any questions, feedback, or concerns
120+
[please let us know](https://www.ory.sh/chat).

README.md

+20-14
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,22 @@ to build ORY Oathkeeper from source.
7777
## Who's using it?
7878

7979
<!--BEGIN ADOPTERS-->
80-
The ORY community stands on the shoulders of individuals, companies, and maintainers. We thank everyone involved - from
81-
submitting bug reports and feature requests, to contributing patches, to sponsoring our work. Our community is
82-
1000+ strong and growing rapidly. The ORY stack protects 1.200.000.000+ API requests every month with over
83-
15.000+ active service nodes. Our small but expert team would have never been able to achieve this without each and
84-
everyone of you.
8580

86-
The following list represents companies that have accompanied us along the way and that have made outstanding contributions
87-
to our ecosystem. *If you think that your company deserves a spot here, reach out to <a href="mailto:hi@ory.sh">hi@ory.sh</a>now*!
88-
89-
**Please consider giving back by becoming a sponsor of our open source work on <a href="https://www.patreon.com/_ory">Patreon</a> or
81+
The ORY community stands on the shoulders of individuals, companies, and
82+
maintainers. We thank everyone involved - from submitting bug reports and
83+
feature requests, to contributing patches, to sponsoring our work. Our community
84+
is 1000+ strong and growing rapidly. The ORY stack protects 1.200.000.000+ API
85+
requests every month with over 15.000+ active service nodes. Our small but
86+
expert team would have never been able to achieve this without each and everyone
87+
of you.
88+
89+
The following list represents companies that have accompanied us along the way
90+
and that have made outstanding contributions to our ecosystem. _If you think
91+
that your company deserves a spot here, reach out to
92+
<a href="mailto:hi@ory.sh">hi@ory.sh</a>now_!
93+
94+
**Please consider giving back by becoming a sponsor of our open source work on
95+
<a href="https://www.patreon.com/_ory">Patreon</a> or
9096
<a href="https://opencollective.com/ory">Open Collective</a>.**
9197

9298
<table>
@@ -164,15 +170,15 @@ as well as all of our backers
164170

165171
<a href="https://opencollective.com/ory#backers" target="_blank"><img src="https://opencollective.com/ory/backers.svg?width=890"></a>
166172

167-
and past & current supporters (in alphabetical order) on [Patreon](https://www.patreon.com/_ory): Alexander Alimovs,
168-
Billy, Chancy Kennedy, Drozzy, Edwin Trejos, Howard Edidin, Ken Adler Oz Haven, Stefan Hans, TheCrealm.
173+
and past & current supporters (in alphabetical order) on
174+
[Patreon](https://www.patreon.com/_ory): Alexander Alimovs, Billy, Chancy
175+
Kennedy, Drozzy, Edwin Trejos, Howard Edidin, Ken Adler Oz Haven, Stefan Hans,
176+
TheCrealm.
169177

170-
<em>* Uses one of ORY's major projects in production.</em>
178+
<em>\* Uses one of ORY's major projects in production.</em>
171179

172180
<!--END ADOPTERS-->
173181

174-
175-
176182
## Ecosystem
177183

178184
<a href="https://console.ory.sh/">

SECURITY.md

+9-11
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,17 @@
22

33
## Supported Versions
44

5-
We release patches for security vulnerabilities.
6-
Which versions are eligible receiving such patches
7-
depend on the CVSS v3.0 Rating:
5+
We release patches for security vulnerabilities. Which versions are eligible
6+
receiving such patches depend on the CVSS v3.0 Rating:
87

9-
| CVSS v3.0 | Supported Versions |
10-
| ---------- | ----------------------------------------- |
11-
| 9.0-10.0 | Releases within the previous three months |
12-
| 4.0-8.9 | Most recent release |
8+
| CVSS v3.0 | Supported Versions |
9+
| --------- | ----------------------------------------- |
10+
| 9.0-10.0 | Releases within the previous three months |
11+
| 4.0-8.9 | Most recent release |
1312

1413
## Reporting a Vulnerability
1514

1615
Please report (suspected) security vulnerabilities to
17-
**[security@ory.sh](mailto:security@ory.sh)**. You will receive
18-
a response from us within 48 hours. If the issue is confirmed,
19-
we will release a patch as soon as possible depending on complexity
20-
but historically within a few days.
16+
**[security@ory.sh](mailto:security@ory.sh)**. You will receive a response from
17+
us within 48 hours. If the issue is confirmed, we will release a patch as soon
18+
as possible depending on complexity but historically within a few days.

UPGRADE.md

+32-8
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,17 @@ before finalizing the upgrade process.
4040

4141
## v0.18.0-beta.1+oryOS.12
4242

43-
### Mutators
44-
1. ORY Oathkeeper now supports multiple mutators. Mutations are performed in the provided order and must all succeed in order for the HTTP request to be forwarded.
45-
2. The `mutator` property was renamed to `mutators` to reflect its true nature (see previous item).
43+
### Access Rule Mutators
4644

47-
### Access Rule Changes
48-
49-
As already noted, the `mutator` property was renamed to `mutators` and now represents a list of mutation handlers. If you have
50-
existing rules, please update them as follows:
45+
1. ORY Oathkeeper now supports multiple mutators. Mutations are performed in the
46+
provided order and must all succeed in order for the HTTP request to be
47+
forwarded.
48+
2. The `mutator` property was renamed to `mutators` to reflect its true nature
49+
(see previous item).
50+
51+
If you have existing rules, please update them as follows:
5152

52-
```
53+
```patch
5354
[
5455
{
5556
"id": "jwt-rule",
@@ -82,6 +83,29 @@ existing rules, please update them as follows:
8283
]
8384
```
8485

86+
#### `id_token` mutator now renders go templates
87+
88+
The `id_token` mutator is now capable of rendering custom claims using Go
89+
[text/template](https://golang.org/pkg/text/template/) receiving the
90+
`AuthenticationSession` struct as its parameters.
91+
92+
To enable this change, the `aud` config was removed and the `claims` config was introduced.
93+
The `claims` field is a raw string representing a Go template.
94+
95+
To upgrade existing rules, apply patches similar to this one:
96+
97+
deprecated config:
98+
99+
```patch
100+
{
101+
"handler": "id_token",
102+
"config": {
103+
- "aud": ["https://my-backend-service/some/endpoint"]
104+
+ "claims": "{\"aud\": [\"https://my-backend-service/some/endpoint\"]}"
105+
}
106+
}
107+
```
108+
85109
## v0.17.0-beta.1+oryOS.12
86110

87111
ORY Oathkeeper now watches configuration files and access rules repositories on

0 commit comments

Comments
 (0)