## 接口 com.aliyun.oss.common.auth.CredentialsProvider
的使用

- 使用CredentialsProvider的程序包
  程序包 | 说明
  --- | ---
  com.aliyun.oss |
  com.aliyun.oss.common.auth |
  com.aliyun.oss.crypto |

- - ### com.aliyun.oss中CredentialsProvider的使用

    返回CredentialsProvider的com.aliyun.oss中的方法
    限定符和类型 | 方法和说明
    --- | ---
    `CredentialsProvider` | OSSClient.`getCredentialsProvider()`

    参数类型为CredentialsProvider的com.aliyun.oss中的方法
    限定符和类型 | 方法和说明
    --- | ---
    `OSS` | OSSClientBuilder.`build(String endpoint, CredentialsProvider credsProvider)`
    `OSS` | OSSBuilder.`build(String endpoint, CredentialsProvider credsProvider)` Uses the specified `CredentialsProvider` and OSS Endpoint to create a new `OSSClient` instance.
    `OSS` | OSSClientBuilder.`build(String endpoint, CredentialsProvider credsProvider, ClientBuilderConfiguration config)`
    `OSS` | OSSBuilder.`build(String endpoint, CredentialsProvider credsProvider, ClientBuilderConfiguration config)` Uses the specified `CredentialsProvider`, client configuration and OSS endpoint to create a new `OSSClient` instance.
    `OSSEncryptionClient` | OSSEncryptionClientBuilder.`build(String endpoint, CredentialsProvider credsProvider, EncryptionMaterials encryptionMaterials)` Constructs a instance of `OSSEncryptionClient` using the current builder configuration.
    `OSSEncryptionClient` | OSSEncryptionClientBuilder.`build(String endpoint, CredentialsProvider credsProvider, EncryptionMaterials encryptionMaterials, ClientBuilderConfiguration clientConfig)` Constructs a instance of `OSSEncryptionClient` using the current builder configuration.
    `OSSEncryptionClient` | OSSEncryptionClientBuilder.`build(String endpoint, CredentialsProvider credsProvider, EncryptionMaterials encryptionMaterials, ClientBuilderConfiguration clientConfig, CryptoConfiguration cryptoConfig)` Construct a synchronous implementation of OSSEncryptionClient using the current builder configuration.
    `OSSEncryptionClient` | OSSEncryptionClientBuilder.`build(String endpoint, CredentialsProvider credsProvider, EncryptionMaterials encryptionMaterials, CryptoConfiguration cryptoConfig)` Construct a synchronous implementation of OSSEncryptionClient using the current builder configuration.

    参数类型为CredentialsProvider的com.aliyun.oss中的构造器
    构造器和说明
    `OSSClient(String endpoint, CredentialsProvider credsProvider)` 已过时。
    `OSSClient(String endpoint, CredentialsProvider credsProvider, ClientConfiguration config)` Uses the specified `CredentialsProvider`, client configuration and OSS endpoint to create a new `OSSClient` instance.
    `OSSEncryptionClient(String endpoint, CredentialsProvider credsProvider, ClientConfiguration clientConfig, EncryptionMaterials encryptionMaterials, CryptoConfiguration cryptoConfig)`

  - ### com.aliyun.oss.common.auth中CredentialsProvider的使用

    实现CredentialsProvider的com.aliyun.oss.common.auth中的类
    限定符和类型 | 类和说明
    --- | ---
    `class` | `CustomSessionCredentialsProvider`
    `class` | `DefaultCredentialProvider` Default implementation of `CredentialsProvider`.
    `class` | `EnvironmentVariableCredentialsProvider` `EnvironmentVariableCredentialsProvider` implementation that provides credentials by looking at the: `OSS_ACCESS_KEY_ID` and `OSS_ACCESS_KEY_SECRET` environment variables.
    `class` | `InstanceProfileCredentialsProvider` Credentials provider implementation that loads credentials from the Ali Cloud ECS Instance Metadata Service.
    `class` | `ProfileCredentialsProvider` Credentials provider based on OSS configuration profiles.
    `class` | `STSAssumeRoleSessionCredentialsProvider` STSAssumeRoleSessionCredentialsProvider implementation that uses the STS Security Token Service to assume a Role and create temporary, short-lived sessions to use for authentication.
    `class` | `STSKeyPairSessionCredentialsProvider` STSKeyPairSessionCredentialsProvider implementation that uses the RSA key pair to create temporary, short-lived sessions to use for authentication.
    `class` | `SystemPropertiesCredentialsProvider` `SystemPropertiesCredentialsProvider` implementation that provides credentials by looking at the `oss.accessKeyId` and `oss.accessKeySecret` Java system properties.

  - ### com.aliyun.oss.crypto中CredentialsProvider的使用

    参数类型为CredentialsProvider的com.aliyun.oss.crypto中的方法
    限定符和类型 | 方法和说明
    --- | ---
    `void` | KmsEncryptionMaterials.`addKmsDescMaterial(String region, CredentialsProvider credentialsProvider, Map<String,String> description)` Add other kms region credentialsProvider and descrption materials used for decryption.
    `void` | KmsEncryptionMaterials.`setKmsCredentialsProvider(CredentialsProvider credentialsProvider)` Sets the credentials provider.

Copyright © 2020. All Rights Reserved.