Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

judge: Add endpoint for answering access requests directly #91

Merged
merged 1 commit into from
Jul 22, 2018

Conversation

aeneasr
Copy link
Member

@aeneasr aeneasr commented Jul 22, 2018

This patch adds endpoint /judge to oathkeeper serve api. The /judge endpoint mimics the behavior of oathkeeper serve proxy but instead of forwarding the request to the upstream server, the endpoint answers directly with a HTTP response.

The HTTP response returns status code 200 if the request should be allowed and any other status code (e.g. 401, 403) if not.

Assuming you are making the following request:

PUT /judge/my-service/whatever HTTP/1.1
Host: oathkeeper-api:4456
User-Agent: curl/7.54.0
Authorization: bearer some-token
Accept: */*
Content-Type: application/json
Content-Length: 0

And you have a rule which allows token some-bearer to access PUT /my-service/whatever and you have a credentials issuer which does not modify the Authorization header, the response will be:

HTTP/1.1 200 OK
Authorization: bearer-sometoken
Content-Length: 0
Connection: Closed

If the rule denies the request, the response will be, for example:

HTTP/1.1 401 OK
Content-Length: 0
Connection: Closed

Close #42

This patch adds endpoint `/judge` to `oathkeeper serve api`. The `/judge` endpoint mimics the behavior of `oathkeeper serve proxy` but instead of forwarding the request to the upstream server, the endpoint answers directly with a HTTP response.

The HTTP response returns status code 200 if the request should be allowed and any other status code (e.g. 401, 403) if not.

Assuming you are making the following request:

```
PUT /judge/my-service/whatever HTTP/1.1
Host: oathkeeper-api:4456
User-Agent: curl/7.54.0
Authorization: bearer some-token
Accept: */*
Content-Type: application/json
Content-Length: 0
```

And you have a rule which allows token `some-bearer` to access `PUT /my-service/whatever` and you have a credentials issuer which does not modify the Authorization header, the response will be:

```
HTTP/1.1 200 OK
Authorization: bearer-sometoken
Content-Length: 0
Connection: Closed
```

If the rule denies the request, the response will be, for example:

```
HTTP/1.1 401 OK
Content-Length: 0
Connection: Closed
```

Close #42

Signed-off-by: arekkas <[email protected]>
@aeneasr aeneasr merged commit d211641 into master Jul 22, 2018
@aeneasr aeneasr deleted the close-42 branch July 22, 2018 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant