This sample provides details on how to configure Auth0 as an identity provider for accessing the Kyma runtime. The access will be set up for both, Kyma Dashboard as well as kubectl.
The setup will use SAP Cloud Identity Service (IAS) and configure Auth0 as a proxy via Corporate Identity Providers. This is the recommended approach for using an external Identity Provider with SAP BTP. However, it is also possible to use Auth0 directly for Kyma access.
This sample can be used as a reference for achieving the same when using other identity providers, such as Azure Active Directory.
- SAP BTP, Kyma runtime instance
- SAP Identity Authentication Service tenant
-
Log in to Auth0. If you don't have an account yet, sign up.
-
Provide a name.
-
Configure the Application URIs:
-
Configure one or more users in Auth0. They will be your default administrators of the Kyma runtime. Later, you can set up other users with role-based access control (RBAC).
The following steps are based on the Identity Authentication documentation about Corporate Identity Providers.
- In your IAS tenant, create a new corporate identity provider.
- Configure the identity provider type to be
SAML 2.0 Compliant
. - Under SAML 2.0 Configuration, upload the SAML metadata XML file that you downloaded previously, and save the configuration.
-
Create a new application. You can also use an existing application.
-
Select
Protocol
asOpenID Connect
. -
In Open ID Configuration, provide the URI for the Kyma Dashboard https://dashboard.kyma.cloud.sap/. Additionally, add a local URI http://localhost:8000. This will be used for
kubectl
access.Note: If your localhost 8000 port is already bound, provide another port and adjust your Kubeconfig accordingly.
While provisioning the Kyma runtime, provide the oidc details among other parameters. Use a similar configuration if you are updating the Kyma runtime.
{
"administrators": [
"{email-id-of-users-created-in-auth0}"
],
"autoScalerMax": {as-per-your-scaling-needs},
"autoScalerMin": 2,
"machineType": "{as-per-your-scaling-needs}",
"name": "{this-will-be-default-populated}",
"oidc": {
"clientID": "{client-id-of-your-ias-application}",
"groupsClaim": "groups",
"issuerURL": "{your-ias-tenant}",
"signingAlgs": [
"RS256"
],
"usernameClaim": "sub",
"usernamePrefix": "-"
},
"region": "{region-where-kyma-will-be-provisioned}"
}
Once Kyma runtime provisioning is finished, the administrators can open the Kyma Dashboard. They will be redirected to the Auth0 log-in and once that is successful, they can view the Kyma Dashboard.
The same flow applies to kubectl access.
For non-admin users, such as developers, you might want to limit the access to the Kyma runtime to one or more namespaces. This can be achieved by using the Kubernetes RBAC. You can create a RoleBinding.
You will create a dev namespace and provide cluster-admin
access to a group called kyma-dev-ns
for this namespace.
In the following example, I am using the default role cluster-admin
. If you want, you can copy and customize the default role.
- Install the extension Auth0 Authorization.
- After installation, navigate to Authorization. It opens a separate tab, where you can create groups and add users to the groups.
- Create two groups:
test-group
andkyma-dev-ns
.Note: This sample uses two groups instead of one, because only then Auth0 sends the group list as a string array. The Kyma RBAC mechanism expects a string array. If you would like to suggest a simpler method to achieve this, please create a GitHub issue.
- Create one or more users and assign them to both groups.
The groups configured in Auth0 are manifest as a string array for assertion attribute http://schemas.xmlsoap.org/claims/Group
. Because the Kyma OIDC is configured to expect the groupsClaim
attribute as groups
, you must enrich the assertion attribute that is received from Auth0.
Note: You can also use the attribute received from Auth0 and configure the same in Kyma. Using
groups
makes it clearer.
- For the Auth0 configured corporate identity provider, add an entry for
Enriched Assertion Attributes
Attribute
: groupsValue
: ${http://schemas.xmlsoap.org/claims/Group}
- In your application in IAS, verify the following:
After you successfully set up RBAC, the users you added to the kyma-dev-ns
group can access only the dev
namespace.