Authenticating

ChatOps uses jwt token to authenticate between chat window and Z ChatOps server. ChatOps leverages asymmetric encryption to protect information of users, you can encrypt your user information by using the public key.

Figure 1. Flow chart of the communication between chat window, integrating web app server and Z ChatOps server
Flow chart of the communication between chat window, integrating web app server and Z ChatOps server

Get access token

To get access token, complete the following steps:
  1. Create a new user for your web app by using the add user API in IBM Z® ChatOps Microservice.
  2. Log in with the user you create by using the login API in IBM Z ChatOps Microservice.

    For more information about IBM Z ChatOps Microservice, see Managing user account password of Z ChatOps Microservice.

Get user information of integrating web app

The user information of integrating web app is provides by its server in the format of JSON{"userId": "", "username": ""}. So the backend server of the integrating web app must provide an API to get the current user information.

The user information that you get by API can be used to:
  • Store your authentication information
  • Verify the login status of the integrating web app
You can get user information through the following two ways:
  • For easy use (plain text):

    You can use plain text in this format directly: {"userId": "", "username": ""}

  • For security (encrypted text):

    The integrating web app server must provide a REST API to provide the user information in the format of {userId: ’’, username: ‘‘}. You must encrypt the user information with the public key in RSA algorithm.

    To get the public key, complete the following steps:
    1. Go the directory that you create in Step 5.
    2. Run the following command:
      ./generate.sh
      You can get the public_key.pem and private_key.pem files.
      Note: If the private_key.pem exists, Z ChatOps will decrypt the user information by the private key, so the first way (plain text) will not work.
    3. Copy the public key to the integrating web app backend project, and use the key to encrypt the user information.