OpenID Connect authentication

Last modified by michelhc on 2020/11/20 16:00

Configuration

Installation of an OpenID Connect authentication valve for DigDash

Contents

Prerequisites

  • The acronyms used later are referenced in the glossary at the end of this document.
  • Having configured the DigDash server with an SSL / TLS (HTTPS) connector (this authentication method requires secure exchanges)
  • Have the <digdash_installation> / add-ons / valve_openidconnect folder containing all the files necessary for setting up the OpenID Connect authentication valve in the DigDash Tomcat server. The placement of these files is described in this document.
    • The apache-tomcat folder: transposed to <digdash_install> / apache-tomcat
      • The lib sub-folder: libraries and log configuration file to be placed in <digdash_install> / apache-tomcat / lib
      • The webapps sub-folder: the DigDash entry point (endpoint) in a .war to place in <digdash_install> / apache-tomcat / webapps
  • The following operations are to be performed on the stopped DigDash server .
  • The user to be authenticated must exist at both the OP and in the LDAP DigDash.
    • It is therefore advisable to have at least one user having the rights to add DigDash users in the LDAP DigDash before installing the OpenID Connect valve, this in order to avoid SSO authentication failures from the first connections for cause of absence of such user in LDAP.

Configuration of the DigDash server

Copy of libraries

Add the libraries and the log configuration file from the apache-tomcat / lib folder to the folder

<digdash_installation> / apache / lib :

oidc-valve.jarslf4j-log4j12-1.7.7.jar
slf4j-api-1.7.12.jarlog4j.properties
log4j-1.2.15.jar 

Libraries in the apache-tomcat / lib folder

Addition of the OpenID Connect authentication valve

Add the OpenID Connect authentication valve in the server.xml file located in the folder

<digdash_installation> / apache-tomcat / conf

To do this, add the following Valve element in the Host element .

<Server ... >
  ...
     <Host ... >
         <Valve className="org.bsworks.catalina.authenticator.oidc.OpenIDConnectSSOValve"
                allowAddr="localhost, 127.0.0.*,0:0:0:0:0:0:0:1"
                sharedPasswd="secret"
                redirect_url="https://localhost:8443/digdash_oidc_endpoint/oidcendpoint"
                providers="[
                 {
                       name: OpenID Provider name,
                       issuer: issuer,
                       clientId: clientId,
                       clientSecret: clientSecret
                 }
                 ]"

                usernameClaim="email"
                additionalScopes="email"
         ></Valve>
          ...
     </Host>
  ...
</Server>

Extract from the server.xml file

Value for parameter className is invariable.
Values for parameters allowAddr, sharedPasswd, redirect_url, providers, usernameClaim, additionalScopes are variable according to the installation.

AttributesDescription
className (required)     Name of the Java class, implementing the org.apache.catalina.Valve interface, to use as Valve here. This attribute is mandatory because it allows you to select the Valve to use. There are indeed several implementations provided by Tomcat.
allowAddr (required)     Server IP address.
allowedCtxPath (optional)     Optional, is "/ adminconsole" by default; it is the path of the context whose resources are authorized to pass the valve, useful when the adminconsole is named differently. Example: allowedCtxPath = "/ customadminconsole"
sharedPasswd (required)     The shared password and verified at authentication (see point II.5)
redirect_url (required)     This is the path of the application to which users will be redirected after authenticating with the OP. For DigDash, the URL will always be https: // <IPaddress>: <port> / digdash_oidc_endpoint / oidcendpoint
cookieTimeOut (optional)     

Optional, this is the time (in seconds) after which the SSO cookie will expire. Worth 1800 seconds (30 minutes) by default.
 Otherwise, the cookie will expire after the number of seconds mentioned.

Example: cookieTimeOut = "3600" (1 hour)

print_debug (optional)     Optional, is false by default, otherwise add print_debug = "true" for more verbose traces.
providers (required)     

Array form value of objects in JSON. Each element corresponds to an OpenID Provider used by the application.

The syntax differs from the standard JSON format in that double quotes are not used for the names of properties and their values ​​(so as to make the format more XMLian). A value can be surrounded by single quotes if it contains separators such as a comma, braces, or spaces. Each object representing a PO has the following properties:

issuer (mandatory)  : This is the only one with a unique URL to identify the OP.     

name (optional)  : A name associated with the PO; if not by default.

clientId (mandatory):  The client ID associated with the application at the PO.

