Revert files that shouldn't change back in v11

This commit is contained in:
Sebastiaan Janssen
2022-09-19 16:37:24 +02:00
parent 85147fb5e8
commit db5d05d641
201 changed files with 933 additions and 1859 deletions

View File

@@ -62,10 +62,10 @@ public class BackOfficeAuthenticationBuilder : AuthenticationBuilder
internal class EnsureBackOfficeScheme<TOptions> : IPostConfigureOptions<TOptions>
where TOptions : RemoteAuthenticationOptions
{
public void PostConfigure(string name, TOptions options)
public void PostConfigure(string? name, TOptions options)
{
// ensure logic only applies to backoffice authentication schemes
if (name.StartsWith(Constants.Security.BackOfficeExternalAuthenticationTypePrefix))
if (name is not null && name.StartsWith(Constants.Security.BackOfficeExternalAuthenticationTypePrefix))
{
options.SignInScheme = Constants.Security.BackOfficeExternalAuthenticationType;
}

View File

@@ -126,7 +126,12 @@ public class BackOfficeSessionIdValidator
}
var userId = currentIdentity.GetUserId();
BackOfficeIdentityUser? user = await _userManager.FindByIdAsync(userId);
if (userId is null)
{
return false;
}
var user = await _userManager.FindByIdAsync(userId);
if (user == null)
{
return false;

View File

@@ -117,7 +117,7 @@ public class BackOfficeSignInManager : UmbracoSignInManager<BackOfficeIdentityUs
/// <param name="redirectUrl">The external login URL users should be redirected to during the login flow.</param>
/// <param name="userId">The current user's identifier, which will be used to provide CSRF protection.</param>
/// <returns>A configured <see cref="AuthenticationProperties" />.</returns>
public override AuthenticationProperties ConfigureExternalAuthenticationProperties(string provider, string? redirectUrl, string? userId = null)
public override AuthenticationProperties ConfigureExternalAuthenticationProperties(string? provider, string? redirectUrl, string? userId = null)
{
// borrowed from https://github.com/dotnet/aspnetcore/blob/master/src/Identity/Core/src/SignInManager.cs
// to be able to use our own XsrfKey/LoginProviderKey because the default is private :/
@@ -197,7 +197,7 @@ public class BackOfficeSignInManager : UmbracoSignInManager<BackOfficeIdentityUs
}
//Now we need to perform the auto-link, so first we need to lookup/create a user with the email address
BackOfficeIdentityUser? autoLinkUser = await UserManager.FindByEmailAsync(email);
BackOfficeIdentityUser? autoLinkUser = await UserManager.FindByEmailAsync(email!);
if (autoLinkUser != null)
{
try
@@ -228,7 +228,7 @@ public class BackOfficeSignInManager : UmbracoSignInManager<BackOfficeIdentityUs
throw new InvalidOperationException("The Name value cannot be null");
}
autoLinkUser = BackOfficeIdentityUser.CreateNew(_globalSettings, email, email, autoLinkOptions.GetUserAutoLinkCulture(_globalSettings), name);
autoLinkUser = BackOfficeIdentityUser.CreateNew(_globalSettings, email, email!, autoLinkOptions.GetUserAutoLinkCulture(_globalSettings), name);
foreach (var userGroup in autoLinkOptions.DefaultUserGroups)
{

View File

@@ -80,7 +80,7 @@ public class ConfigureBackOfficeCookieOptions : IConfigureNamedOptions<CookieAut
}
/// <inheritdoc />
public void Configure(string name, CookieAuthenticationOptions options)
public void Configure(string? name, CookieAuthenticationOptions options)
{
if (name != Constants.Security.BackOfficeAuthenticationType)
{

View File

@@ -52,7 +52,7 @@ internal class PasswordChanger<TUser> : IPasswordChanger<TUser> where TUser : Um
}
var userId = changingPasswordModel.Id.ToString();
TUser identityUser = await userMgr.FindByIdAsync(userId);
TUser? identityUser = await userMgr.FindByIdAsync(userId);
if (identityUser == null)
{
// this really shouldn't ever happen... but just in case
@@ -96,7 +96,7 @@ internal class PasswordChanger<TUser> : IPasswordChanger<TUser> where TUser : Um
}
// can we change to the new password?
IdentityResult changeResult = await userMgr.ChangePasswordAsync(identityUser, changingPasswordModel.OldPassword, changingPasswordModel.NewPassword);
IdentityResult changeResult = await userMgr.ChangePasswordAsync(identityUser, changingPasswordModel.OldPassword!, changingPasswordModel.NewPassword);
if (changeResult.Succeeded == false)
{
// no, fail with error messages for "password"