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

Incorrect parsing of openIdConnectUrl for AuthPolicy #94

Open
pehala opened this issue Jun 25, 2024 · 1 comment
Open

Incorrect parsing of openIdConnectUrl for AuthPolicy #94

pehala opened this issue Jun 25, 2024 · 1 comment
Labels
bug Something isn't working kind/bug

Comments

@pehala
Copy link

pehala commented Jun 25, 2024

Both Swagger Docs and our own docs state that you should supply openid-configuration endpoint in OAS like this:

components:
  securitySchemes:
    securedDog:
      type: openIdConnect
      openIdConnectUrl: https://example.com/.well-known/openid-configuration

Kuadrantctl directly passes this value to AuthPolicy issuerUrl field, which requires issuerUrl and not openid-configuration.

Tested version: 0.2.3

Reproducer:
Input:

components:
  securitySchemes:
    oidc:
      openIdConnectUrl: http://172.18.0.19:8080/realms/realm-phala--k0gf/.well-known/openid-configuration
      type: openIdConnect
info:
  title: Httpbin
  version: 0.0.51
  x-kuadrant:
    route:
      hostnames:
      - hostname-phala--usm5.test.com
      name: route-phala--5nxb
      parentRefs:
      - group: gateway.networking.k8s.io
        kind: Gateway
        name: gw-phala--nphc
        namespace: kuadrant
openapi: 3.1.0
paths:
  /anything:
    get:
      operationId: get_anything
      responses:
        '200':
          content:
            application/json:
              schema:
                type: string
          description: Successful Response
      security:
      - oidc: []
    put:
      operationId: put_anything
      responses:
        '200':
          content:
            application/json:
              schema:
                type: string
          description: Successful Response
    x-kuadrant:
      backendRefs:
      - group: ''
        kind: Service
        name: httpbin-phala--6stb
        namespace: kuadrant
        port: 8080
  /get:
    get:
      operationId: get_get
      responses:
        '200':
          content:
            application/json:
              schema:
                type: string
          description: Successful Response

Output:

apiVersion: kuadrant.io/v1beta2
kind: AuthPolicy
metadata:
  creationTimestamp: null
  name: route-phala--5nxb
spec:
  routeSelectors:
  - matches:
    - method: GET
      path:
        type: Exact
        value: /anything
  rules:
    authentication:
      get_anything_oidc:
        credentials: {}
        jwt:
          issuerUrl: http://172.18.0.19:8080/realms/realm-phala--k0gf/.well-known/openid-configuration
        routeSelectors:
        - matches:
          - method: GET
            path:
              type: Exact
              value: /anything
  targetRef:
    group: gateway.networking.k8s.io
    kind: HTTPRoute
    name: route-phala--5nxb
status: {}
@pehala pehala added bug Something isn't working kind/bug labels Jun 25, 2024
@pehala pehala added this to Kuadrant Jun 25, 2024
@azgabur
Copy link
Contributor

azgabur commented Jun 25, 2024

The documentation is yet to be updated in my PR #76 to remove mention of the /.well-known/openid-configuration path.
But I agree with you that the oas that is parsed by kuadrantctl should be compatible with oas that is used elsewhere. Like you mention in the Swagger docs the well-known path is used. I would expect kuadrantctl can parse it without an issue.

Link to relevant discussion with @guicassolato #76 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working kind/bug
Projects
Status: Todo
Development

No branches or pull requests

2 participants