Skip to content

Commit accb829

Browse files
authored
Add KeyCredentialTrait (Azure#36540)
1 parent 71de438 commit accb829

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

sdk/core/azure-core/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## 1.43.0-beta.1 (Unreleased)
44

55
### Features Added
6+
- Added `KeyCredentialTrait` interface. Client builders that implement this interface will support key-based authentication.
67

78
### Breaking Changes
89

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
package com.azure.core.client.traits;
5+
6+
import com.azure.core.credential.KeyCredential;
7+
8+
/**
9+
* An {@link com.azure.core.client.traits Azure SDK for Java trait} providing a consistent interface for setting
10+
* {@link KeyCredential}. Refer to the Azure SDK for Java
11+
* <a href="https://aka.ms/azsdk/java/docs/identity">identity and authentication</a>
12+
* documentation for more details on proper usage of the {@link KeyCredential} type.
13+
*
14+
* @param <T> The concrete type that implements the trait. This is required so that fluent operations can continue
15+
* to return the concrete type, rather than the trait type.
16+
* @see com.azure.core.client.traits
17+
* @see KeyCredential
18+
*/
19+
public interface KeyCredentialTrait<T> {
20+
/**
21+
* Sets the {@link KeyCredential} used for authentication. Refer to the Azure SDK for Java
22+
* <a href="https://aka.ms/azsdk/java/docs/identity">identity and authentication</a>
23+
* documentation for more details on proper usage of the {@link KeyCredential} type.
24+
*
25+
* @param credential the {@link KeyCredential} to be used for authentication.
26+
* @return Returns the same concrete type with the appropriate properties updated, to allow for fluent chaining of
27+
* operations.
28+
*/
29+
T credential(KeyCredential credential);
30+
}

0 commit comments

Comments
 (0)