Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

External authorization #76

Open
wants to merge 4 commits into
base: ostia-architecture
Choose a base branch
from
Open

External authorization #76

wants to merge 4 commits into from

Conversation

guicassolato
Copy link

@guicassolato guicassolato commented Oct 26, 2020

Try it out with your Docker env

1. Start the containers

docker-compose up --build -d

You'll get the following components up and running:

  • Envoy proxy
    Configured w/ the http filters ext_authz and ratelimit.
  • Upstream app
    Just a simple rack application that returns a constant string for any request.
  • External AuthN/AuthZ proxy
    The core of this PoC. It implements Envoy's external auth gRPC protocol, verifies identities (only OIDC supported so far), fetches metadata (OIDC user info) and delegates policy evaluation to configured PDPs.
  • OPA service
    An actual Policy Decision Point (PDP) configured in the architecture.
  • Rate limiter
    Out of scope for this PoC. Your can ignore it for the moment.
  • Keycloak
    To issue OIDC access tokens.
    Admin console: http://localhost:8080/auth/admin (admin/p)
    Available users:
    • john/p (member)
    • jane/p (admin)

2. Try out with John (member)

export ACCESS_TOKEN_JOHN=$(curl -k -d 'grant_type=password' -d 'client_id=demo' -d 'username=john' -d 'password=p' "http://localhost:8080/auth/realms/ostia/protocol/openid-connect/token" | jq -r '.access_token')

curl -H 'Host: app:3000' -H "Authorization: Bearer $ACCESS_TOKEN_JOHN" http://localhost:8000/pets -v        # 200 OK
curl -H 'Host: app:3000' -H "Authorization: Bearer $ACCESS_TOKEN_JOHN" http://localhost:8000/pets/stats -v  # 404 Not authorized

3. Try out with Jane (admin)

export ACCESS_TOKEN_JANE=$(curl -k -d 'grant_type=password' -d 'client_id=demo' -d 'username=jane' -d 'password=p' "http://localhost:8080/auth/realms/ostia/protocol/openid-connect/token" | jq -r '.access_token')

curl -H 'Host: app:3000' -H "Authorization: Bearer $ACCESS_TOKEN_JANE" http://localhost:8000/pets -v        # 200 OK
curl -H 'Host: app:3000' -H "Authorization: Bearer $ACCESS_TOKEN_JANE" http://localhost:8000/pets/stats -v  # 200 OK

4. Shut down and clean up

docker-compose down

@guicassolato guicassolato changed the base branch from master to ostia-architecture October 26, 2020 18:38
@guicassolato guicassolato force-pushed the ruby-opa branch 2 times, most recently from 7a11df8 to 8533007 Compare October 27, 2020 20:37
Includes a bug fix in the token introspection endpoint – name of the attribute returned by Keycloak in the discovery is "introspection_endpoint" (not "token_introspection_endpoint")
@guicassolato guicassolato marked this pull request as ready for review October 29, 2020 10:12
docker-compose.yaml Outdated Show resolved Hide resolved
@mikz
Copy link
Contributor

mikz commented Oct 30, 2020

Amazing! It works. It is easy to try and extend! Epic :)

guicassolato added a commit to 3scale-labs/authorino-rb that referenced this pull request Nov 3, 2020
guicassolato added a commit to 3scale-labs/authorino-rb that referenced this pull request Nov 3, 2020
guicassolato added a commit to 3scale-labs/authorino-rb that referenced this pull request Nov 3, 2020
guicassolato added a commit to 3scale-labs/authorino-rb that referenced this pull request Nov 3, 2020
guicassolato added a commit to 3scale-labs/authorino-rb that referenced this pull request Nov 3, 2020
guicassolato added a commit to 3scale-labs/authorino-rb that referenced this pull request Nov 3, 2020
guicassolato added a commit to 3scale-labs/authorino-rb that referenced this pull request Nov 3, 2020
guicassolato added a commit to 3scale-labs/authorino-rb that referenced this pull request Nov 3, 2020
guicassolato added a commit to 3scale-labs/authorino-rb that referenced this pull request Nov 3, 2020
guicassolato added a commit to 3scale-labs/authorino-rb that referenced this pull request Nov 3, 2020
guicassolato added a commit to 3scale-labs/authorino-rb that referenced this pull request Nov 3, 2020
guicassolato added a commit to 3scale-labs/authorino-rb that referenced this pull request Nov 3, 2020
guicassolato added a commit to 3scale-labs/authorino-rb that referenced this pull request Nov 3, 2020
guicassolato added a commit to 3scale-labs/authorino-rb that referenced this pull request Nov 3, 2020
guicassolato added a commit to 3scale-labs/authorino-rb that referenced this pull request Nov 3, 2020
guicassolato added a commit to 3scale-labs/authorino-rb that referenced this pull request Nov 3, 2020
guicassolato added a commit to 3scale-labs/authorino-rb that referenced this pull request Nov 3, 2020
guicassolato added a commit to 3scale-labs/authorino-rb that referenced this pull request Nov 3, 2020
guicassolato added a commit to 3scale-labs/authorino-rb that referenced this pull request Nov 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants