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
+11-11Lines changed: 11 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,7 +45,7 @@ No build so far.
45
45
46
46
Add something like this in the `public void ConfigureServices` method:
47
47
48
-
```
48
+
```csharp
49
49
services.AddAuthentication(
50
50
options=>
51
51
{
@@ -57,7 +57,7 @@ services.AddAuthentication(
57
57
58
58
and this to the `public void Configure` method before `app.UseMvc...`:
59
59
60
-
```
60
+
```csharp
61
61
app.UseAuthentication();
62
62
```
63
63
@@ -67,7 +67,7 @@ This will enable the `EasyAuthAuthenticationHandler` in your app.
67
67
68
68
In your controllers you can access the `User` property as usual:
69
69
70
-
```
70
+
```csharp
71
71
[Authorize]
72
72
publicstringUserName()
73
73
{
@@ -87,14 +87,14 @@ If you want to add roles to the `User` property you can have a look in `Transfor
87
87
88
88
You can provide additional options vor the middleware:
89
89
90
-
```
90
+
```csharp
91
91
).AddEasyAuth(
92
-
options =>
93
-
{
94
-
// Override the default claim for the User.Identity.Name field
95
-
options.NameClaimType = ClaimTypes.Email;
96
-
}
97
-
);
92
+
options=>
93
+
{
94
+
// Override the default claim for the User.Identity.Name field
95
+
options.NameClaimType=ClaimTypes.Email;
96
+
}
97
+
);
98
98
```
99
99
100
100
The `NameClaimType` is the ClaimType of the value which one will be used to fill the `User.Identity.Name` field.
@@ -104,7 +104,7 @@ The `NameClaimType` is the ClaimType of the value which one will be used to fill
104
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.
0 commit comments