SAML, OIDC, and Active Directory

External Identity Provider Setup

The Intelligence Hub supports using an External Identity Provider (IDP) for user login.

In this setup the hub defines the roles available to users, with appropriate restrictions. The IDP then assigns users to one or more hub roles by using the role names. After a user logs in through the IDP, the IDP sends the hub the list of roles the user is assigned to. The hub then matches the provided roles with the roles defined in the hub and restricts the users access.

Role names are matched using case-sensitive strings. Assume all settings described below are case-sensitive, and always match case with what is returned by the IDP.

Hub role names cannot contain dashes or spaces, but external group and role names often do (for example, an Active Directory group named Plant-Ops). To match these, add one or more aliases to a hub role. When a role has aliases, the IDP value is matched only against those aliases instead of the role name. See Role Aliases for how to configure them and the full matching rules.

Identity Provider Settings

IDPs are configured using the intelligencehub-identityproviders.json file located in application data directory. This file must be manually created before configuring or using any external IDP for user login.

The examples below cover how to configure the intelligencehub-identityproviders.json to enable SAML, OIDC, and Active Directory IDPs.

Internal Authentication

Below is an example file that enables login using locally defined user accounts.

{
	"authentication": {
		"providers": ["internal"]
	}
}

SAML 2.0

Below is an example file that enables SAML and internal login. There are a number of SAML specific settings that are covered below.

The SAML response must return a custom attribute named ‘roles’ that contains the role names assigned to the user.

{
	"authentication": {
		"providers": ["saml2", "internal"],
		"saml2": {
			"sp.nameidformat":
			"urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress",
			"sp.entityid": "Intelligence Hub entity id",
			"sp.assertion_consumer_service.url":
			"http(s)://host:port/config/login/idp",
			"idp.entityid": "IDP entity id",
			"idp.single_sign_on_service.url": "IDP login in URL",
			"idp.single_sign_on_service.binding":
			"urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect",
			"idp.x509cert": "IDPCertificate",
			"security.signature_algorithm":
			"http://www.w3.org/2001/04/xmldsig-more#rsa-sha256",
			"security.digest_algorithm":
			"http://www.w3.org/2001/04/xmldsig-more#rsa-sha256",
			"security.requested_authncontext":
			"urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport",
			"security.want_assertions_signed": false,
			"security.authnrequest_signed": false,
			"security.want_assertions_encrypted": false,
			"custom.roleNameAttribute" : "roles"
		}
	}
}
SettingsDescription
sp.nameidformatName identifier used to represent the requested subject.

Supported NameIdFormats:
  • urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress
  • urn:oasis:names:tc:SAML:1.1:nameid-format:X509SubjectName
  • urn:oasis:names:tc:SAML:1.1:nameid-format:WindowsDomainQualifiedName
  • urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified
  • urn:oasis:names:tc:SAML:2.0:nameid-format:kerberos
  • urn:oasis:names:tc:SAML:2.0:nameid-format:entity
  • urn:oasis:names:tc:SAML:2.0:nameid-format:transient
  • urn:oasis:names:tc:SAML:2.0:nameid-format:persistent
  • urn:oasis:names:tc:SAML:2.0:nameid-format:encrypted
sp.entityidIdentifier of the Intelligence Hub entity.
sp.assertion_consumer_service.urlWhere SAML assertions get sent to. Depending on where the Intelligence Hub is hosted.
sp.privatekeyThe name of the private key used to sign SAML messages. The private key should also be stored under this name in the Intelligence Hub KeyStore. This field should only be used when the AuthnRequest is encrypted and signed.

Note: Refer to the Certificate Section for more information.
sp.x509certThe name of the public key used to encrypt the SAML response. The certificate should also be stored under this name in the Intelligence Hub KeyStore. This field should only be used when the AuthnRequest is encrypted and signed.

Note: Refer to the Certificate Section for more information.
idp.entityidThe identifier of the IdP entity.
idp.single_sign_on_service.urlSingle sign on endpoint of the IdP. The URL where the AuthnRequest is sent.
idp.single_sign_on_service.binSAML protocol binding used to deliver the AuthnRequest message.

Note: The Intelligence Hub currently only supports urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect
idp.x509certName of public x509 certificate of the IdP. The certificate should also be stored under this name in the Intelligence Hub KeyStore.

