A collection of useful implementations to make easy to deal with a few things =)
USAGE:
Authentication
Create a new class that implements interface IAuthOptions
public interface IAuthOptions
{
string ChallengeScheme { get; }
string AuthorizationEndpoint { get; }
string TokenEndpoint { get; }
string UserInformationEndpoint { get; }
string ClientId { get; }
string ClientSecret { get; }
Action<ClaimActionCollection> MapClaims { get; }
}
In the Startup.cs, do as follow:
public void ConfigureServices(IServiceCollection services)
{
...
services.AddOAuthAuthentication(new MyAuthOptionsImplementation());
...
}
Or, if you don't want to implement your own class, just use our Builder:
public void ConfigureServices(IServiceCollection services)
{
services
.AddNiboAuthentication(options =>
options
...
.Build());
}
Ok, now in your client, you just need to access YOUR API ADDRESS/api/auth to see the magic happens.
SPA (Single Page Application)
Want to use a SPA?
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
...
app.UseSPA();
...
}
Simple as it should be, it will read the files from wwwroot in your WebApi Project directory.