Skip to content

Commit 02cd475

Browse files
Huawei provider tweaks
- Rename `FetchNickName` to `FetchNickname`. - Add missing XML documentation. - Remove documentation copied from Huawei that isn't provider-specific.
1 parent cd594d9 commit 02cd475

File tree

4 files changed

+10
-12
lines changed

4 files changed

+10
-12
lines changed

docs/huawei.md

+4-9
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ services.AddAuthentication(options => /* Auth configuration */)
99
options.ClientId = "my-client-id";
1010
options.ClientSecret = "my-client-secret";
1111

12-
// Optionally.
12+
// Optionally return the user's profile and email address
1313
options.Scope.Add("profile");
1414
options.Scope.Add("email");
1515

16-
// Optionally.
17-
options.FetchNickName = true;
16+
// Optionally get the user's nickname
17+
options.FetchNickname = true;
1818
});
1919
```
2020

@@ -26,9 +26,4 @@ _None._
2626

2727
| Property Name | Property Type | Description | Default Value |
2828
|:--|:--|:--|:--|
29-
| `FetchNickName` | `bool` | When FetchNickName is set to false or not set, the anonymous account is returned. If the anonymous account is unavailable, the nickname is returned. When FetchNickName is set to true, the nickname is returned. If the nickname is unavailable, the anonymous account is returned. | `false` |
30-
31-
### Scope
32-
Corresponding information, such as the profile picture and email address, can be obtained only if the app has the permission to obtain the information.
33-
* `profile` basic information of a HUAWEI ID, such as the profile picture and nickname.
34-
* `email` email address of a HUAWEI ID.
29+
| `FetchNickname` | `bool` | When `false` the anonymous account is returned. If the anonymous account is unavailable, the nickname is returned. When `true`, the nickname is returned. If the nickname is unavailable, the anonymous account is returned. | `false` |

src/AspNet.Security.OAuth.Huawei/HuaweiAuthenticationHandler.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ protected override async Task<AuthenticationTicket> CreateTicketAsync(
3333

3434
var content = new FormUrlEncodedContent(new[]
3535
{
36-
new KeyValuePair<string, string>("getNickName", Options.FetchNickName ? "1" : "0"),
36+
new KeyValuePair<string, string>("getNickName", Options.FetchNickname ? "1" : "0"),
3737
new KeyValuePair<string, string>("access_token", tokens.AccessToken!)
3838
});
3939

src/AspNet.Security.OAuth.Huawei/HuaweiAuthenticationOptions.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,8 @@ public HuaweiAuthenticationOptions()
3131
Scope.Add("openid");
3232
}
3333

34-
public bool FetchNickName { get; set; }
34+
/// <summary>
35+
/// Gets or sets a value indicating whether to use the user's nickname, if available.
36+
/// </summary>
37+
public bool FetchNickname { get; set; }
3538
}

test/AspNet.Security.OAuth.Providers.Tests/Huawei/HuaweiTests.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ protected internal override void RegisterAuthentication(AuthenticationBuilder bu
1919
{
2020
builder.AddHuawei(options =>
2121
{
22-
options.FetchNickName = true;
22+
options.FetchNickname = true;
2323

2424
options.Scope.Add("profile");
2525
options.Scope.Add("email");

0 commit comments

Comments
 (0)