-
Notifications
You must be signed in to change notification settings - Fork 327
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial implementation of CIAM support (#4054)
* Initial prototype for Ciam integration * Ciam updates * Update * Changing login to tenant in Ciam tranformation * Updates * Adding exception for CIAM authority in request. Adding additional tests Refactoring * Update Comments * typo * Update * Refactoring * Updating dev app * Adding additional tests Refactoring. --------- Co-authored-by: trwalke <trwalke@microsoft.com>
- Loading branch information
Showing
16 changed files
with
1,309 additions
and
883 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,8 @@ internal enum AuthorityType | |
|
||
Dsts, | ||
|
||
Generic | ||
Generic, | ||
|
||
Ciam | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
src/client/Microsoft.Identity.Client/Instance/CiamAuthority.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Microsoft.Identity.Client.Internal; | ||
|
||
namespace Microsoft.Identity.Client.Instance | ||
{ | ||
internal class CiamAuthority : AadAuthority | ||
{ | ||
internal CiamAuthority(AuthorityInfo authorityInfo) : | ||
base(authorityInfo) | ||
{ } | ||
|
||
/// <summary> | ||
/// Translates CIAM authorities into a usable form. This is needed only until ESTS is updated to support the north star format | ||
/// North star format: https://idgciamdemo.ciamlogin.com | ||
/// Transformed format: https://idgciamdemo.ciamlogin.com/idgciamdemo.onmicrosoft.com | ||
/// </summary> | ||
internal static Uri TransformAuthority(Uri ciamAuthority) | ||
{ | ||
string transformedInstance; | ||
string transformedTenant; | ||
|
||
string host = ciamAuthority.Host + ciamAuthority.AbsolutePath; | ||
if (string.Equals(ciamAuthority.AbsolutePath, "/")) | ||
{ | ||
string ciamTenant = host.Substring(0, host.IndexOf(Constants.CiamAuthorityHostSuffix, StringComparison.OrdinalIgnoreCase)); | ||
transformedInstance = $"https://{ciamTenant}{Constants.CiamAuthorityHostSuffix}/"; | ||
transformedTenant = ciamTenant + ".onmicrosoft.com"; | ||
return new Uri(transformedInstance + transformedTenant); | ||
} | ||
else | ||
{ | ||
return ciamAuthority; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.