Note: Refer to the Certificate Section for more information.
security.signature_algorithmAlgorithm that the toolkit will use on the signing process.
Supported algorithms:
  • http://www.w3.org/2000/09/xmldsig#rsa-sha1
  • http://www.w3.org/2000/09/xmldsig#dsa-sha1
  • http://www.w3.org/2001/04/xmldsig-more#rsa-sha256
  • http://www.w3.org/2001/04/xmldsig-more#rsa-sha384
  • http://www.w3.org/2001/04/xmldsig-more#rsa-sha512
security.digest_algorithmAlgorithm that the toolkit will use on the digest process.
Supported algorithms:
  • http://www.w3.org/2000/09/xmldsig#sha1
  • http://www.w3.org/2001/04/xmlenc#sha256
  • http://www.w3.org/2001/04/xmldsig-more#sha384
  • http://www.w3.org/2001/04/xmlenc#sha512
security.requested_authncontextAuthentication context. If this field is not included no AuthContext will be sent in the AuthnRequest.

Supported AuthContext:
  • urn:oasis:names:tc:SAML:2.0:ac:classes:unspecified
  • urn:oasis:names:tc:SAML:2.0:ac:classes:Password
  • urn:oasis:names:tc:SAML:2.0:ac:classes:X509
  • urn:oasis:names:tc:SAML:2.0:ac:classes:Smartcard
  • urn:oasis:names:tc:SAML:2.0:ac:classes:Kerberos
security.want_assertions_signedSet to true if the assertion received by the Intelligence Hub are signed. Set to false if it is not signed.
security.authnrequest_signedSet to true if the AuthnRequest sent by the Intelligence Hub is signed. Set to false if it is not signed.
security.want_assertions_encryptedSet to true if the assertions received by the Intelligence Hub are encrypted. Set to false if it is not.
parsing.trim_name_idsSet to true if the name IDs received by the Intelligence Hub need to be trimmed. Set to false if it is not.
parsing.trim_attribute_valuesSet to true if the attribute values received by the Intelligence Hub need to be trimmed. Set to false if it is not.
custom.roleNameAttributeThe name of the attribute used to map incoming idp roles to Intelligence Hub roles.

Note: Defaults to roles.

For more information on the settings, please see the following:

OpenID Connect (OIDC)

The Intelligence Hub uses the OIDC authorization code flow with PKCE. When a user picks Login with OIDC on the sign in screen, the hub redirects the browser to the identity provider. After the user authenticates, the provider redirects back to the hub’s redirectUri, and the hub exchanges the authorization code for tokens and validates the returned id token.

Below is an example file that enables OIDC and internal login.

{
	"authentication": {
		"providers": ["oidc", "internal"],
		"oidc": {
			"issuer": "https://idp.example.com/realms/intelligencehub",
			"clientId": "intelligence-hub",
			"encryptClientSecret": "****",
			"redirectUri": "http(s)://host:port/config/login/oidc",
			"usernameClaim": "preferred_username",
			"rolesClaim": "groups",
			"scopes": ["openid", "profile", "email"]
		}
	}
}
SettingsDescription
issuerBase URL of the identity provider. The hub uses it to discover the provider’s endpoints and signing keys from {issuer}/.well-known/openid-configuration.

Note: Must use https. http is only accepted for loopback addresses (localhost, 127.x.x.x, ::1) during local development.
clientIdClient ID of the application registered with the identity provider.
encryptClientSecretClient secret of the registered application. When manually creating the file, specify the secret in plain text. When the Intelligence Hub first runs it will encrypt the secret and write it back out to the file.
redirectUriWhere the identity provider sends the browser after the user authenticates. This must be the hub’s OIDC callback endpoint, and it must exactly match a redirect URI registered with the provider for this client. Takes the form http(s)://host:port/config/login/oidc, depending on where the hub is hosted.
usernameClaimClaim used as the account name of the logged in user. If the claim is missing or is not a string, the subject (sub) is used instead.
rolesClaimClaim used to map the roles returned by the identity provider to Intelligence Hub roles. The claim value must be a list of strings. Defaults to groups.
scopesScopes requested from the identity provider. openid is always requested, and is added automatically if it is left out of the list. Defaults to openid, profile, and email when the field is omitted or empty.

