We are attempting to use KeycloakOIDCFilter as our Apache Spark UI filter. However, we are struggling to configure the KeycloakOIDCFilter itself.
We have, in spark-defaults.conf:
spark.ui.filters=org.keycloak.adapters.servlet.KeycloakOIDCFilter
This is picked up successfully, and the Spark master logs show this filter being applied to all URL routes.
We have generated a client config file in the Keycloak Admin Console, which has spit out a keycloak-oidc.json.
But how do we tell KeycloakOIDCFilter about this information?
From the Spark docs
Filter parameters can also be specified in the configuration, by setting config entries of the form
spark.<class name of filter>.param.<param name>=<value>For example:spark.ui.filters=com.test.filter1 spark.com.test.filter1.param.name1=foo spark.com.test.filter1.param.name2=bar
In our case that would seem to be:
spark.org.keycloak.adapters.servlet.KeycloakOIDCFilter.param.<name>=<value>
However, the KeycloakOIDCFilter Java class has only two constructors. One takes no parameters at all and one takes a KeycloakConfigResolver.
The Keycloak Java servlet filter adapter docs only talk about web.xml which isn't applicable in the case of configuring Spark.
So how can we properly configure/point to parameters for the KeycloakOIDCFilter servlet filter?
Update: We've determined that spark.org.keycloak.adapters.servlet.KeycloakOIDCFilter.param.keycloak.config.file can be used to point to a config file, but it appears that Spark does not use SessionManager, leading to a separate error that may or may not be resolvable.