qlik-oss / qlik-api-ts

Typescript types and Javascript library for consuming Qlik API's
https://qlik.dev
ISC License
8 stars 3 forks source link

Adds pfx support for custom authenticator #62

Open HaTiIn opened 1 month ago

HaTiIn commented 1 month ago

With the help of a custom authenticator it is now possible to use certificate based authentication

qlikossbuild commented 1 month ago

Hi, and thanks for contributing!

Note: If you are part of Qlik: follow the process outlined on the internal developer portal instead. Reach out to open-source@qlik.com if you do not have access to that developer portal.


Before we can handle your pull request we need you to sign our contributor license agreement. This is a one-time process and enables you to contribute without hassle to any of the qlik-oss repositories in the future.

And it only takes a few minutes! Here are some useful links to get you started:

Having troubles? Feel free to reach out to us either here or on Slack!

Note: Once the CLA is sorted, you should rebase/touch this pull request to trigger an update of this CLA status.

HaTiIn commented 1 month ago

I won't sign the CLA or anything else... but you can use my code changes for this feature.

nilzona commented 3 weeks ago

Can you share en example of how a host-config would look like that would enable this feature?

HaTiIn commented 3 weeks ago

Sure:

const appSession = openAppSession({
            appId: this.appId,
            hostConfig: {
                authType: "QlikApiTsSaEngineAuthModule",
                host,
                passphrase,
                pfx,
            },
        });

QlikApiTsSaEngineAuthModule:

...
type QlikApiTsSaEngineAuthModuleConfig = {
    pfx: Buffer;
    passphrase: string;
    host: string;
};
 async getRestCallAuthParams(
                props: GetRestCallAuthParamsProps<"QlikApiTsSaEngineAuthModule">,
            ): Promise<RestCallAuthParams> {
                return {
                    headers: {
                        "X-Qlik-User": "UserDirectory=INTERNAL; UserId=sa_engine",
                    },
                    queryParams: {},
                    credentials: "omit",
                };
            },
...