Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW

Qlik Sense: How to set up JWT authentication

No ratings
cancel
Showing results for 
Search instead for 
Did you mean: 
Damien_Villaret
Support
Support

Qlik Sense: How to set up JWT authentication

Last Update:

Nov 21, 2022 7:05:02 AM

Updated By:

Sonja_Bauernfeind

Created date:

Jun 3, 2017 4:03:15 AM

This article explains how to simply set up JWT authentication using Qlik Sense default certificates and test it.

 

Click here for Video Transcript

 

Steps:

  1. Create a new virtual proxy

    This section only explains settings specific to JWT and supposes that you have set up Name, Prefix, Session cookie header name, load balancing nodes and linked a Proxy to the new virtual proxy.
    These are the minimum settings required for a virtual proxy to work correctly. Please refer to 
    the Qlik Sense Online Help "Creating a virtual proxy" as well as Qlik Sense For Administrators - JWT authentication for details.

    1. In the authentication section, select JWT for authentication
    2. Paste the certificate used to sign/decrypt JWT in "JWT certificate

      In this article, we will use the default Qlik Sense certificate located:

      Important note: We use Qlik Default certificates for simplicity in this article, in a Production scenario, the customer should create the key material (generate a private/public key pair for JWT signing and verification) that is managed by customer internal security policies.

    3. Go to C:\ProgramData\Qlik\Sense\Repository\Exported Certificates\.Local Certificates
    4. Open server.pem in a text editor
    5. Copy the content including -----BEGIN CERTIFICATE----- and -----END CERTIFICATE----- then paste it in the JWT Certificate field in the QMC > Virtual Proxy configuration.
    6. Choose a value for JWT attribute for user ID and JWT attribute for user directory. That can be anything (except reserved key words for JWT claims) but it must match the values used in the JWT payload section when the JWT is generated.
    7. Apply changes and close.
       

      setup of the jwt certificate in a virtual token.png



  2. Generate the JWT

    In this article, we will directly use the JWT debugger available on https://jwt.io to generate the token. In a real use case, the JWT library corresponding to the programming language used should be used to generate the JWT.

    1. Open https://jwt.io and go to the debugger
    2. Select RS256 for the algorithm
    3. In the PAYLOAD box, set up your attributes previously set via QMA in Qlik Sense's virtual proxy configuration for the user ID and the user directory. (Note: Swap 'DOMAIN' with the user's directory) 
    4. In the Verify signature, paste server.pem (Certificate) and server_key.pem (Private key) content in the appropriate fields. Those files are both located in C:\ProgramData\Qlik\Sense\Repository\Exported Certificates\.Local Certificates
    5. You can now copy the JWT generated in the left field and test it. This should look like:

      encoded jwt.png

  3. Test the generated JWT

    In order to log in with JWT, you need to inject the JWT as a header. There are various extensions available depending on your browser in order to test this.

    In this example, we are using Chrome with Modheader.

    1. Install ModHeader from the Chrome Web Store
    2. Try to go to the hub:

                https://{your server name}/{prefix for JWT virtual proxy}/hub/

    3. You should get a 401 error: "Could not authenticate the request: Expected an authentication header." as no header has been provided.
    4. Go to ModHeader and set the following header:

             Header name: Authorization
             Header value: Bearer yourjwt

      request headers.png

    5.    Reload the page, you should now be logged into the hub correctly.


In order to integrate your solution with Qlik Sense using JWT authentication, you will need to pass in your code the JWT token in the authorization token for the first request to Qlik Sense so that a session is created.

Related Content:

Labels (1)
Comments
mbj
Employee
Employee

Hi,

Great example! you can also run a JWT server with qlik sense embedded in an Iframe using https://community.qlik.com/t5/Support-Knowledge-Base/Qlik-Sense-How-to-set-up-JWT-authentication/ta-... 

mbj
Employee
Employee
masprea
Contributor
Contributor

What to do if the JWT has rotating keys? For example Okta and the like rotate keys every 24 hours and therefore have multiple keys enabled at any time?

Can it work with an JWK URI instead?

mbj
Employee
Employee
You can just replace the certs or your server and in qlik cloud by using the APIs. (Remove jwt and create new one)

<>
[qlik-cloud-localserver-jwt-IFrame.png]
QHose/qlik-cloud-localserver-jwt-IFrame: An example of using JSON web tokens to process authorization to Qlik Cloud tenant using an AWS Lambda function.<>
github.com<>

mbj
Employee
Employee

More slides around jwt and Qlik cloud security (for OEM setups): https://integration.qlik.com/?selection=AHSkk7ZCD95SYttxF

 

mbj
Employee
Employee

So the posts above were for qlik cloud, but you can also do everything on client managed with the APIs. there is not JWK uri

 

masprea
Contributor
Contributor

yes, I thought about it too.

The issue is that for enterprise servers, to use this API to create new or update a virtual proxy, the only solution to authenticate is using client certificate authentication, which is like a root access on Qlik. So this adds a lot of overhead and security implications and it feels of very high risk for something that could have been done by Qlik itself.

Clearly when JWT was implemented there was a lack of understanding of what the tokens are for, because any enterprise implementation would have keys rotation given that JWT is stateless and as an attack vector, one would want to reduce the surface area rotating keys as much as possible.

Could you revisit this and ask if the functionality could be added?

mbj
Employee
Employee
Hi

You can use any authentication method to make the REST API calls. Not only certificates. So also jwt or ticketing.

Check also evaluation.qlik.com select presentation explorer, select api or security

I already shared your insights with the product manager. And they are aware.
MattiasThalén
Partner - Contributor II
Partner - Contributor II

According to JWT authentication, encrypted JWT isn't supported (i.e. HTTPS). So how would one work around this?

Version history
Last update:
‎2022-11-21 07:05 AM
Updated by: