You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
CoreShop/CoreCms.Net.Auth/HttpContextSetup.cs

34 lines
1.2 KiB
C#

/***********************************************************************
* Project: CoreCms
* ProjectName:
* Web: https://www.corecms.net
* Author:
* Email: jianweie@163.com
* CreateTime: 2021/1/31 21:45:10
* Description:
***********************************************************************/
using System;
using System.Collections.Generic;
using System.Text;
using CoreCms.Net.Auth.HttpContextUser;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
namespace CoreCms.Net.Auth
{
/// <summary>
/// 上下文启动
/// </summary>
public static class HttpContextSetup
{
public static void AddHttpContextSetup(this IServiceCollection services)
{
if (services == null) throw new ArgumentNullException(nameof(services));
services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
services.AddScoped<IHttpContextUser, AspNetUser>();
}
}
}