AspNet.Security.IndieAuth
1.0.0
dotnet add package AspNet.Security.IndieAuth --version 1.0.0
NuGet\Install-Package AspNet.Security.IndieAuth -Version 1.0.0
<PackageReference Include="AspNet.Security.IndieAuth" Version="1.0.0" />
paket add AspNet.Security.IndieAuth --version 1.0.0
#r "nuget: AspNet.Security.IndieAuth, 1.0.0"
// Install AspNet.Security.IndieAuth as a Cake Addin #addin nuget:?package=AspNet.Security.IndieAuth&version=1.0.0 // Install AspNet.Security.IndieAuth as a Cake Tool #tool nuget:?package=AspNet.Security.IndieAuth&version=1.0.0
IndieAuth .NET
An ASP.NET Core 6 authentication handler adding support for authenticating visitors using the IndieAuth protocol.
Installation
This library is distributed as a NuGet package. To install with the .NET CLI run dotnet add package AspNet.Security.IndieAuth --version {version number}
Usage
This is configured at startup just like any other authentication handler by calling AddIndieAuth
on the result of AddAuthentication
.
var authBuilder = builder.Services.AddAuthentication()
.AddCookie(CookieAuthenticationDefaults.AuthenticationScheme, options =>
{
options.LoginPath = "/account/sign-in";
})
.AddIndieAuth(IndieAuthDefaults.AuthenticationScheme, options =>
{
options.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
options.ClientId = config.IndieAuth.ClientId;
options.CallbackPath = "/authentication/indie-auth/callback";
});
To trigger the authentication flow, issue an authentication challenge with the supplied domain the visitor is authenticating with.
return Challenge(new IndieAuthChallengeProperties
{
Me = domain,
Scope = new[] { "profile", "create" },
RedirectUri = ReturnUrl
}, IndieAuthDefaults.AuthenticationScheme);
That's it, if the authentication is successful the user will be signed in.
Usage notes
Additional information on the configurable parameters
Configuring Indie Auth
ClientId
should be a URI where the IndieAuth server can fetch details about the website (using the hCard Microformat).CallbackPath
is where the authentication middleware will intercept the response from the IndieAuth serverSignInScheme
is the scheme used to persist the visitor's session - normally a cookie authentication handler
Configuring the challenge
Me
is the domain the visitor is authenticating with, the handler will fetch this domain to discover which IndieAuth server to authenticate withScope
is an array of scopes to useRedirectUri
is where the visitor should be redirected to after the challenge is completed
Roadmap
- Option to add additional claims from supplied domain hCard Microformat
Contributing
Contributions are very welcome!
Ways to contribute
- Fix an existing issue and submit a pull request
- Review open pull requests
- Report a new issue
- Make a suggestion/ contribute to a discussion
Acknowledgments
The project is based on the OAuth handler in the aspnetcore repository.
License
MIT
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- Microformats (>= 1.1.2)
- Microsoft.AspNetCore.Authentication (>= 2.2.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0 | 190 | 8/21/2023 |