Skip to content

petrsvihlik/jsConnectAspNetCoreMvc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jsConnectAspNetCoreMvc

Build & Test NuGet link Downloads

Vanilla Forums' jsConnect for ASP.NET Core MVC

Getting started

1. Install the NuGet package and reference jsConnect from your web application project.

2. Configure the DI Container. Inject IConfiguration and ILogger.

public void ConfigureServices(IServiceCollection services)
{
	services
	.AddMvc() // Or AddControllers, or similar...
	.AddApplicationPart(typeof(VanillaApiClient).GetTypeInfo().Assembly); // Add the controllers from this

   services.AddSingleton(Configuration);
   services.AddTransient<HashAlgorithm>(h => SHA512.Create()); // Reflect the hashing algorithm set in Vanilla Forums
}

3. Add configuration

"Vanilla": {
   "ClientId": "your_client_id",
   "ClientSecret": "your_secret",
   "TimestampValidFor": "int_seconds",
   "AllowWhitespaceInUsername": "bool",
   "BaseUri": "http://your-vanilla-forum.com/"
}

4. Make sure the HttpContext.User has the following claims set according to the documentation:

System.Security.Claims.ClaimTypes.NameIdentifier // required
System.Security.Claims.ClaimTypes.Name // required
System.Security.Claims.ClaimTypes.Email // required
"AvatarUrl" // optional
"Roles" // optional

5. Point Authentication URL of your Vanilla Forums to http://yourapp/jsconnect/authenticate

6. You are done!

7. Additionally, you can add the Vanilla:TimestampValidFor setting (in seconds). By default, it's 30 minutes. See all configuration options in the JsConnectController.

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy