Skip to main content
aanghel
Gold ⭐️
Gold ⭐️
February 9, 2018

Configure Knox with OpenID Connect

  • October 5, 2026 at 9:13 AM
  • 0 replies
  • 11945 views
  • Translate All

Introduction

OpenID Connect (OIDC) is an authentication layer on top of OAuth 2.0, an authorization framework.

It uses simple JSON Web Tokens (JWT), which is an open standard for securely transmitting information as a JSON object. These objects are normally signed with an RSA key and contain information such as if the user was authenticated or the user's id and email. More information and examples can be found here: https://auth0.com/docs/tokens/concepts/jwts

Knox, together with pac4j, a Java security engine, uses OpenID Connect (and also SAML, CAS, OAuth) to enable Single Sign On using a variety of 3rd party Identity Providers that support these protocols.

For example, Knox can be integrated with a service such as https://auth0.com to provide users authenticated to auth0 access to Hadoop resources (without a need to enter their credentials again or even integrate Knox with an LDAP).

Following is an example of how Knox can integrate with auth0 using OpenID Connect.

Setup auth0

Sign up

The first step is to sign up to https://auth0.com and create an account to manage the identity provider.

Since this a public SaaS based service, it needs a unique identifier to distinguish between clients (it will form its own unique subdomain):

56633-1-auth0-domain.png

Add the first user

Once the account is created, add a new user in the auth0 internal database. This user will be used to login in Knox. auth0 can integrate with a variety of sources (including AD/LDAP) and Social (Google, Facebook). However, for this test, we define the user in the default auth0 internal Database.

Go to Users section and create your first user:

56634-2-auth0-user.png

Define the client

Once we have a new user, the next step is to define a new client, in this case Knox, which is a Regular Web Application:

56635-3-auth0-clients.png

56636-4-auth0-knox.png

Client id and secret

Once the application is created, go to the Settings tab and note down the information that Knox will use to authenticate itself, as a client application, to auth0 (these will later be used in Knox's configuration):

247758_1_new.png

Callback URLs

Then there is one setting that needs defined here - Allowed Callback URLs - which is the Knox URL that auth0 will redirect the user back to after successful authentication. This URL is in the following format:

247758_2_new.png

discoveryUri

Lastly, one other piece of configuration required by Knox is discoveryUri, which can be found at the end of the configuration page, in the Show Advanced Settings section -> Endpoints -> OpenID Configuration (typically in the format https://anghelknoxtest.eu.auth0.com/.well-known/openid-configuration

56639-7-auth0-discovery.png

This process, creating an application, getting its ID and Secret, configuring the allowed callback URL and finding out the discoveryUri are steps for any OpenID Connect identity provider. These have also been tested with NetIQ for instance.

Knox Configuration

To enable any SSO type authentication in Knox (be it OpenID Connect, SAML or other pac4j IdP), the Knox default topology must be configured to use the SSOCookieProvider and then the knoxsso.xml topology must be configured to use the OpenID Connect provider.

default topology

Set the following in the default topology (Advanced topology in Ambari) so that it uses SSOCookieProvider. Replace any other authentication providers (by default it's the ShiroProvider) with the ones bellow and set the sso.authentication.provider.url to the correct Knox IP/FQDN):

<provider>
<role>webappsec</role>
<name>WebAppSec</name>
<enabled>true</enabled>
<param>
<name>cors.enabled</name>
<value>true</value>
</param>
</provider>
<provider>
<role>federation</role>
<name>SSOCookieProvider</name>
<enabled>true</enabled>
<param>
<name>sso.authentication.provider.url</name>
<value>https://00.000.000.000:8443/gateway/knoxsso/api/v1/websso</value>
</param>
</provider>

knoxsso topology

And then configure the pac4j provider for OpenID Connect in your knoxsso.xml topology (Advanced knoxsso-topology in Ambari) - as per documentation.


Set the following: