If your current working directory is testcafe-examples, execute the following command:
npm run kerberos-auth
If your current working directory is testcafe-examples/detached-examples/kerberos-auth, execute the following command:
npm start
The example demonstrates how to implement Kerberos user authentication in a TestCafe test. It utilizes two Docker containers:
- The testcafe/testcafe-examples_kerberos-server container hosts the application server. It is based on the Ubuntu image and includes the following packages:
- A Kerberos token generator (
krb5-kdc). - A Kerberos database server that stores user credentials (
krb5-admin-server). - A set of common CLI tools (
curl,nvm,nodejs,npm).
- A Kerberos token generator (
The Kerberos server comes pre-configured. The database contains a single principal:
principal: testcafe-user
password: testcafe-pass
- The testcafe/testcafe-examples_kerberos-client container hosts the Kerberos client. It is based on the Ubuntu image and includes the following packages:
- A utility that retrieves the Kerberos token from the token generator (
krb5-user) - A set of common CLI tools (
curl,nvm,nodejs,npm).
- A utility that retrieves the Kerberos token from the token generator (
This is what happens when you run the npm start command:
- The script launches the
servercontainer and populates it with files from theserverfolder. - The script launches the
clientcontainer and populates it with files from theserverfolder. - The
servercontainer launches a simple Express.js application, as well as a server that validates Kerberos tokens. - The
clientcontainer launches an application that obtains Kerberos tokens from the server on behalf of TestCafe. - The script creates a new TestCafe instance and launches the
test.jstest.