Skip to content

Incorrect parsing of openIdConnectUrl for AuthPolicy #94

Description

@pehala

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: {}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingkind/bug

    Type

    No type

    Projects

    • Status
      Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions