KeyCloak
KeyCloak is an Identity and Access Management (IAM) solution. It implements both OAuth2 (authorization - that is, what you can do) and OIDC (authentication - who is doing it). OIDC extends OAuth2 by, for example, adding standardized endpoints.
Because of this, a lot of the terminology in these standards applies to KeyCloak. But, in addition, KeyCloak has some of its own - Realms for example. (Incidentally, KeyCloak can serve its own login page for your protected application. This would live under /realms/YOUR_REALM)
Clients are for machines and processes, users are humans. Clients have secrets, users have passwords. They are totally orthoganol concepts. A client and a user that have the same name are not related. However, a client must act as the gateway for a user who wants a token.
The grant_type describes the flow - that is, what's happening. This could be a user logging in via MFA (authorization_code issued by the IdP when the browser redirects to it) or back end servers talking to each other using service accounts (client_credentials) or an interactive session (password).
One such flow is Direct Grant Flow, where an app fronts the login page that is sent to KeyCloak that then mints the token. It is heavily discouraged as it circumvents MFA.
The standard flow is the usual "log in with a username/password and then use MFA". This is the default, built-in flow although you can add your own custom flows.
When Spark is configured to use the OIDC token (that is, with spark.sql.catalog.<catalog_name>.token as Spark configuration), it sends it directly to Polaris with the HTTP header Authorization: Bearer <token>. Polaris then validates this with KeyCloak rather than using a grant_type.
Claims are properties of a token. There are some reserved ones but you can define your own.
Spark
So, when Spark is configured to read an Iceberg table using Polaris, it differs to Iceberg code's OAuth2Manager. It's this that makes the call to Polaris with the relevant grant_type.
No comments:
Post a Comment