Skip to content

Repository files navigation

OAuth2 Authentication with Keycloak and Docker Compose

Review FTOptix Tested

This project serves as an example to demonstrate OAuth2 authentication capabilities. It includes a Docker Compose setup that leverages Keycloak with a configured realm and client for OAuth2 with PKCE (Proof Key for Code Exchange).

This project aims to showcase the integration of advanced authentication mechanisms within industrial automation environments.

Setup Instructions

Note

An active internet connection is required for Docker to download the Keycloak image

  1. Install CA Certificate:

    • Navigate to the ProjectFiles/docker/certs directory.
    • Locate the CA certificate file (root_ca.crt).
    • Install the CA certificate on your operating system:
      • Windows:

        • Open the certificate file.

        • Click "Install Certificate" and follow the prompts.

          Place the certificate in the Trusted Root Certification Authorities folder.

          • Alternatively, from PowerShell as Administrator:

            Import-Certificate -FilePath .\root_ca.crt `
            -CertStoreLocation Cert:\LocalMachine\Root
      • Ubuntu:

        • Copy the certificate file to /usr/local/share/ca-certificates/:

          sudo cp root_ca.crt /usr/local/share/ca-certificates/
        • Update the CA certificates:

          sudo update-ca-certificates
  2. Run Docker Compose:

Note

You can copy the entire folder to an external machine (or VM) that runs a Docker engine.

  • Open a terminal and navigate to the ProjectFiles/docker directory.

  • Execute the following command to start the Docker containers:

    docker-compose up
  1. Set the hosts file on Windows:
    • Open Notepad as administrator, then open the file:

      C:\Windows\System32\drivers\etc\hosts
      
    • Add the following line at the end:

      127.0.0.1   keycloak.ftoptixdemo.oauth2
      

Important

If Docker is running on another machine, use the IP address of that machine instead.

  1. Start the FactoryTalk Optix Project:
    • Open FactoryTalk Optix.
    • Open the project.
    • Start the project in emulation mode to test the OAuth2 authentication.

About

How to interfact FactoryTalk Optix with a Keycloack server

Resources

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages