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
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AspNet.Security.IndieAuth" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add AspNet.Security.IndieAuth --version 1.0.0
#r "nuget: AspNet.Security.IndieAuth, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// 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 server
  • SignInScheme 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 with
  • Scope is an array of scopes to use
  • RedirectUri 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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 145 8/21/2023