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

Support OIDC based authentication #881

Closed
arkodg opened this issue Jan 10, 2023 · 17 comments
Closed

Support OIDC based authentication #881

arkodg opened this issue Jan 10, 2023 · 17 comments
Assignees
Labels
area/api API-related issues area/extensions help wanted Extra attention is needed kind/enhancement New feature or request priority/medium Label used to express the "medium" priority level
Milestone

Comments

@arkodg
Copy link
Contributor

arkodg commented Jan 10, 2023

Description:
Support OIDC based authentication

Support in envoy

Relates to #336

@arkodg arkodg added kind/enhancement New feature or request help wanted Extra attention is needed labels Jan 10, 2023
@danehans danehans added this to the 0.4.0-rc.1 milestone Jan 12, 2023
@lizan
Copy link
Member

lizan commented Jan 19, 2023

The Envoy oauth2 filter isn't really an OIDC authentication filter but issuing some custom custom format token in cookies/headers. We might want to look at some control plane for this like vouch-proxy

@arkodg
Copy link
Contributor Author

arkodg commented Jan 19, 2023

hey @lizan assigning this issue to you since you're looking into it, please feel to unassign if anything changes

@arkodg arkodg added area/api API-related issues area/extensions priority/medium Label used to express the "medium" priority level and removed help wanted Extra attention is needed labels Jan 19, 2023
@arkodg
Copy link
Contributor Author

arkodg commented Jan 23, 2023

@lizan do you think a new filter can be added to envoyproxy or the current oauth filter can be extended to support the OIDC flow (potentially including redirects, and an external storage backend [Redis] for server tokens) .
This would eliminate the need to achieve the same using an external service such as https://github.com/istio-ecosystem/authservice

cc @mattklein123 @ZackButcher

@lizan
Copy link
Member

lizan commented Jan 24, 2023

Yes that is also doable. It is likely we need to do a new filter for OIDC. We just need to agree on a plan to support what flow and how to configure token storage etc. If that's more desired for EG community we can do that. Let's compare which path is better

@mattklein123
Copy link
Member

Yes that is also doable. It is likely we need to do a new filter for OIDC. We just need to agree on a plan to support what flow and how to configure token storage etc. If that's more desired for EG community we can do that. Let's compare which path is better

Can we put together a short design doc on the options of sharing the filter vs. a new filter? I would imagine a lot of the logic will be shared. Perhaps there can be a common core shared between the 2 filters. I don't know enough details to know if that makes sense or not but we should see so we don't end up with substantial code duplication for a security critical feature.

@lizan
Copy link
Member

lizan commented Jan 26, 2023

My bad I meant the opposite we shouldn't need a new filter for OIDC. The existing oauth filter can do a very basic flow of OIDC already.

For OIDC Discovery I don't think it should should be done in Envoy directly but should be a responsibility of control plane.

@arkodg
Copy link
Contributor Author

arkodg commented Feb 22, 2023

hey @lizan any update ?

@lizan
Copy link
Member

lizan commented Feb 22, 2023

I've been testing several scenarios with oauth2 filter and looks like it can be used for OIDC authentication, so we don't need additional control plane for now. Will send a PR for API review soon.

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had activity in the last 30 days.

@github-actions github-actions bot added the stale label Mar 25, 2023
@sujeshkumar
Copy link

I've been testing several scenarios with oauth2 filter and looks like it can be used for OIDC authentication, so we don't need additional control plane for now. Will send a PR for API review soon.

@lizan are these PRs already merged ? is there any plan to use wellknownUrls to get information like auth_endpoint / token_endpoint etc ?

@github-actions github-actions bot removed the stale label Mar 27, 2023
@arkodg
Copy link
Contributor Author

arkodg commented Mar 27, 2023

hey @lizan unassigning you since you mentioned you are no longer working on this.
would help the next contributor if you attached any past work to this issue, TIA !

@arkodg arkodg added the help wanted Extra attention is needed label Mar 27, 2023
@arkodg
Copy link
Contributor Author

arkodg commented Mar 27, 2023

attaching a relevant article that has the filter config https://www.jpmorgan.com/technology/technology-blog/protecting-web-applications-via-envoy-oauth2-filter

@arkodg arkodg modified the milestones: 0.4.0-rc.1, 0.5.0-rc1 Mar 28, 2023
@arkodg arkodg modified the milestones: 0.5.0-rc1, Backlog Apr 25, 2023
@tmsnan
Copy link
Contributor

tmsnan commented Jun 13, 2023

Hi, I can work on this function, please assign it to me if no one else is working on it.

@zhaohuabing
Copy link
Member

zhaohuabing commented Jun 13, 2023

@tmsnan I already have a design doc and API drafted on this which I'll share soon. Would love to work with you if you're also interested in it.

@zhaohuabing
Copy link
Member

@zhaohuabing
Copy link
Member

zhaohuabing commented Jun 13, 2023

We have 4 options for the API, which are described in detail in the design.

I suggest we start with option 2 since this strategy has already been taken by JWT authentication and is compatible with the current AuthenticationFilter API. We can start with option 2, collect feedback from users, and then evolve according.

Option 2. Authentication at route level
Model OIDCAuthentication as a new OIDC AuthenticationFilter type.

Example config:

apiVersion: gateway.envoyproxy.io/v1alpha1
kind: AuthenticationFilter
metadata:
  name: google
spec:
  type: OIDC
  oidcAuthentication:
    provider:
      issuer: "https://accounts.google.com"
      authorizationEndpoint: "https://accounts.google.com/o/oauth2/v2/auth"
      tokenEndpoint: "https://oauth2.googleapis.com/token"
      jwks: xxxxxxxxxxxxxx
    clientId: xxxxxxxxxxx
    clientSecret: client-secret
---
apiVersion: gateway.networking.k8s.io/v1beta1
kind: HTTPRoute
metadata:
  name: backend
spec:
  parentRefs:
  - name: eg
  hostnames:
  - "www.example.com"
  rules:
  - backendRefs:
    - group: ""
      kind: Service
      name: backend
      port: 3000
      weight: 1
    filters:
    - extensionRef:
        group: gateway.envoyproxy.io
        kind: AuthenticationFilter
        name: google
      type: ExtensionRef
    matches:
    - path:
        type: PathPrefix
        value: /foo

@Xunzhuo
Copy link
Member

Xunzhuo commented Dec 7, 2023

Close by #2122

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/api API-related issues area/extensions help wanted Extra attention is needed kind/enhancement New feature or request priority/medium Label used to express the "medium" priority level
Projects
None yet
Development

No branches or pull requests

8 participants