mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-09-20 10:37:55 +08:00
ru
This commit is contained in:
@@ -27,12 +27,8 @@ namespace OpenAuth.WebApi.Areas.SSO.Controllers
|
||||
/// </summary>
|
||||
public class CheckController : ApiController
|
||||
{
|
||||
private AuthorizeApp _app;
|
||||
public AuthorizeApp _app { get; set; }
|
||||
private ObjCacheProvider<UserAuthSession> _objCacheProvider = new ObjCacheProvider<UserAuthSession>();
|
||||
public CheckController()
|
||||
{
|
||||
_app = AutofacExt.GetFromFac<AuthorizeApp>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检验token是否有效
|
||||
|
@@ -11,12 +11,7 @@ namespace OpenAuth.WebApi.Areas.SSO.Controllers
|
||||
/// </summary>
|
||||
public class LoginController : Controller
|
||||
{
|
||||
private AppInfoService _appInfoService;
|
||||
|
||||
public LoginController()
|
||||
{
|
||||
_appInfoService = new AppInfoService();
|
||||
}
|
||||
public AppInfoService _appInfoService { get; set; }
|
||||
|
||||
private const string AppInfo = "AppInfo";
|
||||
|
||||
|
@@ -13,10 +13,11 @@
|
||||
// ***********************************************************************
|
||||
|
||||
using System.Reflection;
|
||||
using System.Web.Http;
|
||||
using System.Web.Mvc;
|
||||
using Autofac;
|
||||
using Autofac.Configuration;
|
||||
using Autofac.Integration.Mvc;
|
||||
using Autofac.Integration.WebApi;
|
||||
using OpenAuth.App;
|
||||
using OpenAuth.Domain.Interface;
|
||||
using OpenAuth.Repository;
|
||||
@@ -50,8 +51,13 @@ namespace OpenAuth.WebApi
|
||||
// OPTIONAL: Enable property injection into action filters.
|
||||
builder.RegisterFilterProvider();
|
||||
|
||||
// Set the dependency resolver to be Autofac.
|
||||
//注册所有的ApiControllers
|
||||
builder.RegisterApiControllers(Assembly.GetExecutingAssembly()).PropertiesAutowired();
|
||||
|
||||
var container = builder.Build();
|
||||
HttpConfiguration config = GlobalConfiguration.Configuration;
|
||||
//注册api容器需要使用HttpConfiguration对象
|
||||
config.DependencyResolver = new AutofacWebApiDependencyResolver(container);
|
||||
DependencyResolver.SetResolver(new AutofacDependencyResolver(container));
|
||||
}
|
||||
|
||||
|
@@ -57,6 +57,10 @@
|
||||
<HintPath>..\packages\Autofac.Mvc5.3.3.4\lib\net45\Autofac.Integration.Mvc.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Autofac.Integration.WebApi, Version=3.4.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.WebApi2.3.4.0\lib\net45\Autofac.Integration.WebApi.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
|
@@ -4,6 +4,7 @@
|
||||
<package id="Autofac" version="3.5.2" targetFramework="net45" />
|
||||
<package id="Autofac.Configuration" version="3.3.0" targetFramework="net45" />
|
||||
<package id="Autofac.Mvc5" version="3.3.4" targetFramework="net45" />
|
||||
<package id="Autofac.WebApi2" version="3.4.0" targetFramework="net45" />
|
||||
<package id="bootstrap" version="3.0.0" targetFramework="net45" />
|
||||
<package id="EntityFramework" version="6.1.3" targetFramework="net45" />
|
||||
<package id="jQuery" version="1.10.2" targetFramework="net45" />
|
||||
|
Reference in New Issue
Block a user