1
0
mirror of https://github.com/bitwarden/server synced 2025-12-16 08:13:33 +00:00

upgrade identity server 4 to v4 (#842)

* upgrade identity server 4 to v4

* remove script ref
This commit is contained in:
Kyle Spearrin
2020-07-30 17:00:13 -04:00
committed by GitHub
parent 22eb8316f2
commit 623cd36bd4
20 changed files with 432 additions and 107 deletions

View File

@@ -7,6 +7,7 @@ using Bit.Core.Models.Table;
using Bit.Core.Repositories;
using Bit.Identity.Models;
using IdentityModel;
using IdentityServer4;
using IdentityServer4.Services;
using IdentityServer4.Stores;
using Microsoft.AspNetCore.Authentication;
@@ -132,8 +133,12 @@ namespace Bit.Identity.Controllers
ProcessLoginCallbackForOidc(result, additionalLocalClaims, localSignInProps);
// issue authentication cookie for user
await HttpContext.SignInAsync(user.Id.ToString(), user.Email, provider,
localSignInProps, additionalLocalClaims.ToArray());
await HttpContext.SignInAsync(new IdentityServerUser(user.Id.ToString())
{
DisplayName = user.Email,
IdentityProvider = provider,
AdditionalClaims = additionalLocalClaims.ToArray()
}, localSignInProps);
// delete temporary cookie used during external authentication
await HttpContext.SignOutAsync(IdentityServer4.IdentityServerConstants.ExternalCookieAuthenticationScheme);
@@ -144,7 +149,7 @@ namespace Bit.Identity.Controllers
var context = await _interaction.GetAuthorizationContextAsync(returnUrl);
if (context != null)
{
if (await IsPkceClientAsync(context.ClientId))
if (await IsPkceClientAsync(context.Client.ClientId))
{
// if the client is PKCE then we assume it's native, so this change in how to
// return the response is for better UX for the end user.