Everything within this section is only visible while editing. Use Page Properties ID "STUB", "REFACTURE", "PROGRESS", "rDEV", "rDOC", "rLANG" and "DONE". Everything contained within the table is displayed in the (INTERNAL) Reports page.
Resources & Remarks Always keep at the same state! enaio - official help: https://help.optimal-systems.com/enaio/v910/admin/administrator/en/dienste/idprovider.htm yuuvis Impulse: https://wiki.optimal-systems.de/pages/viewpage.action?spaceKey=MAN&title=Keycloak yuuvis Momentum & enaio: https://wiki.optimal-systems.de/display/EnaioServices/Keycloak
Modification History Add a new line to this table and fill it whenever you edit the page.
|
Guideline for manual installation and configuration of keycloak as an identity provider for yuuvis® Momentum. |
|
Identity providers such as Keycloak can be connected to yuuvis® API for authentication using Connect/OAuth2 via the authentication-service.
Keycloak is the recommended identity provider for yuuvis® Momentum and is consistently used for testing. In principle, any identity provider supporting OAuth2 can be used in the same way.
As standard, the installation is done by means of a Helm chart. Two demonstration tenants are created and configured automatically. Further tenants for productive use have to be added and configured manually.
>> /wiki/spaces/YMY/pages/320049969
The manual installation and configuration of Keycloak for yuuvis® Momentum API are broadly described here.
After installation, Keycloak provides two administrative services, one for system administrators and one for users.
To install Keycloak manually, follow these steps:
standalone.xml
configuration file in the \standalone\configuration\
directory:<interfaces>
section:<interface name="any">
<any-address/>
</interface>
<socket-binding-group>
section, for the <default-interface>
attribute, enter the following value: any
<socket-binding-group>
section:<socket-binding name="http" port="${jboss.http.port:8080}"/>
\keycloak\bin\standalone.bat
file.http://localhost:8080/
Note: For productive use, it is recommended to connect Keycloak to a different relational database management system (RDBMS) instead of the embedded standard H2. Suggestions for compatible RDBMS are provided by Keycloak: https://www.keycloak.org/docs/latest/server_installation/index.html#database
You require a tenant and a user.
Note: Users in Keycloak must also be entered in the yuuvis® user administration.
To create tenants and users, follow these steps:
http://localhost:8080/auth/admin
Create a new tenant in the navigation area via Master > Add realm.
Create and save a user for the tenant via Users > Add user.
Enter a password in the Credentials tab on the user page, set the Temporary option to Off, and save with Set Password.
To establish a connection, create a client following these steps:
http://localhost:8080/auth/admin
Select the tenant and create the new client via Clients > Create.
Enter a name in the Client ID field, and enter and save the yuuvis® authentication-service URL in the Root URL field.
Configure the following in the Settings tab of the client page:
Access Type > confidential
Authorization Enabled > ON
Valid Redirect URIs > Schema: http://<authentication-service>/*
All yuuvis® API hosts must be specified according to this schema.
Save the configuration by clicking Save.
In case of a yuuvis® Momentum system with multiple tenants, the authentication-service has to be registered as a Keycloak client in each corresponding realm.
https://localhost:8443/auth/
localhost.pem
via the tab Authorities in the certificate manager.https://localhost:8443/auth/
localhost.pem.
Import the certificate in the Java Trust Store with the following batch call:
...\service-manager\jdk\bin\keytool ^ -import ^ -trustcacerts ^ -keystore ...\service-manager\jdk\jre\lib\security\cacerts ^ -storepass changeit ^ -noprompt ^ -alias localhost ^ -file ...\path\to\localhost.pem |
The Keycloak login page can be embedded as an iframe into a second web page if this web page is published on the same host as Keycloak. If the secondary web page is published on a different host, it has to be legitimized in every Keycloak tenant that will use this web page for the login process:
http://localhost:8080/auth/admin/
In order to allow users with specific role to log in as any other user, impersonation can be activated in Keycloak. Thus, users with the specific role can use their own password to log in for the account of any other user within their tenant. In Keycloak, the feature is realized via impersonation by means of token exchange.
Open the StatefulSet
of Keycloak in your Kubernetes cluster for editing by running the command:
kubectl -n infrastructure edit statefulset keycloak |
Extend the containers
section as follows:
containers: - args: - -Dkeycloak.profile.feature.token_exchange=enabled - -Dkeycloak.profile.feature.admin_fine_grained_authz=enabled |
http://localhost:8080/auth/admin
The following commands use an administrative user root
with the password changeme
belonging to the tenant tenant1
that has the impersonation authorization as configured before. This user requests access to the account of the user specified by the ID cc14e5d4-e8da-4108-92ad-c87066aed4c3
.
Request a token for the administrative user with the impersonation authorization:
curl -k ^ -d "client_id=admin-cli" ^ -d "username=root" ^ -d "password=changeme" ^ -d "grant_type=password" ^ "http://localhost:8080/auth/realms/tenant1/protocol/openid-connect/token" |
Request a token for the account of the target user where the login is needed. The previously retrieved token of the administrative user is referenced as subject_token
whereas the ID of the target user is specified as requested_subject
.
curl -k ^ -H "Content-Type: application/x-www-form-urlencoded" ^ -d "client_id=admin-cli" ^ -d "requested_subject=cc14e5d4-e8da-4108-92ad-c87066aed4c3" ^ -d "subject_token=eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJueEZ..." ^ --data-urlencode "grant_type=urn:ietf:params:oauth:grant-type:token-exchange" ^ "http://localhost:8080/auth/realms/tenant1/protocol/openid-connect/token" |
The retrieved token can be used by the administrative user root
in order for the authentication to yuuvis® Momentum with the account of the target user.
The following command retrieves user-specific information on the user who will be logged in with the token specified in the authorization header. Check for the token retrieved before if it identifies the desired target user. Thus, in this example, the command should retrieve a data set for the user with ID cc14e5d4-e8da-4108-92ad-c87066aed4c3
.
curl -k ^ --request GET ^ --url "http://localhost:8080/auth/realms/tenant1/protocol/openid-connect/userinfo" ^ --header "accept: application/json" ^ --header "authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi1dXVSZ3daQldhTTJZaXNlZElFXzg..." |
This article explained how to install and configure Keycloak as an identity provider and access management system for yuuvis® Momentum in a manual procedure.
Read on
|