static String getBasicAuthCredentialsSDK()

in aws-amplify-app/src/main/java/software/amazon/amplify/app/Translator.java [304:315]


  static String getBasicAuthCredentialsSDK(BasicAuthConfig basicAuthConfig) {
    if (basicAuthConfig.getEnableBasicAuth() == null || basicAuthConfig.getEnableBasicAuth() == false) {
      return null;
    }
    if (StringUtils.isEmpty(basicAuthConfig.getUsername()) ||
        StringUtils.isEmpty(basicAuthConfig.getPassword())) {
      final String INVALID_PASSWORD = "Username or Password cannot be empty";
      throw new CfnInvalidRequestException(INVALID_PASSWORD);
    }
    final String userInfo = String.format("%s:%s", basicAuthConfig.getUsername(), basicAuthConfig.getPassword());
    return Base64.getEncoder().encodeToString(userInfo.getBytes(StandardCharsets.UTF_8));
  }