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.
|
public static final int DEFAULT_EXPIRED_DURATION_SECONDS
public static final double DEFAULT_EXPIRED_FACTOR
public static final int MAX_ECS_METADATA_FETCH_RETRY_TIMES
public static final int DEFAULT_ECS_SESSION_TOKEN_DURATION_SECONDS
public static final int DEFAULT_STS_SESSION_TOKEN_DURATION_SECONDS
public static final int DEFAULT_HTTP_SOCKET_TIMEOUT_IN_MILLISECONDS
public static final String ACCESS_KEY_ENV_VAR
public static final String SECRET_KEY_ENV_VAR
public static final String SESSION_TOKEN_ENV_VAR
public static final String ACCESS_KEY_SYSTEM_PROPERTY
public static final String SECRET_KEY_SYSTEM_PROPERTY
public static final String SESSION_TOKEN_SYSTEM_PROPERTY
public static final String DEFAULT_PROFILE_PATH
public static final String DEFAULT_SECTION_NAME
public static final String OSS_ACCESS_KEY_ID
public static final String OSS_SECRET_ACCESS_KEY
public static String defaultProfilePath()
public static PublicKey uploadPublicKey(String regionId, String accessKeyId, String accessKeySecret, String publicKey) throws com.aliyuncs.exceptions.ClientException
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.com.aliyuncs.exceptions.ClientException
public static List<PublicKey> listPublicKeys(String regionId, String accessKeyId, String accessKeySecret) throws com.aliyuncs.exceptions.ClientException
regionId
- RAM's available area.accessKeyId
- Access Key ID of the root user.accessKeySecret
- Secret Access Key of the root user.com.aliyuncs.exceptions.ClientException
public static void deletePublicKey(String regionId, String accessKeyId, String accessKeySecret, String publicKeyId) throws com.aliyuncs.exceptions.ClientException
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
public static String loadPublicKeyFromFile(String publicKeyPath) throws IOException
publicKeyPath
- Public key file path.IOException
public static String loadPrivateKeyFromFile(String privateKeyPath) throws IOException
privateKeyPath
- Private key file path.IOException
Copyright © 2019. All Rights Reserved.