Using AK/SK Authentication

Concept

The professional microservice engine requires AK/SK authentication. This topic describes how to configure AK/SK.

Example Configuration

AK/SK authentication depends on the AK/SK configured by users. ServiceComb provides plaintext configuration by default and allows users to customize the encryption storage scheme. The customized encryption storage requires version 2.1.3 or later.

  1. Add the following configuration in plaintext to the microservice.yaml file:
      servicecomb:  
        credentials:
          accessKey: yourak
          secretKey: yoursk
          project: yourprojectname
          akskCustomCipher: default
  2. Implement API org.apache.servicecomb.foundation.auth.Cipher, which contains two methods:
    • String name()

      Name definition of servicecomb.credentials.akskCustomCipher, which needs to be added to the configuration file.

    • char[] decode(char[] encrypted)

      Decrypt the API, which is used after secretKey is decrypted.

    The implementation class must be declared as Bean. For example:

    @Component
    public class MyCipher implements Cipher

    Add the following configuration to the microservice.yaml file:

    servicecomb:
      credentials:
        accessKey: yourak  
        secretKey: yoursk  #SK information in ciphertext.
        project: yourprojectname
        akskCustomCipher: youciphername  #returned name of the name() method in the added class.