去掉Owin的一些代码

This commit is contained in:
yubaolee
2015-09-22 23:10:00 +08:00
parent 2f9b41b96d
commit 2a5cdd453f
18 changed files with 1254 additions and 698 deletions

View File

@@ -1,29 +1,28 @@
using System;
using OpenAuth.Domain.Interface;
namespace OpenAuth.App
{
public class LoginApp
{
private IUserRepository _repository;
public LoginApp(IUserRepository repository)
{
_repository = repository;
}
public void Login(string userName, string password)
{
var user = _repository.FindByAccount(userName);
if (user == null)
{
throw new Exception("<22>û<EFBFBD><C3BB>ʺŲ<CABA><C5B2><EFBFBD><EFBFBD><EFBFBD>");
}
user.CheckLogin(password);
LoginCacheApp.SetLogin(user);
}
}
using System;
using OpenAuth.Domain.Interface;
namespace OpenAuth.App
{
public class LoginApp
{
private IUserRepository _repository;
public LoginApp(IUserRepository repository)
{
_repository = repository;
}
public void Login(string userName, string password)
{
var user = _repository.FindByAccount(userName);
if (user == null)
{
throw new Exception("<22>û<EFBFBD><C3BB>ʺŲ<CABA><C5B2><EFBFBD><EFBFBD><EFBFBD>");
}
user.CheckLogin(password);
}
}
}

View File

@@ -1,25 +0,0 @@
using System.Web;
using OpenAuth.Domain;
namespace OpenAuth.App
{
public class LoginCacheApp
{
public static User GetLogin()
{
var session = HttpContext.Current.Session;
return session["Login"] as User;
}
public static void SetLogin(User loginresp)
{
var session = HttpContext.Current.Session;
var login = session["Login"] as User;
if (login != null && login.UserId == loginresp.UserId)
{
return;
}
session["Login"] = loginresp;
}
}
}

View File

@@ -1,65 +1,64 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{0BBF2D65-FFFD-4272-B138-8EA4FB6FEC48}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OpenAuth.App</RootNamespace>
<AssemblyName>OpenAuth.App</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="LoginApp.cs" />
<Compile Include="LoginCacheApp.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\OpenAuth.Domain\OpenAuth.Domain.csproj">
<Project>{6108da8e-92a1-4abe-b9f5-26d64d55ca2c}</Project>
<Name>OpenAuth.Domain</Name>
</ProjectReference>
<ProjectReference Include="..\OpenAuth.Repository\OpenAuth.Repository.csproj">
<Project>{e8df8dea-e2cf-4bdb-8f4f-3f8205b0e03a}</Project>
<Name>OpenAuth.Repository</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{0BBF2D65-FFFD-4272-B138-8EA4FB6FEC48}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OpenAuth.App</RootNamespace>
<AssemblyName>OpenAuth.App</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="LoginApp.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\OpenAuth.Domain\OpenAuth.Domain.csproj">
<Project>{6108da8e-92a1-4abe-b9f5-26d64d55ca2c}</Project>
<Name>OpenAuth.Domain</Name>
</ProjectReference>
<ProjectReference Include="..\OpenAuth.Repository\OpenAuth.Repository.csproj">
<Project>{e8df8dea-e2cf-4bdb-8f4f-3f8205b0e03a}</Project>
<Name>OpenAuth.Repository</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>