You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+16Lines changed: 16 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -83,6 +83,22 @@ public string UserName()
83
83
84
84
If you want to add roles to the `User` property you can have a look in `Transformers/ClaimsTransformer.cs` in the Sample project. There you can see an example how to get started with this.
85
85
86
+
### Custom options
87
+
88
+
You can provide additional options vor the middleware:
89
+
90
+
```
91
+
).AddEasyAuth(
92
+
options =>
93
+
{
94
+
// Override the default claim for the User.Identity.Name field
95
+
options.NameClaimType = ClaimTypes.Email;
96
+
}
97
+
);
98
+
```
99
+
100
+
The `NameClaimType` is the ClaimType of the value which one will be used to fill the `User.Identity.Name` field.
101
+
86
102
### Local Debugging
87
103
88
104
For debugging your application you can place a `me.json` in the `wwwroot/.auth` folder of your web app and add some configuration to the `AddEasyAuth` call.
Copy file name to clipboardExpand all lines: src/KK.AspNetCore.EasyAuthAuthentication/Services/EasyAuthWithHeaderService.cs
+9-6Lines changed: 9 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -15,25 +15,30 @@ internal class EasyAuthWithHeaderService
15
15
16
16
privateEasyAuthWithHeaderService(
17
17
ILoggerlogger,
18
-
IHeaderDictionaryheaders)
18
+
IHeaderDictionaryheaders,
19
+
EasyAuthAuthenticationOptionsoptions)
19
20
{
20
21
this.Logger=logger;
21
22
this.Headers=headers;
23
+
this.Options=options;
22
24
}
23
25
24
26
privateILoggerLogger{get;}
25
27
26
28
privateIHeaderDictionaryHeaders{get;}
27
29
30
+
privateEasyAuthAuthenticationOptionsOptions{get;}
31
+
28
32
/// <summary>
29
33
/// build up identity from X-MS-TOKEN-AAD-ID-TOKEN header set by EasyAuth filters if user openId connect session cookie or oauth bearer token authenticated ...
30
34
/// </summary>
31
35
/// <param name="logger">An instance of <see cref="ILogger"/>.</param>
32
36
/// <param name="context">Http context of the request.</param>
37
+
/// <param name="options">The <c>EasyAuthAuthenticationOptions</c> to use.</param>
0 commit comments