Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
I have been able to connect QRS Rest API using Certificates and X-Qlik-User now I need the same to connect using the .NET SDK.
How can we authenticate to the .NET SDK using certificates?
Thanks
Hi,
this is at the moment not possible. As a workaround. Connect with certificate and .net web requests, get the Qlik-Session-ID ans use the following code:
public static class LocationExtensions_akquinet
{
private static Logger logger = LogManager.GetCurrentClassLogger();
public static void AsExistingSessionViaProxy(this ILocation location, string sessionId, bool useSsl = true, string cookieHeaderName = null)
{
var SecurityProperty = location.GetType().GetProperty("Qlik.Engine.ISecureLocation.Security", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
var Security = SecurityConfigurator.OpenAsExistingSessionViaProxy(sessionId, useSsl, cookieHeaderName ?? "X-Qlik-Session");
SecurityProperty.SetValue(location, Security);
}
private static PropertyInfo SecurityConfiguratorProperty = null;
internal static Qlik.Sense.Communication.Communication.Security.ISecurityConfigurator SecurityConfigurator
{
get
{
if (SecurityConfiguratorProperty == null)
SecurityConfiguratorProperty = typeof(LocationExtensions).GetProperty("SecurityConfigurator", BindingFlags.Static | BindingFlags.NonPublic);
return SecurityConfiguratorProperty.GetValue(null) as Qlik.Sense.Communication.Communication.Security.SecurityConfigurator;
}
}
Hi,
this is at the moment not possible. As a workaround. Connect with certificate and .net web requests, get the Qlik-Session-ID ans use the following code:
public static class LocationExtensions_akquinet
{
private static Logger logger = LogManager.GetCurrentClassLogger();
public static void AsExistingSessionViaProxy(this ILocation location, string sessionId, bool useSsl = true, string cookieHeaderName = null)
{
var SecurityProperty = location.GetType().GetProperty("Qlik.Engine.ISecureLocation.Security", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
var Security = SecurityConfigurator.OpenAsExistingSessionViaProxy(sessionId, useSsl, cookieHeaderName ?? "X-Qlik-Session");
SecurityProperty.SetValue(location, Security);
}
private static PropertyInfo SecurityConfiguratorProperty = null;
internal static Qlik.Sense.Communication.Communication.Security.ISecurityConfigurator SecurityConfigurator
{
get
{
if (SecurityConfiguratorProperty == null)
SecurityConfiguratorProperty = typeof(LocationExtensions).GetProperty("SecurityConfigurator", BindingFlags.Static | BindingFlags.NonPublic);
return SecurityConfiguratorProperty.GetValue(null) as Qlik.Sense.Communication.Communication.Security.SecurityConfigurator;
}
}
Hi Konrad,
How can I use this code do you have a sample, is it ok if I open a Rest Api QRS Connection with certificate (It work) then how can I recuperate the SessionId and pass it to your function?
What do we have to pur for cookieHeaderName
Thanks a lot Konrad
By the way are you working in akquinet I see that we have a meeting tomorrow to betatest Version Manager for Qlik Sense 😉
JP
Hi JP,
yes I'm Konrad from the akquinet, so we can dicuss that together with the Version Manager session.
But I think we don't have that session tomorrow. I have a session with Craig next Tue 13-14:00. Just join that session.
bye
Konrad
Cool,
In the meanwhile do you have a small sample of usage of your code
Thanks
Hi JP,
I don't understand what you need more. Make a HttpRequest with Certificate, take the response Cockie,
take the CockieKey and CockieValue and have this nice class. And than you can write
location.AsExistingSessionViaProxy(CockieKey, CockieValue) thats all.
bye Konrad
I try this and get a StackOverflow Exception here running in a loop
if (SecurityConfiguratorProperty == null)
SecurityConfiguratorProperty = typeof(LocationExtensions).GetProperty("SecurityConfigurator", BindingFlags.Static | BindingFlags.NonPublic);
return SecurityConfiguratorProperty.GetValue(null) as Qlik.Sense.Communication.Communication.Security.SecurityConfigurator;
Hi JP,
i don't know what you are doing around with that code, but this code is perfectly working in our plugin (sense-excel).
You can build a small sample app with certificate and upload it here and I can check it, or we can look at it next week (tuesday) together on your code.
bye Konrad
Hi Conrad now seem that it is working, great thanks.
It just now miss the certificate injection in the .NET session. If the certificate is in the windows certmgr it's ok but i would prefer to inject it manually as i do in Rest. Do you have an idea how to proceed in .NET?
Thanks JP
Hi JP,
I think this: http://stackoverflow.com/questions/23451024/webrequest-not-sending-client-certificate or this http://stackoverflow.com/questions/2066489/how-can-you-add-a-certificate-to-webclient-c
should solve your issue.
bye Konrad (with K)