Active Directory

Below is an example file that enables Active Directory login. There are a number of AD specific settings that are covered below.

The AD response must include two key components. The attribute defined by the userRoleAttribute must define all the roles the user is assigned to. Each role is an object with many child attributes. The roleNameAttribute must define the child attribute that links to the hub role name. Both of these are required and are case sensitive.

{
	"authentication": {
		"providers": ["ad"],
		"ad": {
			"host": "localhost",
			"port": "389",
			"gatewayUsername": "User",
			"encryptGatewayPassword": "****",
			"domain": "domain.com",
			"ssl": false,
			"caAlias": "",
			"userFilter": "(&(objectClass=user)(!(objectClass=computer)))",
			"searchBase": "dc=domain,dc=com",
			"suffixGatewayUsername": true,
			"usernameAttribute": "sAMAccountName",
			"userRoleAttribute": "memberOf",
			"roleNameAttribute": "cn",
			"fullNameAttribute": "name",
			"phoneAttribute": "telephoneNumber",
			"emailAttribute": "mail",
			"smsAttribute": "mobile"
		}
	}
}
SettingsDescription
hostHostname of the server hosting AD.
portPort of the server hosting AD.
gatewayUsernameUser used to perform user lookups in AD.
encryptGatewayPasswordPassword of the user used to perform user lookups in AD. When manually creating the file, specify the password in plain text. When the Intelligence Hub first runs it will encrypt the password and write it back out to the file.
domainDomain of AD.
sslIf SSL is enabled when connecting to the AD server.
caAliasName of public x509 certificate of the AD server. The certificate should also be stored under this name in the Intelligence Hub KeyStore.

Note: Refer to the Certificate Section for more information.
userFilterApplied list filter when performing user lookups in AD.

Note: Defaults to (&(objectClass=user)(!(objectClass=computer))).
searchBaseApplied search filter when performing user lookups in AD.

Note: Defaults to the domain name.
suffixGatewayUsernameSet to true to append @domainName to the gateway username
usernameAttributeAttribute used to retrieve usernames. This is the username we compare against the user attempting to login.

Note: Defaults to sAMAccountName.
userRoleAttributeAttribute used to retrieve user roles.

Note: Defaults to memberOf.
roleNameAttributeAttribute to map Intelligence Hub user roles to the returned user roles (userRoleAttribute).

Note: Defaults to cn.
fullNameAttributeAttribute used to get the user’s full name.

Note: Defaults to name.
phoneAttributeAttribute used to get the user phone number.

Note: Defaults to telephoneNumber.
emailAttributeAttribute used to get the user email.

Note: Defaults to mail.
smsAttributeAttribute used to get the user sms number.

Note: Defaults to mobile.

Troubleshooting

Errors with IDP authentication are logged to the event log for troubleshooting. For advanced debugging, enable the Debug Logging .

If the user does authenticate with the IDP and we fail to match any of the IDP roles with hub roles, the user will remain logged in but will have no access rights, and will see permission errors in the UI.

SAML2 Advanced Logging

SAML2 supports advanced debugging by enabling logging. To do this, create a logback.xml in the appData directory. Place the following in the file.

<configuration scan="true" scanPeriod="10 seconds">
    <appender name="FILE" class="ch.qos.logback.core.FileAppender">
        <file>out/runtime.debug.log</file>
        <append>false</append>
        <immediateFlush>true</immediateFlush>
        <encoder>
            <pattern>%-4relative [%thread] %-5level %logger{35} - %msg%n</pattern>
        </encoder>
    </appender>

    <root level="OFF">
        <appender-ref ref="FILE" />
    </root>

    <logger name="com.onelogin.saml2.authn" level="ALL">
        <appender-ref ref="FILE" />
    </logger>

</configuration>

Stop and restart the runtime with the following command added to the command line.

-Dlogback.configurationFile=logback.xml

The command can be added to the start script for the operating system.

// Example adding to start-windows.bat
java -Dlogback.configurationFile=logback.xml -cp "intelligencehub-runtime.jar;lib/*" com.highbyte.intelligencehub.runtime.Main start

Detailed SAML2 debug logs will be logged to a runtime/out/runtime.debug.log file.