clientSecret (optional)  : The Secret client. Note that most POs require a Secret client, especially for calls to PO entry points. However, some OPs support public clients, hence the absence of a Secret client.

usernameClaim (optional):  The user Identifier attribute requested by the RP and returned by the OP to identify the user who authenticates.

additionalScopes (optional)  : Additional scopes with an 'openid' scope separated by spaces.

usernameClaim (optional)     The default User Identifier used by all OPs which do not specify one in the proper properties of the OP.
additionalScopes (optional)     The default additional scopes used by all OPs which do not specify one in the proper properties of the OP.
httpConnectTimeout (optional)     Timeout in milliseconds for establishing the connection to the OP. 5000 ms (5 seconds) by default.
httpReadTimeout (optional)     Timeout in milliseconds for reading data received from the OP. 5000 ms (5 seconds) by default.

Table describing the attributes of the Vavle element

Addition of the .war corresponding to the entry point of the Relying Party

Add the digdash_oidc_endpoint.war archive from the apache-tomcat / webapps folder to the folder

<digdash_installation> / apache-tomcat / webapps .

It is the entry point (endpoint) of the RP accessed by the PO.

Addition of security constraints

Add the security constraints to the web.xml file located in the folder

<digdash_installation> / apache-tomcat / conf .

<web-app ... >
  ...
     <security-role>
         <role-name> CUSTOM </role-name>
     </security-role>

     <security-constraint>
         <display-name> CUSTOM Security Constraint </ display -name>
         <web-resource-collection>
             <web-resource-name> Protected Area </web-resource-name>
             <url-pattern> / * </url-pattern>
         </web-resource-collection>
         <auth -constraint>
             <role-name> CUSTOM </role-name>
         </auth-constraint>
     </security-constraint>

     <security-constraint>
         <web-resource-collection>
             <web-resource-name> Non-Protected Area</web-resource-name>
             <url-pattern> / vjdbc </url-pattern>
         </web-resource-collection>
     </security-constraint>
  ...
</web-app>

Extract from web.xml file

Server URL and domain for the Dashboard

It may be necessary, and it is advisable to specify on which server / domain the Dashboard will rely.

To do this, modify in the web.xml file in

<digdash_installation> / apache-tomcat / webapps / digdash_dashboard / WEB-INF.

To force the domain, change the value of the FORCEDOMAIN parameter to true .
 Mention the domain name by changing the DOMAIN parameter .

To force the server address, change the value of the  FORCEURLSERVER  parameter to true .  Mention the server address by changing the SERVERURL parameter .

<web-app ... >
  ...
     <servlet>
         <servlet-name>dashServlet</servlet-name>
         <servlet-class>com.digdash.server.DigdashServiceImpl</servlet-class>
          ...
         <init-param>
             <param-name>DOMAIN</param-name>
             <param-value>ddenterpriseapi</param-value>
         </init-param>
         <init-param>
             <param-name>FORCEDOMAIN</param-name>
             < param-value>true</param-value>
         </init-param>
         <init-param>
             <param-name> SERVERURL </param-name>
             <param-value>http://localhost:8080</param-value>
         </init-param>
         <init-param>
             <param-name>FORCESERVERURL</param-name>
             <param-value>true</param-value>
         </init-param>
          ...
     </servlet>
  ...
</web-app>

Extract from web.xml file

Values for parameters DOMAIN, FORCEDOAMIN, SERVERUEL, FORCESERVERURL are variable according to the installation.

config_auth_oidc_fr_html_829eaa34e529ef0c.png

The example value for the SERVERURL parameter will almost always refer to localhost, when the dashboard and the server are placed in the same Tomcat server, which represents almost 99% of the uses. It will naturally be necessary to refer to the address of the external server if these two elements are placed on different servers.

config_auth_oidc_fr_html_829eaa34e529ef0c.png
 

This parameter can be edited via the web.xml file as indicated above. This file is specific to each installation of DigDash. You can enter this parameter more generally in the file

<user> / Application Data / Enterprise Server / dashboard_system.xml 

For more information, you can refer to the DigDash documentation “guide_avance_systeme_fr.pdf”.

Changing the value of the sharedPasswd parameter

Change the value of the sharedPasswd parameter (secret value below to change) in the web.xml file of Dashboard in the folder

<digdash_installation> / apache-tomcat / webapps / digdash_dashboard / WEB-INF .

The value must correspond to that mentioned in the sharedPasswd attribute in the valve of the file

<digdash_installation> /apache-tomcat/conf/server.xml (see part II.2).

