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

feat: Simple Kubernetes TokenReview identity object #403

Merged
merged 1 commit into from
Jun 12, 2023

Conversation

guicassolato
Copy link
Collaborator

@guicassolato guicassolato commented Jun 6, 2023

Makes the Kubernetes TokenReview-based identity method to always fill the identity object from the status field of the TokenReview response, as opposed to the current hybrid behaviour of trying to detect whether the verified access token is a JWT or an opaque token.

Closes #394.


Warning! This is a breaking change and users of Authorino Kubernetes identity verification method must consider its impact to existing AuthConfigs before upgrading to a new version.

Users relying on JWT detection can still extract, decode and parse the JWT directly from the Authorization header. Here’s an example extending the identity object*:

spec:
  identity:
  - name: k8s-tokenreview
    kubernetes:
      extendedProperties:
      - name: jwt
        valueFrom:
          authJSON: context.request.http.headers.authorization|@extract:{"pos":1}|@extract:{"sep":".","pos":1}|@base64:decode|@fromstr

* Requires #401.

Verification steps

① Deploy

make local-setup FF=1
kubectl port-forward deployment/envoy 8000:8000 2>&1 >/dev/null &

② Follow the steps of the Authentication with Kubernetes tokens (TokenReview API) user guide from step 5

Makes the Kubernetes TokenReview-based identity method to always fill the identity object from the [status](https://kubernetes.io/docs/reference/kubernetes-api/authentication-resources/token-review-v1/#TokenReviewStatus) of the TokenReview response, as opposed to the current hybrid behaviour of trying to detect whether the verified access token is a JWT or an opaque token.
@guicassolato guicassolato self-assigned this Jun 6, 2023
@guicassolato guicassolato requested a review from a team June 6, 2023 10:31
Copy link
Collaborator

@eguzki eguzki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

verification steps working

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.

Enhanced TokenReview identity object
3 participants