你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

KeyCredential Class

  • java.lang.Object
    • com.azure.core.credential.KeyCredential

public class KeyCredential

Represents a credential that uses a key to authenticate.

Constructor Summary

Constructor Description
KeyCredential(String key)

Creates a credential that authorizes request with the given key.

Method Summary

Modifier and Type Method and Description
String getKey()

Retrieves the key associated to this credential.

KeyCredential update(String key)

Rotates the key associated to this credential.

Methods inherited from java.lang.Object

Constructor Details

KeyCredential

public KeyCredential(String key)

Creates a credential that authorizes request with the given key.

Parameters:

key - The key used to authorize requests.

Method Details

getKey

public String getKey()

Retrieves the key associated to this credential.

Returns:

The key being used to authorize requests.

update

public KeyCredential update(String key)

Rotates the key associated to this credential.

Parameters:

key - The new key to associated with this credential.

Returns:

The updated KeyCredential object.

Applies to