Skip to content

Commit e1888c2

Browse files
committed
Add contend to the readme
1 parent ab46128 commit e1888c2

1 file changed

Lines changed: 98 additions & 0 deletions

File tree

README.md

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,100 @@
11
# KK.AspNetCore.EasyAuthAuthentication
2+
23
This helps getting azure appservice authentication working with asp.net core
4+
5+
> **Caution**: This project is not finished jet!
6+
7+
## Nuget
8+
9+
The EasyAuth handler is provided as a nuget package and can be found on nuget.org.
10+
11+
| Name | Status |
12+
| ------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
13+
| KK.AspNetCore.EasyAuthAuthentication | [![Nuget Badge](https://img.shields.io/nuget/v/KK.AspNetCore.EasyAuthAuthentication.svg)](https://www.nuget.org/packages/KK.AspNetCore.EasyAuthAuthentication/) |
14+
15+
You can add the package for example with the following `dotnet` command:
16+
17+
```
18+
dotnet add package KK.AspNetCore.EasyAuthAuthentication
19+
```
20+
21+
Pre-releases of this Package are pushed to an internal feed an Azure DevOps. There is no public access to this feeds at the moment.
22+
23+
## Build
24+
25+
The build environment for this project is on Azure DevOps and can be found here [dev.azure.com/kirkone/KK.AspNetCore.EasyAuthAuthentication](https://dev.azure.com/kirkone/KK.AspNetCore.EasyAuthAuthentication/_releases2?definitionId=1&view=mine&_a=releases)
26+
27+
### Nuget package build
28+
29+
| Name | Status |
30+
| --------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
31+
| KK.AspNetCore.EasyAuthAuthentication-CI | [![Build Status](https://dev.azure.com/kirkone/KK.AspNetCore.EasyAuthAuthentication/_apis/build/status/KK.AspNetCore.EasyAuthAuthentication-CI)](https://dev.azure.com/kirkone/KK.AspNetCore.EasyAuthAuthentication/_build/latest?definitionId=24) |
32+
| Alpha | [![Alpha](https://vsrm.dev.azure.com/kirkone/_apis/public/Release/badge/b206bf59-b281-4d06-91c3-3877c3aeaaf9/1/1)](https://dev.azure.com/kirkone/KK.AspNetCore.EasyAuthAuthentication/_releases2?definitionId=1&_a=releases) |
33+
| Beta | [![Beta](https://vsrm.dev.azure.com/kirkone/_apis/public/Release/badge/b206bf59-b281-4d06-91c3-3877c3aeaaf9/1/2)](https://dev.azure.com/kirkone/KK.AspNetCore.EasyAuthAuthentication/_releases2?definitionId=1&_a=releases) |
34+
| Release | [![Release](https://vsrm.dev.azure.com/kirkone/_apis/public/Release/badge/b206bf59-b281-4d06-91c3-3877c3aeaaf9/1/3)](https://dev.azure.com/kirkone/KK.AspNetCore.EasyAuthAuthentication/_releases2?definitionId=1&_a=releases) |
35+
36+
### Sample Web build
37+
38+
No build so far.
39+
40+
## Usage
41+
42+
> **INFO**: For detailed usage information please have a look in the `KK.AspNetCore.EasyAuthAuthentication.Sample` project.
43+
44+
### Startup.cs
45+
46+
Add something like this in the `public void ConfigureServices` method:
47+
48+
```
49+
services.AddAuthentication(
50+
options =>
51+
{
52+
options.DefaultAuthenticateScheme = EasyAuthAuthenticationDefaults.AuthenticationScheme;
53+
options.DefaultChallengeScheme = EasyAuthAuthenticationDefaults.AuthenticationScheme;
54+
}
55+
).AddEasyAuth();
56+
```
57+
58+
and this to the `public void Configure` method before `app.UseMvc...`:
59+
60+
```
61+
app.UseAuthentication();
62+
```
63+
64+
This will enable the `EasyAuthAuthenticationHandler` in your app.
65+
66+
### ...Controller.cs
67+
68+
In your controllers you can access the `User` property as usual:
69+
70+
```
71+
[Authorize]
72+
public string UserName()
73+
{
74+
var mulps = User.HasClaim(ClaimTypes.Name, "user@somecloud.onmicrosoft.com");
75+
var peng = User.HasClaim(ClaimTypes.Role, "SystemAdmin");
76+
var blubb = HttpContext.User.IsInRole("SystemAdmin");
77+
var pop = User.IsInRole("SystemAdmin");
78+
return HttpContext.User.Identity.Name;
79+
}
80+
```
81+
82+
### Adding custom roles
83+
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+
86+
## Authors
87+
88+
* **Kirsten Kluge** - *Initial work* - [kirkone](https://github.com/kirkone)
89+
* **paule96** - *Refactoring* - [paule96](https://github.com/paule96)
90+
* **Christoph Sonntag** - *Made things even more uber* - [Compufreak345](https://github.com/Compufreak345)
91+
92+
See also the list of [contributors](https://github.com/kirkone/KK.AspNetCore.EasyAuthAuthentication/graphs/contributors) who participated in this project.
93+
94+
## License
95+
96+
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details
97+
98+
## Acknowledgments
99+
100+
* Inspired by this [StackOverflow post](https://stackoverflow.com/a/42402163/6526640) and this [GitHub](https://github.com/lpunderscore/azureappservice-authentication-middleware) repo

0 commit comments

Comments
 (0)