Skip to content

Autpolicy doc fixes#76

Open
azgabur wants to merge 7 commits intoKuadrant:mainfrom
azgabur:autpolicy_doc_fix
Open

Autpolicy doc fixes#76
azgabur wants to merge 7 commits intoKuadrant:mainfrom
azgabur:autpolicy_doc_fix

Conversation

@azgabur
Copy link
Copy Markdown
Member

@azgabur azgabur commented May 7, 2024

Contains fixes:

  • The openapi examples are now in proper openapi yaml format
  • Redundant yq removal
  • Added Gateway object creation otherwise HttpRoute will not have parent
    • Due to this a random IP is assigned so a new variable INGRESS_IP is needed for curl examples
  • Refactor SSO urls in examples
  • Fix Direct access grant alternative name
  • Fix some spacing and other small refactors

Comment thread doc/generate-kuadrant-auth-policy.md Outdated
@@ -41,21 +45,17 @@ components:
openIdConnectUrl: https://example.com/.well-known/openid-configuration
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This particular example is also broken and we should not be sharing it without at least a similar warning to the user as this one proposed further below.

Explanation:

Copying a well-known OpenId Connect Discovery URL to the AuthPolicy's jwt.issuerUrl field will not work.

That's why kuadrantctl actually expects in the openIdConnectUrl field of the OAS an issuer URL identifier instead. This is a URL without the /.well-known/openid-configuration part, which is automatically appended to the value obtained from jwt.issuerUrl.

Users who follow the OAS docs though may inadvertently use the full Discovery URL. We do not want that.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is a good catch! Please look at my next commit a9db0d0
I removed the mention of the /.well-known/openid-configuration path so it should be less confusing.

I am just wondering if there is a reason why AuthPolicy expects issuer instead of openid-configuration path?
The response JSON from openid-configuration contains value of issuer so theoretically it could be used as well. Also if the current practice is to use openid-configuration path in OAS yaml-s as you mentioned.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I am just wondering if there is a reason why AuthPolicy expects issuer instead of openid-configuration path?

It's because of the OIDC library used by Authorino. In its simplest form, it expects an issuer URL and not the (more specific) Discovery endpoint. Otherwise, Authorino itself would have to perform the request to fetch the OIDC config, parse its response, handle possible exceptions, and then start using the library that, among other things, let us validate signed JWTs.

I would advocate for more flexibility in Authorino's JWT verification method, which surfaces into the Kuadrant AuthPolicy. Along with issuerUrl, I'd love to add discoveryUrl, jwksURL, and possibly others. It's just that currently this is not the state of things... yet.

Copy link
Copy Markdown
Contributor

@R-Lawton R-Lawton left a comment

Choose a reason for hiding this comment

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

havent ran through the tutorial yet but from a high level found a few things

```
kuadrantctl generate kuadrant authpolicy --oas ./petstore-openapi.yaml | yq -P
```bash
kuadrantctl generate kuadrant authpolicy --oas example.yaml
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

i dont really get this change, why change the name to be example and why use remove the pretty print?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The yp command has been removed from multiple guides as is now not needed. The pretty print is done as default.
I changed the name of the yaml file so it does not clash with the same name as the yaml file generated as part of User guide that follows later. I am opened to better file name suggestion though.


```
kuadrantctl generate kuadrant authpolicy --oas ./petstore-openapi.yaml | yq -P
```bash
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

same here

Comment thread doc/generate-kuadrant-auth-policy.md Outdated
</details>

> Replace `${KEYCLOAK_PUBLIC_DOMAIN}` with your SSO instance domain
> Replace `${KEYCLOAK_ISSUER}` with your SSO instance issuer endpoint for your `petstore` realm.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What do you think about moving this to be above the resource that uses it so they know to set it before they create the resource it falls more in line with other docs we have

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good idea, I moved it

Comment thread doc/generate-kuadrant-auth-policy.md Outdated

> Replace `${KEYCLOAK_PUBLIC_DOMAIN}` with your SSO instance domain

> Replace `${KEYCLOAK_TOKEN_ENDPOINT}` with your SSO instance token endpoint for your `petstore` realm.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same like the other var moving to be above where its needed so people can set it then run the bash command

Comment thread doc/generate-kuadrant-auth-policy.md Outdated
Comment thread doc/generate-kuadrant-auth-policy.md Outdated
Comment thread doc/generate-kuadrant-auth-policy.md Outdated
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.

5 participants