Skip to content

Commit 9cec87b

Browse files
committed
Fixed nullable warnings.
1 parent faf7b2a commit 9cec87b

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

Http/src/AppCoreNet.Extensions.Http.Authentication.OAuth.AspNetCore/OAuthUserTokenService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ await _client.RequestRefreshTokenAsync(
143143
TimeProvider timeProvider = options.TimeProvider ?? TimeProvider.System;
144144

145145
OAuthUserToken refreshedToken = new (
146-
response.AccessToken,
146+
response.AccessToken!,
147147
response.RefreshToken,
148148
response.ExpiresIn > 0 ? timeProvider.GetUtcNow() + TimeSpan.FromSeconds(response.ExpiresIn) : null);
149149

Http/src/AppCoreNet.Extensions.Http.Authentication.OAuth/AppCoreNet.Extensions.Http.Authentication.OAuth.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
</ItemGroup>
2222

2323
<ItemGroup Condition="'$(TargetFrameworks)' != 'net8.0'">
24-
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="6.0.0" />
24+
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="6.0.1" />
2525
</ItemGroup>
2626

2727
</Project>

Http/src/AppCoreNet.Extensions.Http.Authentication.OAuth/OAuthTokenClient.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ await _optionsProvider.GetOptionsAsync<OAuthClientOptions>(scheme)
4545
using var request = new ClientCredentialsTokenRequest
4646
{
4747
RequestUri = options.TokenEndpoint,
48-
ClientId = options.ClientId,
48+
ClientId = options.ClientId!,
4949
ClientSecret = options.ClientSecret,
5050
ClientCredentialStyle = options.ClientCredentialStyle,
5151
Scope = options.Scope,
5252
Resource = new List<string>(options.Resource),
53-
Parameters = parameters?.Context,
53+
Parameters = parameters?.Context ?? new Parameters(),
5454
};
5555

5656
if (parameters != null && !string.IsNullOrWhiteSpace(parameters.Resource))
@@ -73,14 +73,14 @@ await _optionsProvider.GetOptionsAsync<OAuthPasswordOptions>(scheme)
7373
using var request = new PasswordTokenRequest
7474
{
7575
RequestUri = options.TokenEndpoint,
76-
ClientId = options.ClientId,
76+
ClientId = options.ClientId!,
7777
ClientSecret = options.ClientSecret,
7878
ClientCredentialStyle = options.ClientCredentialStyle,
79-
UserName = options.Username,
79+
UserName = options.Username!,
8080
Password = options.Password,
8181
Scope = options.Scope,
8282
Resource = new List<string>(options.Resource),
83-
Parameters = parameters?.Context,
83+
Parameters = parameters?.Context ?? new Parameters(),
8484
};
8585

8686
if (parameters != null && !string.IsNullOrWhiteSpace(parameters.Resource))
@@ -106,7 +106,7 @@ await _optionsProvider.GetOptionsAsync<OAuthClientOptions>(scheme)
106106
using var request = new RefreshTokenRequest
107107
{
108108
RequestUri = options.TokenEndpoint,
109-
ClientId = options.ClientId,
109+
ClientId = options.ClientId!,
110110
ClientSecret = options.ClientSecret,
111111
ClientCredentialStyle = options.ClientCredentialStyle,
112112
RefreshToken = refreshToken,
@@ -133,7 +133,7 @@ await _optionsProvider.GetOptionsAsync<OAuthClientOptions>(scheme)
133133
using var request = new TokenRevocationRequest
134134
{
135135
RequestUri = options.TokenEndpoint,
136-
ClientId = options.ClientId,
136+
ClientId = options.ClientId!,
137137
ClientSecret = options.ClientSecret,
138138
ClientCredentialStyle = options.ClientCredentialStyle,
139139
Token = token,

Http/src/AppCoreNet.Extensions.Http.Authentication.OAuth/OAuthTokenService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ await _client.RequestClientAccessTokenAsync(scheme, parameters, cancellationToke
101101
}
102102

103103
OAuthAccessToken token = new (
104-
response.AccessToken,
104+
response.AccessToken!,
105105
response.ExpiresIn > 0 ? DateTimeOffset.UtcNow + TimeSpan.FromSeconds(response.ExpiresIn) : null);
106106

107107
_logger.LogDebug(
@@ -162,7 +162,7 @@ await _client.RequestPasswordAccessTokenAsync(scheme, parameters, cancellationTo
162162
}
163163

164164
OAuthAccessToken token = new (
165-
response.AccessToken,
165+
response.AccessToken!,
166166
response.ExpiresIn > 0 ? DateTimeOffset.UtcNow + TimeSpan.FromSeconds(response.ExpiresIn) : null);
167167

168168
_logger.LogDebug(

0 commit comments

Comments
 (0)