More work on nullable reference types

This commit is contained in:
Nikolaj Geisle
2022-03-31 14:35:23 +02:00
parent 2460c82e02
commit 4571ecb0e3
88 changed files with 388 additions and 340 deletions

View File

@@ -16,7 +16,7 @@ namespace Umbraco.Extensions
Type controllerType,
string rootSegment,
string areaName,
string prefixPathSegment,
string? prefixPathSegment,
string defaultAction = "Index",
bool includeControllerNameInRoute = true,
object? constraints = null)
@@ -72,7 +72,7 @@ namespace Umbraco.Extensions
this IEndpointRouteBuilder endpoints,
string rootSegment,
string areaName,
string prefixPathSegment,
string? prefixPathSegment,
string defaultAction = "Index",
bool includeControllerNameInRoute = true,
object? constraints = null)
@@ -98,14 +98,14 @@ namespace Umbraco.Extensions
/// </summary>
public static void MapUmbracoApiRoute(
this IEndpointRouteBuilder endpoints,
Type controllerType,
Type? controllerType,
string rootSegment,
string areaName,
string? areaName,
bool isBackOffice,
string defaultAction = "Index",
object? constraints = null)
{
string prefixPathSegment = isBackOffice
string? prefixPathSegment = isBackOffice
? areaName.IsNullOrWhiteSpace()
? $"{Cms.Core.Constants.Web.Mvc.BackOfficePathSegment}/Api"
: $"{Cms.Core.Constants.Web.Mvc.BackOfficePathSegment}/{areaName}"

View File

@@ -79,7 +79,7 @@ namespace Umbraco.Extensions
}
public static void SetReasonPhrase(this HttpContext httpContext, string reasonPhrase)
public static void SetReasonPhrase(this HttpContext httpContext, string? reasonPhrase)
{
//TODO we should update this behavior, as HTTP2 do not have ReasonPhrase. Could as well be returned in body
// https://github.com/aspnet/HttpAbstractions/issues/395

View File

@@ -8,6 +8,6 @@ namespace Umbraco.Cms.Web.Common.ModelsBuilder
{
public interface IModelsBuilderDashboardProvider
{
string GetUrl();
string? GetUrl();
}
}

View File

@@ -151,7 +151,7 @@ namespace Umbraco.Cms.Web.Common.RuntimeMinification
public async Task<IEnumerable<string>> GetCssAssetPathsAsync(string bundleName) => await _smidge.SmidgeHelper.GenerateCssUrlsAsync(bundleName, _hostingEnvironment.IsDebugMode);
/// <inheritdoc />
public async Task<string> MinifyAsync(string fileContent, AssetType assetType)
public async Task<string> MinifyAsync(string? fileContent, AssetType assetType)
{
switch (assetType)
{

View File

@@ -110,7 +110,7 @@ namespace Umbraco.Cms.Web.Common.Security
return result;
}
public override async Task<IdentityResult> ChangePasswordWithResetAsync(string userId, string token, string newPassword)
public override async Task<IdentityResult> ChangePasswordWithResetAsync(string userId, string token, string? newPassword)
{
IdentityResult result = await base.ChangePasswordWithResetAsync(userId, token, newPassword);
if (result.Succeeded)
@@ -121,7 +121,7 @@ namespace Umbraco.Cms.Web.Common.Security
return result;
}
public override async Task<IdentityResult> ChangePasswordAsync(BackOfficeIdentityUser user, string currentPassword, string newPassword)
public override async Task<IdentityResult> ChangePasswordAsync(BackOfficeIdentityUser user, string? currentPassword, string? newPassword)
{
IdentityResult result = await base.ChangePasswordAsync(user, currentPassword, newPassword);
if (result.Succeeded)
@@ -176,7 +176,7 @@ namespace Umbraco.Cms.Web.Common.Security
return currentUserId;
}
public void NotifyAccountLocked(IPrincipal? currentUser, string userId) => Notify(currentUser,
public void NotifyAccountLocked(IPrincipal? currentUser, string? userId) => Notify(currentUser,
(currentUserId, ip) => new UserLockedNotification(ip, userId, currentUserId)
);
@@ -196,7 +196,7 @@ namespace Umbraco.Cms.Web.Common.Security
(currentUserId, ip) => new UserLoginFailedNotification(ip, userId, currentUserId)
);
public void NotifyLoginRequiresVerification(IPrincipal currentUser, string userId) => Notify(currentUser,
public void NotifyLoginRequiresVerification(IPrincipal currentUser, string? userId) => Notify(currentUser,
(currentUserId, ip) => new UserLoginRequiresVerificationNotification(ip, userId, currentUserId)
);

View File

@@ -15,11 +15,11 @@ namespace Umbraco.Cms.Web.BackOffice.Security
AuthenticationProperties ConfigureExternalAuthenticationProperties(string provider, string? redirectUrl, string? userId = null);
Task<SignInResult> ExternalLoginSignInAsync(ExternalLoginInfo loginInfo, bool isPersistent, bool bypassTwoFactor = false);
Task<IEnumerable<AuthenticationScheme>> GetExternalAuthenticationSchemesAsync();
Task<ExternalLoginInfo> GetExternalLoginInfoAsync(string? expectedXsrf = null);
Task<ExternalLoginInfo?> GetExternalLoginInfoAsync(string? expectedXsrf = null);
Task<BackOfficeIdentityUser> GetTwoFactorAuthenticationUserAsync();
Task<SignInResult> PasswordSignInAsync(string userName, string password, bool isPersistent, bool lockoutOnFailure);
Task SignOutAsync();
Task SignInAsync(BackOfficeIdentityUser user, bool isPersistent, string? authenticationMethod = null);
Task SignInAsync(BackOfficeIdentityUser? user, bool isPersistent, string? authenticationMethod = null);
Task<ClaimsPrincipal> CreateUserPrincipalAsync(BackOfficeIdentityUser user);
Task<SignInResult> TwoFactorSignInAsync(string? provider, string? code, bool isPersistent, bool rememberClient);
Task<IdentityResult> UpdateExternalAuthenticationTokensAsync(ExternalLoginInfo externalLogin);