Auth0 Integration
Overview
This section provides instructions on:
Auth0 authentication: How to configure WorkflowGen authentication using Auth0.
Auth0 user provisioning: How to create a directory with the self-provisioning connector.
Auth0 configuration for mobile apps: How to authorize WorkflowGen access to mobile applications using Auth0.
Auth0 configuration for server-side scripts: How to authorize WorkflowGen access to server-side scripts using OpenID Connect and Auth0.
Auth0 configuration for single-page applications: How to authorize WorkflowGen access to single-page applications using Auth0.
Auth0 configuration for the WorkflowGen CLI: How to authorize Auth0 access to the WorkflowGen command line interface.
Generating a universal link for WorkflowGen Plus: How to generate a universal link to simplify the WorkflowGen Plus mobile app user login.
It also provides additional information on SOAP services support and provisioning users and groups.
Prerequisites
Make sure to have a licensed copy of WorkflowGen installed and running on a server.
Make sure to have administrative access to Auth0 to be able to configure it properly.
Make sure to have provisioned an existing Auth0 user with which you can authenticate to WorkflowGen so that you can use the application afterwards.
Make sure to have successfully configured delegated authentication to Auth0 on your WorkflowGen instance following the instructions in the Auth0 authentication section.
In the instructions, substitute <workflowgen url>
with the domain and path to your WorkflowGen instance; for example, localhost/wfgen
or www.workflowgen.com/wfgen
.
Auth0 authentication
Prerequisites
Make sure to have a licensed copy of WorkflowGen installed and running on a server. You must be a WorkflowGen administrator.
Make sure to have Auth0 administrator access.
Make sure to have provisioned an existing Auth0 user that you can authenticate with to WorkflowGen and that the user has administrator privileges. This is important because once you activate the delegation, you'll need to still be able to manage the application. The Auth0 user is in fact a user of an identity provider that's linked to Auth0, such as GitHub or Google. You have to have provisioned at least one user.
AES encryption mode and its key are required for the authentication to work.
To test your configuration after you complete the steps below, you can add an Auth0 user in the Users section of the Auth0 portal.
When importing users into WorkflowGen from the Auth0 database, make sure to set the username as the email (e.g.
john.doe@example.com
).
Auth0 configuration
The configuration of Auth0 is done in several steps. First, you have to register the WorkflowGen web application and link it to your instance of WorkflowGen; then, you have to register the WorkflowGen GraphQL API to be able to register custom applications to access it.
Step 1: Create a new regular web application
Go to the Auth0 portal Applications section.
Click Create Application, and fill in the form:
Name:
WorkflowGen Web App
Type: Regular Web Application
Click Create. You should now see the application's Quick Start page:
On the Settings tab, scroll down to the Allowed Callback URLs section and add
https://<workflowgen url>/auth/callback
to it.Scroll down to the Allowed Logout URLs section and add
https://<workflowgen url>/auth/logout/return
to it.
Your WorkflowGen Regular Web App is now configured.
Step 2: Register the GraphQL API
Now, you need to register the WorkflowGen GraphQL API module so that applications external to WorkflowGen can use the API by authentication through Auth0 using the OpenID Connect protocol.
Classic usage:
Go to the Auth0 portal APIs section.
Click Create API, and fill in the form:
Name:
WorkflowGen GraphQL API
Identifier:
https://<workflowgen url>/graphql
Signing algorithm:
RS256
Your form should look like this:
Click Create.
With multi-audience support:
Go to the Auth0 portal APIs section.
Click Create API, and fill in the form:
Name:
My APIs
Identifier:
my-apis
Signing algorithm:
RS256
Click Create.
Click Permissions.
In the Define all the permissions (scopes) that this API uses section, enter the following information:
Permission:
wfgen-graphql-full-access
Description:
Full access to the WorkflowGen GraphQL API
Click ADD.
The GraphQL API is now registered in Auth0.
Step 3: Add an Auth0 rule
In order to get a proper username from the access token when receiving one in the GraphQL API, you need to use a special feature of Auth0 called a rule. Rules act as middleware between the linked cloud provider and Auth0 in order to get the correct values when needed.
Go to the Auth0 portal Rules section, select Auth Pipeline in the left menu, then select Rules in the sub-menu.
Click Create Rule, then choose the empty rule template.
Replace the code with the following:
Click Save.
This step will ensure that WorkflowGen and the GraphQL API always get a username through the same claim instead of having to make a lot of conditional statements. However, this doesn't apply to machine-to-machine authentication since there's no human user involved.
If you use a different claim from the Auth0 mapping than the one specified in the function above (e.g. user.username
, user.email
, user.nickname
), just modify this rule or add your own. Make sure to populate https://api.workflowgen.com/username
with the value or to configure the ApplicationSecurityAuthUsernameClaim
option in your web.config
with the correct claim to take. Note that this option is used both in the authentication application and the GraphQL API.
WorkflowGen configuration
Now, you have to configure WorkflowGen to delegate its authentication to Auth0.
Step 1: Add Auth0 values to the WorkflowGen web.config
web.config
Open the WorkflowGen
web.config
file and add the following properties under<appSettings>
:Classic usage:
With multi-audience support:
Replace
<CLIENT ID>
with the client ID of the WorkflowGen Regular Web App in Auth0.Replace
<CLIENT SECRET>
with the client secret of the WorkflowGen Regular Web App in Auth0.Replace
<METADATA URL>
with the URL that you built earlier from your domain name in Auth0. TheMETADATA URL
ishttps://[YOUR_AUTH0_DOMAIN].auth0.com/.well-known/openid-configuration
.
Note that the ApplicationSecurityAuthUsernameClaim
key is set to the value entered in the rule earlier. Therefore, you can use any value here as long as you also modify the rule.
Table of web.config
options
WorkflowGen is now linked to Auth0 and back. The last thing left to do is configure a few more options in order to finish the internal wiring of WorkflowGen so that it can delegate its authentication.
Step 2: Add security values for session generation
In order to generate a session token, you need to add a few more settings to the web.config
.
Open the WorkflowGen
web.config
file and add the following properties under<appSettings>
:Replace
<SECRET>
with a value that can't be guessed, such as a UUID.
The secret will be only accessible inside your instance of WorkflowGen, so when generating a session token, WorkflowGen will sign it with this secret in order to check the validity of all session tokens passed to it.
Step 3: Activate the authentication delegation
You now need to activate the delegation by replacing the authentication system in IIS and pointing WorkflowGen's modules to the correct authentication module.
Configure IIS
In IIS Manager, click on the WorkflowGen application in the tree view.
Click the Authentication button.
Enable Anonymous Authentication, and disable all other authentications.
Perform these steps for all sub-applications as well.
Add properties to the web.config
files of certain modules
Certain modules need to have their authentication checked by the special Advantys.Security.JWTAuthenticationModule
WorkflowGen authentication module, but certain other modules should not because they are either public or aren't part of the global authentication system.
In the WorkflowGen
web.config
, add the following property:In the
auth
module'sweb.config
, add the following property:This line removes the authentication Node.js module from the global authentication system, because this Node.js application encapsulates the OpenID Connect authentication mechanisms.
Repeat the above two steps for the
hooks
andscim
modules as well.Copy the following .NET assemblies and dependency libraries from
\wfgen\bin
to each custom webform's\bin
folder (\wfgen\wfapps\webforms\<custom webform>\bin
):Advantys.My.dll
Advantys.Security.dll
Newtonsoft.Json.dll
jose-jwt.dll
You should now have a working WorkflowGen instance with the authentication delegated to Auth0 through the OpenID Connect protocol. Make sure to have provisioned your users to WorkflowGen in order for them to successfully access WorkflowGen.
Configurable options
This table lists all configurable options in WorkflowGen that you can use to customize your authentication experience; these are located in the WorkflowGen web.config
file.
Auth0 user provisioning
The self-provisioning connector is a directory connector that automatically creates and synchronizes a user based on the user's session token claims that contain claims from the OpenID Connect provider ID token. This feature is only compatible with an OpenID Connect authentication.
Prerequisites
Make sure to have a working WorkflowGen instance.
Make sure to know the instance's IP address or its fully qualified name.
Make sure to know the address of the instance.
Make sure to have configured Auth0 or one of the other OIDC-compliant authentication methods (Azure Active Directory, AD FS, Okta, or Microsoft Identity Platform v2.0).
WorkflowGen configuration
This section will guide you through the WorkflowGen configurations necessary to set up the self-provisioning feature with a directory.
Step 1: Create a self-provisioning directory
This directory will contain all of the users that are not provisioned elsewhere. To create a self-provisioning directory, do the following:
On the Directories page in the WorkflowGen Administration Module, click New directory.
Fill in the form:
Name:
SELF_PROVISIONING
(or something else)Description: A good description of the directory
Directory connector:
Self-provisioning
Click Save.
Step 2: Configure the user fields-to-claims mapping
Now that you've created a new directory with the self-provisioning connector, you need to define which claims are mapped to which WorkflowGen user field. To do this:
On the new directory's page, click Edit mapping.
To the right of the name of a WorkflowGen user's field, enter the name of the claim in the session token that you want to map.
Here's an example of a session token generated by the auth node application from the Auth0 ID token connected with Google Apps:
These claims could be mapped in WorkflowGen like this:
✏️ Note: The Username and Name fields are required.
Click Save.
You've now activated the self-provisioning feature, and unknown users can be automatically provisioned and synchronized to WorkflowGen without any external actions required.
Auth0 configuration for mobile apps
Mobile applications must use an approach similar to that of regular web applications, which is called Authorization Code Flow with Proof Key for Code Exchange (PKCE). The main difference between this and the classic Authorization Code Flow is that the mobile application doesn't get a client secret, but instead exchanges a pair of codes to prove the origin of the authentication attempt. The issue is that a mobile application can't be trusted with a client secret because it's distributed directly to users and is therefore no longer under the developer's control, and the sources can be decompiled and analyzed to find secrets like this.
This section provides instructions on how to configure Auth0 for the WorkflowGen Plus mobile application so that your mobile users can benefit from delegated authentication as well.
Prerequisites
Make sure to have a licensed copy of WorkflowGen installed and running on a server.
Make sure to have administrative access to Auth0 to be able to configure it properly.
Make sure to have provisioned an existing Auth0 user with which you can authenticate to WorkflowGen so that you can use the application afterwards.
Make sure to have the WorkflowGen Plus mobile application installed on a device that you have access to.
Make sure to have the latest WorkflowGen Plus version installed on your device and that your device is supported.
Make sure to have successfully configured delegated authentication to Auth0 on your WorkflowGen instance following the instructions in the Auth0 authentication section.
Auth0 configuration
This configuration is done in several steps. First, you have to register a new native application in Auth0. Then, you have to give the application the necessary permissions to access the WorkflowGen GraphQL API. Finally, you have to register the correct callback URLs that will redirect within the native application.
Step 1: Register a new native application
In the Auth0 portal, click Create Application in the Applications section.
Fill in the form:
Name:
WorkflowGen Plus
Type:
Native
Click Create at the bottom of the page.
You've now registered a new native application in Auth0.
Step 2: Add callback URLs
On the Settings tab, scroll down to the Allowed Callback URLs and add the URL
workflowgenplus://auth.authenticate
.Scroll down further to the Allowed Logout URLs section and add the URL
workflowgenplus://auth.deauthenticate
.
Review the registration
You don't need to give the application access to the GraphQL API since all applications (except for machine-to-machine applications) have access to all registered APIs within a domain. Here's a review of the information you need:
A client ID, which can be found on the native application page's Settings tab.
An Auth0 domain name, which can be found directly to the left of your profile picture on the top right corner of the page.
All of this information must be given to the users who will be using the mobile application; they'll need to copy them directly into the app.
Auth0 configuration for server-side scripts
In some cases, you'll want to perform a specific task that can be automated but needs access to the WorkflowGen GraphQL API; this use case is often in the form as a server-side script. For this, OAuth2 provides a type of grant called Client Credentials that simply exchanges a client ID and secret for an access token. There is no ID token since it's not part of the OpenID Connect standard and there's no user involved.
This section provides instructions on how to configure Auth0 with a server-side script that has access to the GraphQL API. First, you'll need to configure a new web application in the Auth0 portal; then, you'll need to configure a new application in WorkflowGen.
Prerequisites
Make sure to have a licensed copy of WorkflowGen installed and running on a server.
Make sure to have administrative access to WorkflowGen.
Make sure to have administrative access to Auth0 to be able to configure it properly.
Make sure to have successfully configured delegated authentication to Auth0 on your WorkflowGen instance following the instructions in the Auth0 authentication section.
Auth0 configuration
Step 1: Register a new machine-to-machine application
In the Auth0 portal Applications section, click Create Applications.
Fill in the form:
Name:
Your script name
Application Type:
machine-to-machine
Click Create.
You've now successfully registered your script in Auth0.
Step 2: Grant access to the GraphQL API
In the Auth0 portal APIs section, click WorkflowGen GraphQL API.
On the Machine-to-Machine tab, authorize the application that you just created.
You've now successfully granted the GraphQL API access to your script.
Review the registration
Here's a review of the information you need:
A client ID, which can be found on the registered application's General tab.
A client secret, which can be found on the registered application's General tab.
The WorkflowGen GraphQL API identifier, which can be found on its settings page.
You're now ready to register your script in WorkflowGen.
WorkflowGen configuration
As with user provisioning, WorkflowGen needs to know which application is accessing the GraphQL API. Therefore, you have to register the application, which consists of your script.
Register a new application
On the Applications page in the WorkflowGen Administration Module, click New application.
Fill in the form:
Name:
My Server Application
Description: A description that clearly identifies the script
Type:
Non-interactive Client
Impersonate username: Any username that has the required access to the GraphQL API
Client ID: The client ID you retrieved earlier
Active: Check this checkbox
Click Save.
Your application should now appear in the list of applications.
You should now have the necessary components in place to make GraphQL API requests with your script by passing the access token received from Auth0 from a Client Credentials Grant flow.
Auth0 configuration for single-page applications
JavaScript applications running in a browser are often hard to secure due to the open nature of the Web. Secure storage is nonexistent, and everything is in clear text (for HTTP version 1.1). Here's a quote from the Azure Active Directory team that summarizes the state of authentication with single-page applications:
The OAuth2 implicit grant is notorious for being the grant with the longest list of security concerns in the OAuth2 specification. And yet, that is the approach implemented by ADAL JS and the one we recommend when writing SPA applications. What gives? It’s all a matter of tradeoffs: and as it turns out, the implicit grant is the best approach you can pursue for applications that consume a Web API via JavaScript from a browser.
It's therefore important that you make all of the necessary checks to verify the validity of your requests and the responses.
This section provides instructions on how to configure Auth0 with a single-page application (SPA) so that users can authenticate through it and make requests to the WorkflowGen GraphQL API. This configuration is done in three steps: registering your SPA, granting access to the API, and setting some redirect URLs.
Prerequisites
Make sure to have a licensed copy of WorkflowGen installed and running on a server.
Make sure to have administrative access to Auth0 to be able to configure it properly.
Make sure to have provisioned an existing Auth0 user with which you can authenticate to WorkflowGen so that you can use the application afterwards.
Make sure to have successfully configured delegated authentication to Auth0 on your WorkflowGen instance following the instructions in the Auth0 authentication section.
Auth0 configuration
Step 1: Register a new web application
In the Auth0 portal, click Create Application in the Applications section.
Fill in the form:
Name:
Your SPA name
Type:
Single Page Web Applications
Click Create at the bottom of the page.
You should now be on the registered application page.
Step 2: Add redirect URLs
On the Settings tab, scroll down to the Allowed Callback URLs section and add your application's login callback URL (for example,
https://localhost/login/callback
).If you support logout from Auth0, scroll down to the Allowed Logout URLs section and add your post logout redirect URL (for example,
https://localhost/logout/return
).
Review the registration
You need a client ID, which can be found on the application page's Settings tab.
You need your Auth0 domain name, which can be found next to your Auth0 profile picture in the top right corner of the portal.
Your application should now be successfully linked to the Auth0 infrastructure and users can login through it. If you have met the prerequisites, your application will receive an access token that it can send to the WorkflowGen GraphQL API to make authorized requests as a Bearer token via the Authorization
header.
Auth0 configuration for the WorkflowGen CLI
Interactive mode
Step 1: Register a new native application
In the Auth0 portal Applications section, click Create Application.
Fill in the form:
Name:
WorkflowGen CLI
Type:
Native
Click Create at the bottom of the page.
You've now registered a new native application in Auth0.
Step 2: Add a callback URL
On the Settings tab, scroll down to the Allowed Callback URLs and add the URL http://127.0.0.1:8888/callback
.
Port 8888
is defined by default; you can change it if it's already in use on your computer.
Step 3: Verify the grant types
In Settings > Advanced Settings > Grant Types, make sure that the Implicit
, Authorization Code
, and Refresh Token
checkboxes are checked.
Review the registration
Since all applications in a domain can automatically access each other, your native application inherits access to the GraphQL API. Here's a review of all the information you need:
A client ID, which can be found on the native application's Settings tab.
An Auth0 domain name, which can be found on the native application's Settings tab.
All of this information must be given to the users who will be using the WorkflowGen CLI.
Non-interactive mode
The configuration of non-interactive mode is the same as in the Auth0 configuration for server-side scripts section.
Here's a review of the information you'll need:
A client ID, which can be found on the registered application's parameters page.
A client secret, which can be found on the registered application's parameters page.
The domain, which can be found on the registered application's parameters page.
You can now use the WorkflowGen CLI in Client credentials
mode.
Generating a universal link for WorkflowGen Plus
As of WorkflowGen Plus version 1.2.0 and WorkflowGen server version 7.11.2, you can generate a universal link to simplify the Auth0 login process for your WorkflowGen Plus mobile app users.
Base URL
protocol:
workflowgenplus://
hostname:
auth.init
Parameters
You'll need to specify the following parameters:
provider:
auth0
client_id: Use the client ID you created earlier in the configuration (e.g.
7gdj4hs92y
)domain: The Auth0 domain name without URL protocol (e.g
mydomain.auth0.com
)audience: Your WorkflowGen GraphQL API URL, whose value must be URL encoded (e.g.
http://workflow.mycompany.com/wfgen/graphql
)
The universal link should follow this format:
Once you've generated the universal link, give it to your users, who can use it to sign in to WorkflowGen Plus with the preset sign-in method.
Additional information on Auth0 integration
SOAP services support
WorkflowGen only supports requests to the SOAP API using classic authentication methods. If you still need to use this API, you have to perform some additional steps to configure it properly.
Create a new separate WorkflowGen directory for the SOAP API users.
Provision it with users and groups as needed.
In the IIS Manager, enable the Basic authentication method for the
\ws\wfgen
application.In the
web.config
file (located in\Inetpub\wwwroot\wfgen
), add the following under<location path="ws" inheritInChildApplications="false">
:
Provisioning users and groups
There's no automatic way to provision your users and groups from the identity providers you use behind Auth0 with WorkflowGen. You'll have to synchronize them using one of the supported directory synchronization methods.
Last updated