Skip to content

Commit d2cabae

Browse files
committed
Change C# namespace to ServiceStack.Authentication.RavenDb
1 parent 8b3fdb1 commit d2cabae

7 files changed

Lines changed: 157 additions & 156 deletions

src/ServiceStack.Authentication.Raven/Properties/AssemblyInfo.cs renamed to src/ServiceStack.Authentication.RavenDb/Properties/AssemblyInfo.cs

File renamed without changes.

src/ServiceStack.Authentication.Raven/RavenUserAuthRepository.cs renamed to src/ServiceStack.Authentication.RavenDb/RavenUserAuthRepository.cs

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,22 @@
88
using ServiceStack.ServiceInterface.Auth;
99
using ServiceStack.Text;
1010

11-
namespace ServiceStack.Authentication.Raven
11+
namespace ServiceStack.Authentication.RavenDb
1212
{
1313
public class RavenUserAuthRepository : IUserAuthRepository
1414
{
1515
//http://stackoverflow.com/questions/3588623/c-sharp-regex-for-a-username-with-a-few-restrictions
1616
public Regex ValidUserNameRegEx = new Regex(@"^(?=.{3,15}$)([A-Za-z0-9][._-]?)*$", RegexOptions.Compiled);
1717

18-
private readonly IDocumentStore _documentStore;
18+
private readonly IDocumentStore _documentStore;
1919
private static bool _isInitialized = false;
2020

21-
public static void CreateOrUpdateUserAuthIndex(IDocumentStore store)
22-
{
23-
// put this index into the ravendb database
24-
new ServiceStack_UserAuth_ByUserNameOrEmail().Execute(store);
25-
new ServiceStack_UserAuth_ByOAuthProvider().Execute(store);
26-
_isInitialized = true;
21+
public static void CreateOrUpdateUserAuthIndex(IDocumentStore store)
22+
{
23+
// put this index into the ravendb database
24+
new ServiceStack_UserAuth_ByUserNameOrEmail().Execute(store);
25+
new ServiceStack_UserAuth_ByOAuthProvider().Execute(store);
26+
_isInitialized = true;
2727
}
2828

2929
public RavenUserAuthRepository(IDocumentStore documentStore)
@@ -133,15 +133,15 @@ public UserAuth UpdateUserAuth(UserAuth existingUser, UserAuth newUser, string p
133133
}
134134

135135
public UserAuth GetUserAuthByUserName(string userNameOrEmail)
136-
{
137-
using (var session = _documentStore.OpenSession())
138-
{
139-
var userAuth = session.Query<ServiceStack_UserAuth_ByUserNameOrEmail.Result, ServiceStack_UserAuth_ByUserNameOrEmail>()
140-
.Search(x => x.Search, userNameOrEmail)
141-
.OfType<UserAuth>()
142-
.FirstOrDefault();
143-
144-
return userAuth;
136+
{
137+
using (var session = _documentStore.OpenSession())
138+
{
139+
var userAuth = session.Query<ServiceStack_UserAuth_ByUserNameOrEmail.Result, ServiceStack_UserAuth_ByUserNameOrEmail>()
140+
.Search(x => x.Search, userNameOrEmail)
141+
.OfType<UserAuth>()
142+
.FirstOrDefault();
143+
144+
return userAuth;
145145
}
146146
}
147147

@@ -270,12 +270,12 @@ public UserAuth GetUserAuth(IAuthSession authSession, IOAuthTokens tokens)
270270
if (tokens == null || tokens.Provider.IsNullOrEmpty() || tokens.UserId.IsNullOrEmpty())
271271
return null;
272272

273-
using (var session = _documentStore.OpenSession())
274-
{
275-
var oAuthProvider = session
276-
.Query<ServiceStack_UserAuth_ByOAuthProvider.Result, ServiceStack_UserAuth_ByOAuthProvider>()
277-
.Where(q => q.Provider == tokens.Provider && q.UserId == tokens.UserId)
278-
.OfType<UserOAuthProvider>()
273+
using (var session = _documentStore.OpenSession())
274+
{
275+
var oAuthProvider = session
276+
.Query<ServiceStack_UserAuth_ByOAuthProvider.Result, ServiceStack_UserAuth_ByOAuthProvider>()
277+
.Where(q => q.Provider == tokens.Provider && q.UserId == tokens.UserId)
278+
.OfType<UserOAuthProvider>()
279279
.FirstOrDefault();
280280

281281
if (oAuthProvider != null)
@@ -292,11 +292,11 @@ public string CreateOrMergeAuthSession(IAuthSession authSession, IOAuthTokens to
292292
var userAuth = GetUserAuth(authSession, tokens) ?? new UserAuth();
293293

294294
using (var session = _documentStore.OpenSession())
295-
{
296-
var oAuthProvider = session
297-
.Query<ServiceStack_UserAuth_ByOAuthProvider.Result, ServiceStack_UserAuth_ByOAuthProvider>()
298-
.Where(q => q.Provider == tokens.Provider && q.UserId == tokens.UserId)
299-
.OfType<UserOAuthProvider>()
295+
{
296+
var oAuthProvider = session
297+
.Query<ServiceStack_UserAuth_ByOAuthProvider.Result, ServiceStack_UserAuth_ByOAuthProvider>()
298+
.Where(q => q.Provider == tokens.Provider && q.UserId == tokens.UserId)
299+
.OfType<UserOAuthProvider>()
300300
.FirstOrDefault();
301301

302302
if (oAuthProvider == null)

src/ServiceStack.Authentication.Raven/ServiceStack.Authentication.Raven.csproj renamed to src/ServiceStack.Authentication.RavenDb/ServiceStack.Authentication.RavenDb.csproj

Lines changed: 67 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,74 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4-
<PropertyGroup>
5-
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6-
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7-
<ProjectGuid>{A30BD5B5-00C9-4B9D-9C9D-514B4A676FF3}</ProjectGuid>
8-
<OutputType>Library</OutputType>
9-
<AppDesignerFolder>Properties</AppDesignerFolder>
10-
<RootNamespace>ServiceStack.Authentication.Raven</RootNamespace>
11-
<AssemblyName>ServiceStack.Authentication.Raven</AssemblyName>
12-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
13-
<FileAlignment>512</FileAlignment>
14-
</PropertyGroup>
15-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
16-
<DebugSymbols>true</DebugSymbols>
17-
<DebugType>full</DebugType>
18-
<Optimize>false</Optimize>
19-
<OutputPath>bin\Debug\</OutputPath>
20-
<DefineConstants>DEBUG;TRACE</DefineConstants>
21-
<ErrorReport>prompt</ErrorReport>
22-
<WarningLevel>4</WarningLevel>
23-
</PropertyGroup>
24-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
25-
<DebugType>pdbonly</DebugType>
26-
<Optimize>true</Optimize>
27-
<OutputPath>bin\Release\</OutputPath>
28-
<DefineConstants>TRACE</DefineConstants>
29-
<ErrorReport>prompt</ErrorReport>
30-
<WarningLevel>4</WarningLevel>
31-
</PropertyGroup>
32-
<ItemGroup>
33-
<Reference Include="Raven.Abstractions">
34-
<HintPath>..\packages\RavenDB.Client.2.0.2230\lib\net40\Raven.Abstractions.dll</HintPath>
35-
</Reference>
36-
<Reference Include="Raven.Client.Lightweight">
37-
<HintPath>..\packages\RavenDB.Client.2.0.2230\lib\net40\Raven.Client.Lightweight.dll</HintPath>
38-
</Reference>
39-
<Reference Include="ServiceStack.Common">
40-
<HintPath>..\..\lib\ServiceStack.Common.dll</HintPath>
41-
</Reference>
42-
<Reference Include="ServiceStack.ServiceInterface">
43-
<HintPath>..\..\lib\ServiceStack.ServiceInterface.dll</HintPath>
44-
</Reference>
45-
<Reference Include="ServiceStack.Text">
46-
<HintPath>..\..\lib\ServiceStack.Text.dll</HintPath>
47-
</Reference>
48-
<Reference Include="System" />
49-
<Reference Include="System.ComponentModel.Composition" />
50-
<Reference Include="System.Core" />
51-
<Reference Include="System.Xml.Linq" />
52-
<Reference Include="System.Data.DataSetExtensions" />
53-
<Reference Include="Microsoft.CSharp" />
54-
<Reference Include="System.Data" />
55-
<Reference Include="System.Xml" />
56-
</ItemGroup>
57-
<ItemGroup>
58-
<Compile Include="ServiceStack_UserAuth_ByOAuthProvider.cs" />
59-
<Compile Include="ServiceStack_UserAuth_ByUserNameOrEmail.cs" />
60-
<Compile Include="RavenUserAuthRepository.cs" />
61-
<Compile Include="Properties\AssemblyInfo.cs" />
62-
</ItemGroup>
63-
<ItemGroup>
64-
<None Include="packages.config" />
65-
</ItemGroup>
66-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{A30BD5B5-00C9-4B9D-9C9D-514B4A676FF3}</ProjectGuid>
8+
<OutputType>Library</OutputType>
9+
<AppDesignerFolder>Properties</AppDesignerFolder>
10+
<RootNamespace>ServiceStack.Authentication.RavenDb</RootNamespace>
11+
<AssemblyName>ServiceStack.Authentication.RavenDb</AssemblyName>
12+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
13+
<FileAlignment>512</FileAlignment>
14+
</PropertyGroup>
15+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
16+
<DebugSymbols>true</DebugSymbols>
17+
<DebugType>full</DebugType>
18+
<Optimize>false</Optimize>
19+
<OutputPath>bin\Debug\</OutputPath>
20+
<DefineConstants>DEBUG;TRACE</DefineConstants>
21+
<ErrorReport>prompt</ErrorReport>
22+
<WarningLevel>4</WarningLevel>
23+
</PropertyGroup>
24+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
25+
<DebugType>pdbonly</DebugType>
26+
<Optimize>true</Optimize>
27+
<OutputPath>bin\Release\</OutputPath>
28+
<DefineConstants>TRACE</DefineConstants>
29+
<ErrorReport>prompt</ErrorReport>
30+
<WarningLevel>4</WarningLevel>
31+
</PropertyGroup>
32+
<ItemGroup>
33+
<Reference Include="Raven.Abstractions">
34+
<HintPath>..\packages\RavenDB.Client.2.0.2230\lib\net40\Raven.Abstractions.dll</HintPath>
35+
</Reference>
36+
<Reference Include="Raven.Client.Lightweight">
37+
<HintPath>..\packages\RavenDB.Client.2.0.2230\lib\net40\Raven.Client.Lightweight.dll</HintPath>
38+
</Reference>
39+
<Reference Include="ServiceStack.Common">
40+
<HintPath>..\..\lib\ServiceStack.Common.dll</HintPath>
41+
</Reference>
42+
<Reference Include="ServiceStack.ServiceInterface">
43+
<HintPath>..\..\lib\ServiceStack.ServiceInterface.dll</HintPath>
44+
</Reference>
45+
<Reference Include="ServiceStack.Text">
46+
<HintPath>..\..\lib\ServiceStack.Text.dll</HintPath>
47+
</Reference>
48+
<Reference Include="System" />
49+
<Reference Include="System.ComponentModel.Composition" />
50+
<Reference Include="System.Core" />
51+
<Reference Include="System.Xml.Linq" />
52+
<Reference Include="System.Data.DataSetExtensions" />
53+
<Reference Include="Microsoft.CSharp" />
54+
<Reference Include="System.Data" />
55+
<Reference Include="System.Xml" />
56+
</ItemGroup>
57+
<ItemGroup>
58+
<Compile Include="ServiceStack_UserAuth_ByOAuthProvider.cs" />
59+
<Compile Include="ServiceStack_UserAuth_ByUserNameOrEmail.cs" />
60+
<Compile Include="RavenUserAuthRepository.cs" />
61+
<Compile Include="Properties\AssemblyInfo.cs" />
62+
</ItemGroup>
63+
<ItemGroup>
64+
<None Include="packages.config" />
65+
</ItemGroup>
66+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
6767
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
6868
Other similar extension points exist, see Microsoft.Common.targets.
6969
<Target Name="BeforeBuild">
7070
</Target>
7171
<Target Name="AfterBuild">
7272
</Target>
73-
-->
73+
-->
7474
</Project>

src/ServiceStack.Authentication.Raven/ServiceStack_UserAuth_ByOAuthProvider.cs renamed to src/ServiceStack.Authentication.RavenDb/ServiceStack_UserAuth_ByOAuthProvider.cs

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
1-
using System;
2-
using System.Linq;
3-
using Raven.Client.Indexes;
4-
using ServiceStack.ServiceInterface.Auth;
5-
6-
namespace ServiceStack.Authentication.Raven
7-
{
8-
public class ServiceStack_UserAuth_ByOAuthProvider : AbstractIndexCreationTask<UserOAuthProvider, ServiceStack_UserAuth_ByOAuthProvider.Result>
9-
{
10-
public class Result
11-
{
12-
public string Provider { get; set; }
13-
public string UserId { get; set; }
14-
public int UserAuthId { get; set; }
15-
public DateTime ModifiedDate { get; set; }
16-
}
17-
18-
public ServiceStack_UserAuth_ByOAuthProvider()
19-
{
20-
Map = oauthProviders => from oauthProvider in oauthProviders
21-
select new Result
22-
{
23-
Provider = oauthProvider.Provider,
24-
UserId = oauthProvider.UserId,
25-
ModifiedDate = oauthProvider.ModifiedDate,
26-
UserAuthId = oauthProvider.UserAuthId
27-
};
28-
}
29-
}
30-
}
1+
using System;
2+
using System.Linq;
3+
using Raven.Client.Indexes;
4+
using ServiceStack.ServiceInterface.Auth;
5+
6+
namespace ServiceStack.Authentication.RavenDb
7+
{
8+
public class ServiceStack_UserAuth_ByOAuthProvider : AbstractIndexCreationTask<UserOAuthProvider, ServiceStack_UserAuth_ByOAuthProvider.Result>
9+
{
10+
public class Result
11+
{
12+
public string Provider { get; set; }
13+
public string UserId { get; set; }
14+
public int UserAuthId { get; set; }
15+
public DateTime ModifiedDate { get; set; }
16+
}
17+
18+
public ServiceStack_UserAuth_ByOAuthProvider()
19+
{
20+
Map = oauthProviders => from oauthProvider in oauthProviders
21+
select new Result
22+
{
23+
Provider = oauthProvider.Provider,
24+
UserId = oauthProvider.UserId,
25+
ModifiedDate = oauthProvider.ModifiedDate,
26+
UserAuthId = oauthProvider.UserAuthId
27+
};
28+
}
29+
}
30+
}

src/ServiceStack.Authentication.Raven/ServiceStack_UserAuth_ByUserNameOrEmail.cs renamed to src/ServiceStack.Authentication.RavenDb/ServiceStack_UserAuth_ByUserNameOrEmail.cs

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
1-
using System.Linq;
2-
using Raven.Abstractions.Indexing;
3-
using Raven.Client.Indexes;
4-
using ServiceStack.ServiceInterface.Auth;
5-
6-
namespace ServiceStack.Authentication.Raven
7-
{
8-
public class ServiceStack_UserAuth_ByUserNameOrEmail : AbstractIndexCreationTask<UserAuth, ServiceStack_UserAuth_ByUserNameOrEmail.Result>
9-
{
10-
public class Result
11-
{
12-
public string UserName { get; set; }
13-
public string Email { get; set; }
14-
public string[] Search { get; set; }
15-
}
16-
17-
public ServiceStack_UserAuth_ByUserNameOrEmail()
18-
{
19-
Map = users => from user in users
20-
select new Result
21-
{
22-
UserName = user.UserName,
23-
Email = user.Email,
24-
Search = new[] { user.UserName, user.Email }
25-
};
26-
27-
Index(x => x.Search, FieldIndexing.Analyzed);
28-
}
29-
}
30-
}
1+
using System.Linq;
2+
using Raven.Abstractions.Indexing;
3+
using Raven.Client.Indexes;
4+
using ServiceStack.ServiceInterface.Auth;
5+
6+
namespace ServiceStack.Authentication.RavenDb
7+
{
8+
public class ServiceStack_UserAuth_ByUserNameOrEmail : AbstractIndexCreationTask<UserAuth, ServiceStack_UserAuth_ByUserNameOrEmail.Result>
9+
{
10+
public class Result
11+
{
12+
public string UserName { get; set; }
13+
public string Email { get; set; }
14+
public string[] Search { get; set; }
15+
}
16+
17+
public ServiceStack_UserAuth_ByUserNameOrEmail()
18+
{
19+
Map = users => from user in users
20+
select new Result
21+
{
22+
UserName = user.UserName,
23+
Email = user.Email,
24+
Search = new[] { user.UserName, user.Email }
25+
};
26+
27+
Index(x => x.Search, FieldIndexing.Analyzed);
28+
}
29+
}
30+
}

src/ServiceStack.Authentication.Raven/packages.config renamed to src/ServiceStack.Authentication.RavenDb/packages.config

File renamed without changes.

src/ServiceStack.Contrib.sln

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{21E2FAC5
1212
..\NuGet\NuGetPack.cmd = ..\NuGet\NuGetPack.cmd
1313
..\NuGet\ServiceStack.Authentication.MongoDB\servicestack.authentication.mongodb.nuspec = ..\NuGet\ServiceStack.Authentication.MongoDB\servicestack.authentication.mongodb.nuspec
1414
..\NuGet\ServiceStack.Authentication.NHibernate\servicestack.authentication.nhibernate.nuspec = ..\NuGet\ServiceStack.Authentication.NHibernate\servicestack.authentication.nhibernate.nuspec
15+
..\NuGet\ServiceStack.Caching.AwsDynamoDb\servicestack.caching.awsdynamodb.nuspec = ..\NuGet\ServiceStack.Caching.AwsDynamoDb\servicestack.caching.awsdynamodb.nuspec
1516
..\NuGet\ServiceStack.Caching.Azure\servicestack.caching.azure.nuspec = ..\NuGet\ServiceStack.Caching.Azure\servicestack.caching.azure.nuspec
1617
..\NuGet\ServiceStack.Caching.Memcached\servicestack.caching.memcached.nuspec = ..\NuGet\ServiceStack.Caching.Memcached\servicestack.caching.memcached.nuspec
1718
EndProjectSection
@@ -28,7 +29,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceStack.CacheAccess.Aw
2829
EndProject
2930
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceStack.CacheAccess.AwsDynamoDb.Tests", "..\tests\ServiceStack.CacheAccess.AwsDynamoDb.Tests\ServiceStack.CacheAccess.AwsDynamoDb.Tests.csproj", "{27217138-EA6A-466F-83D4-A4585C921781}"
3031
EndProject
31-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceStack.Authentication.Raven", "ServiceStack.Authentication.Raven\ServiceStack.Authentication.Raven.csproj", "{A30BD5B5-00C9-4B9D-9C9D-514B4A676FF3}"
32+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceStack.Authentication.RavenDb", "ServiceStack.Authentication.RavenDb\ServiceStack.Authentication.RavenDb.csproj", "{A30BD5B5-00C9-4B9D-9C9D-514B4A676FF3}"
3233
EndProject
3334
Global
3435
GlobalSection(SolutionConfigurationPlatforms) = preSolution

0 commit comments

Comments
 (0)