Skip to content

Commit 36c02ea

Browse files
Martinbarnas/communication identity/2021 10 31 preview (Azure#24665)
update Communication Identity api to version 2021-10-31-preview to enable M365 Teams identities
1 parent 21e199d commit 36c02ea

File tree

56 files changed

+733
-762
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+733
-762
lines changed

sdk/communication/Azure.Communication.Identity/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Release History
22

33
## 1.1.0-beta.1 (Unreleased)
4-
- Added `ExchangeTeamsToken` to provide the ability to exchange a teams token for a communication access token
4+
- Updated version of Identity API to enable to build custom Teams endpoint using M365 Teams identities
55

66
## 1.0.1 (2021-05-25)
77
- Dependency versions updated.

sdk/communication/Azure.Communication.Identity/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,9 @@ Response revokeResponse = client.RevokeTokens(user);
114114
Response deleteResponse = client.DeleteUser(user);
115115
```
116116

117-
### Exchange access token
117+
### Exchanging AAD access token of a Teams User for a Communication Identity access token
118118

119-
```C# Snippet:ExchangeTeamsToken
119+
```C# Snippet:ExchangeTeamsTokenAsync
120120
Response<AccessToken> tokenResponse = await client.ExchangeTeamsTokenAsync(teamsToken);
121121
string token = tokenResponse.Value.Token;
122122
Console.WriteLine($"Token: {token}");

sdk/communication/Azure.Communication.Identity/api/Azure.Communication.Identity.netstandard2.0.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,12 @@ public CommunicationIdentityClient(System.Uri endpoint, Azure.Core.TokenCredenti
2222
}
2323
public partial class CommunicationIdentityClientOptions : Azure.Core.ClientOptions
2424
{
25-
public CommunicationIdentityClientOptions(Azure.Communication.Identity.CommunicationIdentityClientOptions.ServiceVersion version = Azure.Communication.Identity.CommunicationIdentityClientOptions.ServiceVersion.V2021_03_31_preview1) { }
25+
public CommunicationIdentityClientOptions(Azure.Communication.Identity.CommunicationIdentityClientOptions.ServiceVersion version = Azure.Communication.Identity.CommunicationIdentityClientOptions.ServiceVersion.V2021_10_31_preview) { }
2626
public enum ServiceVersion
2727
{
2828
V2021_03_07 = 1,
2929
V2021_03_31_preview1 = 2,
30+
V2021_10_31_preview = 3,
3031
}
3132
}
3233
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]

sdk/communication/Azure.Communication.Identity/samples/Sample1_CommunicationIdentityClient.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,16 @@ Console.WriteLine($"Token: {token}");
6363
Console.WriteLine($"Expires On: {expiresOn}");
6464
```
6565

66+
## Exchange an AAD access token of a Teams User for a Communication Identity access token
67+
68+
The `CommunicationIdentityClient` can be used to exchange an AAD access token of a Teams user for a new Communication Identity access token with a matching expiration time.
69+
70+
```C# Snippet:ExchangeTeamsToken
71+
Response<AccessToken> tokenResponse = client.ExchangeTeamsToken(teamsToken);
72+
string token = tokenResponse.Value.Token;
73+
Console.WriteLine($"Token: {token}");
74+
```
75+
6676
<!--
6777
To see the full example source files, see:
6878
* [Generate user token][GenerateUserTokenCode]

sdk/communication/Azure.Communication.Identity/samples/Sample1_CommunicationIdentityClientAsync.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,16 @@ Console.WriteLine($"Token: {token}");
6565
Console.WriteLine($"Expires On: {expiresOn}");
6666
```
6767

68+
## Exchange an AAD access token of a Teams User for a Communication Identity access token
69+
70+
The `CommunicationIdentityClient` can be used to exchange an AAD access token of a Teams user for a new Communication Identity access token with a matching expiration time.
71+
72+
```C# Snippet:ExchangeTeamsTokenAsync
73+
Response<AccessToken> tokenResponse = await client.ExchangeTeamsTokenAsync(teamsToken);
74+
string token = tokenResponse.Value.Token;
75+
Console.WriteLine($"Token: {token}");
76+
```
77+
6878
<!--
6979
To see the full example source files, see:
7080
* [Generate user token][GenerateUserTokenCode]

sdk/communication/Azure.Communication.Identity/src/CommunicationIdentityClient.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,8 @@ public virtual async Task<Response> RevokeTokensAsync(CommunicationUserIdentifie
281281
}
282282
}
283283

284-
/// <summary>Exchange a teams token for a new ACS access token.</summary>
285-
/// <param name="teamsToken">Teams token to acquire a new ACS access token.</param>
284+
/// <summary>Exchange an AAD access token of a Teams User for a Communication Identity access token.</summary>
285+
/// <param name="teamsToken">AAD access token of a Teams User to acquire a new Communication Identity access token.</param>
286286
/// <param name="cancellationToken">The cancellation token to use.</param>
287287
/// <exception cref="RequestFailedException">The server returned an error.</exception>
288288
public virtual Response<AccessToken> ExchangeTeamsToken(string teamsToken, CancellationToken cancellationToken = default)
@@ -301,8 +301,8 @@ public virtual Response<AccessToken> ExchangeTeamsToken(string teamsToken, Cance
301301
}
302302
}
303303

304-
/// <summary>Asynchronously exchange a teams token for a new ACS access token.</summary>
305-
/// <param name="teamsToken">Teams token to acquire a new ACS access token.</param>
304+
/// <summary>Asynchronously exchange an AAD access token of a Teams User for a Communication Identity access token.</summary>
305+
/// <param name="teamsToken">AAD access token of a Teams User to acquire a new Communication Identity access token.</param>
306306
/// <param name="cancellationToken">The cancellation token to use.</param>
307307
public virtual async Task<Response<AccessToken>> ExchangeTeamsTokenAsync(String teamsToken, CancellationToken cancellationToken = default)
308308
{

sdk/communication/Azure.Communication.Identity/src/CommunicationIdentityClientOptions.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class CommunicationIdentityClientOptions : ClientOptions
1414
/// <summary>
1515
/// The latest version of the identity service.
1616
/// </summary>
17-
internal const ServiceVersion LatestVersion = ServiceVersion.V2021_03_31_preview1;
17+
internal const ServiceVersion LatestVersion = ServiceVersion.V2021_10_31_preview;
1818

1919
internal string ApiVersion { get; }
2020

@@ -27,6 +27,7 @@ public CommunicationIdentityClientOptions(ServiceVersion version = LatestVersion
2727
{
2828
ServiceVersion.V2021_03_07 => "2021-03-07",
2929
ServiceVersion.V2021_03_31_preview1 => "2021-03-31-preview1",
30+
ServiceVersion.V2021_10_31_preview => "2021-10-31-preview",
3031
_ => throw new ArgumentOutOfRangeException(nameof(version)),
3132
};
3233
}
@@ -46,6 +47,10 @@ public enum ServiceVersion
4647
/// </summary>
4748
#pragma warning disable AZC0016 // Invalid ServiceVersion member name.
4849
V2021_03_31_preview1 = 2,
50+
/// <summary>
51+
/// The V2021_10_31_preview of the identity service.
52+
/// </summary>
53+
V2021_10_31_preview = 3,
4954
#pragma warning restore AZC0016 // Invalid ServiceVersion member name.
5055
#pragma warning restore CA1707 // Identifiers should not contain underscores
5156
}

sdk/communication/Azure.Communication.Identity/src/Generated/CommunicationIdentityRestClient.cs

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/communication/Azure.Communication.Identity/src/Generated/Models/TeamsUserAccessTokenRequest.cs

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/communication/Azure.Communication.Identity/src/autorest.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ Run `dotnet msbuild /t:GenerateCode` to generate code.
66
> see https://aka.ms/autorest
77
88
``` yaml
9-
tag: package-2021-03-31-preview1
9+
tag: package-preview-2021-10
1010
require:
11-
- https://raw.githubusercontent.com/Azure/azure-rest-api-specs/896d05e37dbb00712726620b8d679cc3c3be09fb/specification/communication/data-plane/Identity/readme.md
11+
- https://raw.githubusercontent.com/Azure/azure-rest-api-specs/6f40b65610a4fad7a03f3fe8c57e8c0a9c3b77d0/specification/communication/data-plane/Identity/readme.md
1212
payload-flattening-threshold: 3
1313
```

0 commit comments

Comments
 (0)