<web-app ... >
  ...
     <servlet>
         <servlet-name>dashServlet</servlet-name>
         <servlet-class>com.digdash.server.DigdashServiceImpl</servlet-class>
          ...
         <init-param>
             <param-name>sharedPasswd</param-name>
             <param-value>secret</param-value>
         </init-param>
          ...
     </servlet>
  ...
 </web-app>

Value for parameter sharedPasswd is variable according to the installation

Extract from the server.xml file

Modification of the authentication method

Modify the authentication method (LDAP is the default method) in the web.xml file located in the folder

<digdash_installation> / apache-tomcat / webapps / ddenterpriseapi / WEB-INF .

"External" means that safety is managed by the valve configured above.

<web-app ... >
  ...
     <servlet>
      ...
     </servlet>
      ...
     <servlet>
         <description></description>
         <display-name>DDEnterpriseAuthServlet</display-name>
         <servlet-name >DDEnterpriseAuthServlet</servlet-name>
         <servlet-class>com.digdash.server.DDEnterpriseAuthServlet</servlet-class>
         <init-param>
             <param-name>authMethod</param-name>
             <param-value>External</param-value>
         </init-param>
          ...
     </servlet>
  ...
 </web-app>

Extract from web.xml file

OpenID Provider configuration

The OP must register DigDash as a RP in its list of RPs for DigDash to be able to take advantage of Single Sign-On.

Also, the OP will have to enter the callback URL to identify the entry point of the DigDash application. The URL will be of the form

https: // <IP address>: <port> / digdash_oidc_endpoint / oidcendpoint

Log level

You can customize the log level for the authentication valve.

By default, only errors are logged. If however you want to have more details on the course of actions and exchanges between the different entities, you can assign the value 'DEBUG' instead of 'ERROR' in the log4j.properties file which was imported into the lib folder of Tomcat .

log4j.logger.org.bsworks = ERROR , stdout

log4j.logger.org.bsworks = DEBUG , stdout

OpenID Connect authentication on the Enterprise Studio side

To authenticate with OpenID Connect on the Enterprise Studio side, please ensure that you have performed the following actions:

Server and domain definitions in the .jnlp file

You can, like the Dashboard, define the server and the domain on which DigDash will rely.

To do this, modify the end of the digdash.jnlp file in the DigDash installation folder <digdash_installation> / apache-tomcat / webapps / adminconsole

<jnlp ...>
  ...
     <application-desc main-class="commandline.CommandLineMain">
         <argument>https://localhost:8443</argument> (1)
         <argument>ddenterpriseapi</argument> (2)
         <argument><%=lang%></argument> (3)
         <argument><%=dashboard%></argument> (4)
         <argument>-AuthMode=External</argument> (5)
         <argument>-SSLNoPathCheck</argument> (A)
          ...
     </application-desc>
</jnlp>

Extract from the digdash.jnlp file

Warning : the arguments noted (1), (2), (3), (4), (5) must not change order.

Argument (1): the address of the DigDash server; variable depending on your installation

Argument (2): the name of the DigDash domain; variable depending on your installation

Argument (5): The authentication method; External, mandatory

Argument (A): optional argument, sometimes necessary in the case of SSL, HTTPS connections.

Connection to DigDash Enterprise Studio

Download and run the .jnlp by going to the DigDash home page in the Enterprise Studio section.

1592471261704-499.png

An authentication window should appear with the IdP authentication target.

In this document, Google is the OP that we have chosen to illustrate our examples.

config_auth_oidc_fr_html_4273fd0e30eb8463.png

 

Capture: test pattern with Google OP authentication form

The user will have to enter his connection data and if he has been authenticated with the OP and that he corresponds to an existing user in the LDAP DigDash, the authentication will have succeeded and the window will attest to the success of the authentication.

config_auth_oidc_fr_html_6230a5f637fd4c54.png

 

Capture: window of successful authentication

The window will close automatically, then Enterprise Studio will start loading to launch.

Lexicon

We will call in this document:

  • SSO: Single Sign On or Single Authentication; OpenIDConnect is an SSO method
  • OP: OpenID Provider or the Identity Provider
  • PR: the Relying Party or the Service Provider (DigDash)
  • Endpoint: Entry point

References

https://www.oasis-open.org

DigDash uses the OpenSource tomcat8-oidcauth library from Boyle Software, Inc. to support the OpenID Connect authentication method.

https://www.boylesoftware.com/

https://github.com/boylesoftware/tomcat8-oidcauth