Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Commit

Permalink
Revert "Update for MSAL 2."
Browse files Browse the repository at this point in the history
  • Loading branch information
parakhj authored Aug 29, 2018
1 parent 03e2f42 commit 50a9207
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
5 changes: 1 addition & 4 deletions WebApp-OpenIDConnect-DotNet/Controllers/HomeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,9 @@ public async Task<IActionResult> Api()
var scope = AzureAdB2COptions.ApiScopes.Split(' ');
string signedInUserID = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value;
TokenCache userTokenCache = new MSALSessionCache(signedInUserID, this.HttpContext).GetMsalCacheInstance();

ConfidentialClientApplication cca = new ConfidentialClientApplication(AzureAdB2COptions.ClientId, AzureAdB2COptions.Authority, AzureAdB2COptions.RedirectUri, new ClientCredential(AzureAdB2COptions.ClientSecret), userTokenCache, null);


var accounts = await cca.GetAccountsAsync();
AuthenticationResult result = await cca.AcquireTokenSilentAsync(scope, accounts.FirstOrDefault(), AzureAdB2COptions.Authority, false);
AuthenticationResult result = await cca.AcquireTokenSilentAsync(scope, cca.Users.FirstOrDefault(), AzureAdB2COptions.Authority, false);

HttpClient client = new HttpClient();
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, AzureAdB2COptions.ApiUrl);
Expand Down
6 changes: 1 addition & 5 deletions WebApp-OpenIDConnect-DotNet/Models/MSALSessionCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,7 @@ public string ReadUserStateValue()
public void Load()
{
SessionLock.EnterReadLock();
byte[] blob = httpContext.Session.Get(CacheId);
if (blob !=null)
{
cache.Deserialize(blob);
}
cache.Deserialize(httpContext.Session.Get(CacheId));
SessionLock.ExitReadLock();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFramework>netcoreapp2.0</TargetFramework>
<RootNamespace>WebApp_OpenIDConnect_DotNet</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Identity.Client" Version="2.0.0-preview" />
<PackageReference Include="Microsoft.Identity.Client" Version="1.1.0-preview" />
<PackageReference Include="Microsoft.AspNetCore" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="2.0.0" />
Expand Down

0 comments on commit 50a9207

Please sign in to comment.