com.aliyun.oss.common.utils

## 类 AuthUtils

- java.lang.Object
- - com.aliyun.oss.common.utils.AuthUtils

-     public class AuthUtils
      extends Object

- - ### 字段概要

    字段
    限定符和类型 | 字段和说明
    --- | ---
    `static String` | `ACCESS_KEY_ENV_VAR` Environment variable name for the oss access key ID
    `static String` | `ACCESS_KEY_SYSTEM_PROPERTY` System property name for the OSS access key ID
    `static int` | `DEFAULT_ECS_SESSION_TOKEN_DURATION_SECONDS` AK/SK expiration time obtained from ECS Metadata Service, default 6 hours
    `static int` | `DEFAULT_EXPIRED_DURATION_SECONDS` Default expiration time
    `static double` | `DEFAULT_EXPIRED_FACTOR` Default expiration time adjustment factor
    `static int` | `DEFAULT_HTTP_SOCKET_TIMEOUT_IN_MILLISECONDS` Connection timeout when getting AK/SK, the default 5 seconds
    `static String` | `DEFAULT_PROFILE_PATH` Credential profile file at the default location
    `static String` | `DEFAULT_SECTION_NAME` Default section name in the profile file
    `static int` | `DEFAULT_STS_SESSION_TOKEN_DURATION_SECONDS` AK/SK expire time obtained from STS, default 1 hour
    `static int` | `MAX_ECS_METADATA_FETCH_RETRY_TIMES` The maximum number of retries when getting AK/SK from ECS
    `static String` | `OSS_ACCESS_KEY_ID` Property name for specifying the OSS Access Key
    `static String` | `OSS_SECRET_ACCESS_KEY` Property name for specifying the OSS Secret Access Key
    `static String` | `OSS_SESSION_TOKEN` Property name for specifying the OSS Session Token
    `static String` | `SECRET_KEY_ENV_VAR` Environment variable name for the oss secret key
    `static String` | `SECRET_KEY_SYSTEM_PROPERTY` System property name for the OSS secret key
    `static String` | `SESSION_TOKEN_ENV_VAR` Environment variable name for the oss session token
    `static String` | `SESSION_TOKEN_SYSTEM_PROPERTY` System property name for the OSS session token

  - ### 构造器概要

    构造器
    构造器和说明
    `AuthUtils()`

  - ### 方法概要

    方法
    限定符和类型 | 方法和说明
    --- | ---
    `static String` | `defaultProfilePath()` Get the default profile path.
    `static void` | `deletePublicKey(String regionId, String accessKeyId, String accessKeySecret, String publicKeyId)` Delete the uploaded public key.
    `static List<PublicKey>` | `listPublicKeys(String regionId, String accessKeyId, String accessKeySecret)` List the public keys that has been uploaded.
    `static String` | `loadPrivateKeyFromFile(String privateKeyPath)` Load private key content from file and format.
    `static String` | `loadPublicKeyFromFile(String publicKeyPath)` Load public key content from file and format.
    `static PublicKey` | `uploadPublicKey(String regionId, String accessKeyId, String accessKeySecret, String publicKey)` Upload the public key of RSA key pair.

    - ### 从类继承的方法 java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 字段详细资料

    - #### DEFAULT_EXPIRED_DURATION_SECONDS

          public static final int DEFAULT_EXPIRED_DURATION_SECONDS

      Default expiration time
      另请参阅:
        常量字段值

    - #### DEFAULT_EXPIRED_FACTOR

          public static final double DEFAULT_EXPIRED_FACTOR

      Default expiration time adjustment factor
      另请参阅:
        常量字段值

    - #### MAX_ECS_METADATA_FETCH_RETRY_TIMES

          public static final int MAX_ECS_METADATA_FETCH_RETRY_TIMES

      The maximum number of retries when getting AK/SK from ECS
      另请参阅:
        常量字段值

    - #### DEFAULT_ECS_SESSION_TOKEN_DURATION_SECONDS

          public static final int DEFAULT_ECS_SESSION_TOKEN_DURATION_SECONDS

      AK/SK expiration time obtained from ECS Metadata Service, default 6 hours
      另请参阅:
        常量字段值

    - #### DEFAULT_STS_SESSION_TOKEN_DURATION_SECONDS

          public static final int DEFAULT_STS_SESSION_TOKEN_DURATION_SECONDS

      AK/SK expire time obtained from STS, default 1 hour
      另请参阅:
        常量字段值

    - #### DEFAULT_HTTP_SOCKET_TIMEOUT_IN_MILLISECONDS

          public static final int DEFAULT_HTTP_SOCKET_TIMEOUT_IN_MILLISECONDS

      Connection timeout when getting AK/SK, the default 5 seconds
      另请参阅:
        常量字段值

    - #### ACCESS_KEY_ENV_VAR

          public static final String ACCESS_KEY_ENV_VAR

      Environment variable name for the oss access key ID
      另请参阅:
        常量字段值

    - #### SECRET_KEY_ENV_VAR

          public static final String SECRET_KEY_ENV_VAR

      Environment variable name for the oss secret key
      另请参阅:
        常量字段值

    - #### SESSION_TOKEN_ENV_VAR

          public static final String SESSION_TOKEN_ENV_VAR

      Environment variable name for the oss session token
      另请参阅:
        常量字段值

    - #### ACCESS_KEY_SYSTEM_PROPERTY

          public static final String ACCESS_KEY_SYSTEM_PROPERTY

      System property name for the OSS access key ID
      另请参阅:
        常量字段值

    - #### SECRET_KEY_SYSTEM_PROPERTY

          public static final String SECRET_KEY_SYSTEM_PROPERTY

      System property name for the OSS secret key
      另请参阅:
        常量字段值

    - #### SESSION_TOKEN_SYSTEM_PROPERTY

          public static final String SESSION_TOKEN_SYSTEM_PROPERTY

      System property name for the OSS session token
      另请参阅:
        常量字段值

    - #### DEFAULT_PROFILE_PATH

          public static final String DEFAULT_PROFILE_PATH

      Credential profile file at the default location

    - #### DEFAULT_SECTION_NAME

          public static final String DEFAULT_SECTION_NAME

      Default section name in the profile file
      另请参阅:
        常量字段值

    - #### OSS_ACCESS_KEY_ID

          public static final String OSS_ACCESS_KEY_ID

      Property name for specifying the OSS Access Key
      另请参阅:
        常量字段值

    - #### OSS_SECRET_ACCESS_KEY

          public static final String OSS_SECRET_ACCESS_KEY

      Property name for specifying the OSS Secret Access Key
      另请参阅:
        常量字段值

    - #### OSS_SESSION_TOKEN

          public static final String OSS_SESSION_TOKEN

      Property name for specifying the OSS Session Token
      另请参阅:
        常量字段值

  - ### 构造器详细资料

    - #### AuthUtils

          public AuthUtils()

  - ### 方法详细资料

    - #### defaultProfilePath

          public static String defaultProfilePath()

      Get the default profile path.
      返回:
        Default profile path

    - #### uploadPublicKey

          public static PublicKey uploadPublicKey(String regionId,
                                  String accessKeyId,
                                  String accessKeySecret,
                                  String publicKey)
                                           throws com.aliyuncs.exceptions.ClientException

      Upload the public key of RSA key pair.
      参数:
        `regionId` - RAM's available area.
        `accessKeyId` - Access Key ID of the root user.
        `accessKeySecret` - Secret Access Key of the root user.
        `publicKey` - Public key content.
      返回:
        Public key description, include public key id etc.
      抛出:
        `com.aliyuncs.exceptions.ClientException`

    - #### listPublicKeys

          public static List<PublicKey> listPublicKeys(String regionId,
                                       String accessKeyId,
                                       String accessKeySecret)
                                                throws com.aliyuncs.exceptions.ClientException

      List the public keys that has been uploaded.
      参数:
        `regionId` - RAM's available area.
        `accessKeyId` - Access Key ID of the root user.
        `accessKeySecret` - Secret Access Key of the root user.
      返回:
        Public keys.
      抛出:
        `com.aliyuncs.exceptions.ClientException`

    - #### deletePublicKey

          public static void deletePublicKey(String regionId,
                             String accessKeyId,
                             String accessKeySecret,
                             String publicKeyId)
                                      throws com.aliyuncs.exceptions.ClientException

      Delete the uploaded public key.
      参数:
        `regionId` - RAM's available area.
        `accessKeyId` - Access Key ID of the root user.
        `accessKeySecret` - Secret Access Key of the root user.
        `publicKeyId` - Public Key Id.
      抛出:
        `com.aliyuncs.exceptions.ClientException`

    - #### loadPublicKeyFromFile

          public static String loadPublicKeyFromFile(String publicKeyPath)
                                              throws IOException

      Load public key content from file and format.
      参数:
        `publicKeyPath` - Public key file path.
      返回:
        Formatted public key content.
      抛出:
        `IOException`

    - #### loadPrivateKeyFromFile

          public static String loadPrivateKeyFromFile(String privateKeyPath)
                                               throws IOException

      Load private key content from file and format.
      参数:
        `privateKeyPath` - Private key file path.
      返回:
        Formatted private key content.
      抛出:
        `IOException`

Copyright © 2020. All Rights Reserved.