Permalink
Browse files

Added Auth Integration tests + fixes

  • Loading branch information...
1 parent 38332a9 commit 0fe8e965d660c249196882dcdc81c6fb98ebe80c @mythz mythz committed Jan 16, 2012
Showing with 7,035 additions and 600 deletions.
  1. BIN NuGet/ServiceStack.Common/lib/ServiceStack.Common.dll
  2. +381 −65 NuGet/ServiceStack.Common/lib/ServiceStack.Common.xml
  3. BIN NuGet/ServiceStack.Common/lib/ServiceStack.Interfaces.dll
  4. +154 −1 NuGet/ServiceStack.Common/lib/ServiceStack.Interfaces.xml
  5. +1 −1 NuGet/ServiceStack.Common/servicestack.common.nuspec
  6. +78 −0 NuGet/ServiceStack.Host.AspNet/content/App_Start/PageBase.cs.pp
  7. +41 −0 NuGet/ServiceStack.Host.AspNet/content/App_Start/ServiceStackFramework.cs.pp
  8. +1 −1 NuGet/ServiceStack.Host.AspNet/servicestack.host.aspnet.nuspec
  9. +41 −6 NuGet/ServiceStack.Host.Mvc/content/App_Start/ControllerBase.cs.pp
  10. +45 −4 NuGet/ServiceStack.Host.Mvc/content/App_Start/ServiceStackFramework.cs.pp
  11. +1 −1 NuGet/ServiceStack.Host.Mvc/servicestack.host.mvc.nuspec
  12. BIN NuGet/ServiceStack/lib/ServiceStack.RazorEngine.dll
  13. +11 −0 NuGet/ServiceStack/lib/ServiceStack.RazorEngine.dll.config
  14. BIN NuGet/ServiceStack/lib/ServiceStack.ServiceInterface.dll
  15. +2,363 −394 NuGet/ServiceStack/lib/ServiceStack.XML
  16. BIN NuGet/ServiceStack/lib/ServiceStack.dll
  17. +1 −1 NuGet/ServiceStack/servicestack.nuspec
  18. +1 −1 build/build.bat
  19. BIN lib/ServiceStack.OrmLite.Sqlite.dll
  20. BIN lib/ServiceStack.OrmLite.dll
  21. BIN lib/ServiceStack.OrmLite.pdb
  22. +11 −1 lib/ServiceStack.Text.XML
  23. BIN lib/ServiceStack.Text.dll
  24. BIN lib/tests/ServiceStack.Common.dll
  25. BIN lib/tests/ServiceStack.Interfaces.dll
  26. BIN lib/tests/ServiceStack.OrmLite.SqlServer.dll
  27. BIN lib/tests/ServiceStack.OrmLite.Sqlite.dll
  28. BIN lib/tests/ServiceStack.OrmLite.Sqlite.pdb
  29. BIN lib/tests/ServiceStack.OrmLite.dll
  30. BIN lib/tests/ServiceStack.OrmLite.pdb
  31. BIN lib/tests/ServiceStack.Redis.dll
  32. BIN lib/tests/ServiceStack.Redis.pdb
  33. BIN lib/tests/ServiceStack.Text.dll
  34. +26 −0 lib/tests/ServiceStack.Text.xml
  35. BIN release/latest/ServiceStack.OrmLite/ServiceStack.Common.dll
  36. BIN release/latest/ServiceStack.OrmLite/ServiceStack.Common.pdb
  37. BIN release/latest/ServiceStack.OrmLite/ServiceStack.Interfaces.dll
  38. BIN release/latest/ServiceStack.OrmLite/ServiceStack.OrmLite.SqlServer.dll
  39. BIN release/latest/ServiceStack.OrmLite/ServiceStack.OrmLite.SqlServer.pdb
  40. BIN release/latest/ServiceStack.OrmLite/ServiceStack.OrmLite.dll
  41. BIN release/latest/ServiceStack.OrmLite/ServiceStack.OrmLite.pdb
  42. BIN release/latest/ServiceStack.OrmLite/ServiceStack.Text.dll
  43. BIN release/latest/ServiceStack.OrmLite/ServiceStack.Text.pdb
  44. BIN release/latest/ServiceStack.OrmLite/x32/ServiceStack.OrmLite.SqliteNET.dll
  45. BIN release/latest/ServiceStack.OrmLite/x32/ServiceStack.OrmLite.SqliteNET.pdb
  46. BIN release/latest/ServiceStack.OrmLite/x64/ServiceStack.OrmLite.SqliteNET.dll
  47. BIN release/latest/ServiceStack.OrmLite/x64/ServiceStack.OrmLite.SqliteNET.pdb
  48. BIN release/latest/ServiceStack.Redis/ServiceStack.Redis.dll
  49. +6 −0 src/ServiceStack.Interfaces/CacheAccess/ISessionFactory.cs
  50. +46 −29 src/ServiceStack.ServiceInterface/Auth/AuthProvider.cs
  51. +34 −26 src/ServiceStack.ServiceInterface/Auth/AuthService.cs
  52. +5 −9 src/ServiceStack.ServiceInterface/Auth/AuthUserSession.cs
  53. +5 −10 src/ServiceStack.ServiceInterface/Auth/CredentialsAuthProvider.cs
  54. +1 −0 src/ServiceStack.ServiceInterface/Auth/FacebookAuthConfig.cs
  55. +7 −3 src/ServiceStack.ServiceInterface/Auth/IAuthProvider.cs
  56. +2 −1 src/ServiceStack.ServiceInterface/Auth/IAuthSession.cs
  57. +1 −0 src/ServiceStack.ServiceInterface/Auth/OrmLiteAuthRepository.cs
  58. +2 −1 src/ServiceStack.ServiceInterface/Auth/UserAuth.cs
  59. +1 −1 src/ServiceStack.ServiceInterface/AuthFeature.cs
  60. +3 −3 src/ServiceStack.ServiceInterface/ServiceExtensions.cs
  61. +12 −1 src/ServiceStack.ServiceInterface/SessionFactory.cs
  62. +75 −1 src/ServiceStack.ServiceInterface/SessionFeature.cs
  63. +1 −1 src/ServiceStack/Properties/AssemblyInfo.cs
  64. +3 −0 src/ServiceStack/WebHost.EndPoints/Extensions/HttpListenerRequestWrapper.cs
  65. +1 −1 src/ServiceStack/WebHost.EndPoints/Extensions/HttpListenerResponseWrapper.cs
  66. +5 −0 src/ServiceStack/WebHost.EndPoints/Extensions/HttpRequestWrapper.cs
  67. +2,448 −0 tests/ServiceStack.WebHost.IntegrationTests/Content/bootstrap.css
  68. +30 −0 tests/ServiceStack.WebHost.IntegrationTests/Content/default.css
  69. BIN tests/ServiceStack.WebHost.IntegrationTests/Content/img/bootstrap-apple-114x114.png
  70. BIN tests/ServiceStack.WebHost.IntegrationTests/Content/img/bootstrap-apple-57x57.png
  71. BIN tests/ServiceStack.WebHost.IntegrationTests/Content/img/bootstrap-apple-72x72.png
  72. BIN tests/ServiceStack.WebHost.IntegrationTests/Content/img/favicon.ico
  73. BIN tests/ServiceStack.WebHost.IntegrationTests/Content/img/sign-in-with-facebook.png
  74. BIN tests/ServiceStack.WebHost.IntegrationTests/Content/img/sign-in-with-twitter-l.png
  75. BIN tests/ServiceStack.WebHost.IntegrationTests/Content/img/ui-bg_flat_0_aaaaaa_40x100.png
  76. BIN tests/ServiceStack.WebHost.IntegrationTests/Content/img/ui-bg_flat_75_ffffff_40x100.png
  77. BIN tests/ServiceStack.WebHost.IntegrationTests/Content/img/ui-bg_glass_55_fbf9ee_1x400.png
  78. BIN tests/ServiceStack.WebHost.IntegrationTests/Content/img/ui-bg_glass_65_ffffff_1x400.png
  79. BIN tests/ServiceStack.WebHost.IntegrationTests/Content/img/ui-bg_glass_75_dadada_1x400.png
  80. BIN tests/ServiceStack.WebHost.IntegrationTests/Content/img/ui-bg_glass_75_e6e6e6_1x400.png
  81. BIN tests/ServiceStack.WebHost.IntegrationTests/Content/img/ui-bg_glass_95_fef1ec_1x400.png
  82. BIN tests/ServiceStack.WebHost.IntegrationTests/Content/img/ui-bg_highlight-soft_75_cccccc_1x100.png
  83. BIN tests/ServiceStack.WebHost.IntegrationTests/Content/img/ui-icons_222222_256x240.png
  84. BIN tests/ServiceStack.WebHost.IntegrationTests/Content/img/ui-icons_2e83ff_256x240.png
  85. BIN tests/ServiceStack.WebHost.IntegrationTests/Content/img/ui-icons_454545_256x240.png
  86. BIN tests/ServiceStack.WebHost.IntegrationTests/Content/img/ui-icons_888888_256x240.png
  87. BIN tests/ServiceStack.WebHost.IntegrationTests/Content/img/ui-icons_cd0a0a_256x240.png
  88. +4 −0 tests/ServiceStack.WebHost.IntegrationTests/Content/js/_blank.js
  89. +159 −0 tests/ServiceStack.WebHost.IntegrationTests/Content/js/app.js
  90. +33 −0 tests/ServiceStack.WebHost.IntegrationTests/Content/js/backbone.min.js
  91. +116 −0 tests/ServiceStack.WebHost.IntegrationTests/Content/js/base.js
  92. +4 −0 tests/ServiceStack.WebHost.IntegrationTests/Content/js/jquery-1.7.1.min.js
  93. +149 −0 tests/ServiceStack.WebHost.IntegrationTests/Content/js/jsonreport.js
  94. +84 −0 tests/ServiceStack.WebHost.IntegrationTests/Content/js/login.js
  95. +71 −0 tests/ServiceStack.WebHost.IntegrationTests/Content/js/register.js
  96. +79 −0 tests/ServiceStack.WebHost.IntegrationTests/Content/js/ss-validation.js
  97. +27 −0 tests/ServiceStack.WebHost.IntegrationTests/Content/js/underscore.min.js
  98. +72 −0 tests/ServiceStack.WebHost.IntegrationTests/Content/js/userprofile.js
  99. +179 −11 tests/ServiceStack.WebHost.IntegrationTests/Default.aspx
  100. +1 −1 tests/ServiceStack.WebHost.IntegrationTests/Default.aspx.cs
  101. +15 −18 tests/ServiceStack.WebHost.IntegrationTests/Default.aspx.designer.cs
  102. +36 −0 tests/ServiceStack.WebHost.IntegrationTests/Global.asax.cs
  103. +72 −0 tests/ServiceStack.WebHost.IntegrationTests/PageBase.cs
  104. +37 −1 tests/ServiceStack.WebHost.IntegrationTests/ServiceStack.WebHost.IntegrationTests.csproj
  105. +44 −0 tests/ServiceStack.WebHost.IntegrationTests/Services/UserAuths.cs
  106. +9 −6 tests/ServiceStack.WebHost.IntegrationTests/Web.config
  107. 0 tests/ServiceStack.WebHost.IntegrationTests/{default.html → _default.html}
Binary file not shown.

Large diffs are not rendered by default.

Oops, something went wrong.
Binary file not shown.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -2,7 +2,7 @@
<package xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<id>ServiceStack.Common</id>
- <version>3.2.5</version>
+ <version>3.2.6</version>
<authors>Demis Bellot</authors>
<owners>Demis Bellot</owners>
<summary>Opensource .NET and Mono REST Web Services framework</summary>
@@ -0,0 +1,78 @@
+using System.Web.UI;
+using Funq;
+using ServiceStack.CacheAccess;
+using ServiceStack.ServiceInterface;
+using ServiceStack.ServiceInterface.Auth;
+
+
+/**
+ * Base ASP.NET WebForms page using ServiceStack's Compontents, see: http://www.servicestack.net/mvc-powerpack/
+ */
+
+namespace $rootnamespace$.App_Start
+{
+ //A customizeable typed UserSession that can be extended with your own properties
+ public class CustomUserSession : AuthUserSession
+ {
+ public string CustomPropety { get; set; }
+ }
+
+ public class PageBase : Page
+ {
+ private Container container;
+ public Container Container
+ {
+ get { return container ?? (container = Endpoints.AppHostBase.Instance.Container); }
+ }
+
+ protected string SessionKey
+ {
+ get
+ {
+ var sessionId = SessionFeature.GetSessionId();
+ return sessionId == null ? null : SessionFeature.GetSessionKey(sessionId);
+ }
+ }
+
+ private CustomUserSession userSession;
+ protected CustomUserSession UserSession
+ {
+ get
+ {
+ if (userSession != null) return userSession;
+ if (SessionKey != null)
+ userSession = this.Cache.Get<CustomUserSession>(SessionKey);
+ else
+ SessionFeature.CreateSessionIds();
+
+ var unAuthorizedSession = new CustomUserSession();
+ return userSession ?? (userSession = unAuthorizedSession);
+ }
+ }
+
+ public void ClearSession()
+ {
+ userSession = null;
+ this.Cache.Remove(SessionKey);
+ }
+
+ public new ICacheClient Cache
+ {
+ get { return Container.Resolve<ICacheClient>(); }
+ }
+
+ public ISessionFactory SessionFactory
+ {
+ get { return Container.Resolve<ISessionFactory>(); }
+ }
+
+ private ISession session;
+ public new ISession Session
+ {
+ get
+ {
+ return session ?? (session = SessionFactory.GetOrCreateSession());
+ }
+ }
+ }
+}
@@ -1,7 +1,12 @@
using System;
using System.Linq;
+using System.Configuration;
using System.Collections.Generic;
+using ServiceStack.Configuration;
+using ServiceStack.OrmLite;
+using ServiceStack.OrmLite.SqlServer;
using ServiceStack.ServiceInterface;
+using ServiceStack.ServiceInterface.Auth;
using ServiceStack.ServiceInterface.ServiceModel;
using ServiceStack.WebHost.Endpoints;
@@ -40,10 +45,46 @@
// DebugMode = true, //Show StackTraces when developing
//});
+ //Enable Authentication
+ //ConfigureAuth(container);
+
//Register all your dependencies
container.Register(new TodoRepository());
}
+ /* Uncomment to enable ServiceStack Authentication and CustomUserSession
+ private void ConfigureAuth(Funq.Container container)
+ {
+ Routes
+ .Add<Auth>("/auth")
+ .Add<Auth>("/auth/{provider}")
+ .Add<Registration>("/register");
+
+ var appSettings = new AppSettings();
+
+ AuthFeature.Init(this, () => new CustomUserSession(),
+ new IAuthProvider[] {
+ new CredentialsAuthProvider(appSettings),
+ new FacebookAuthProvider(appSettings),
+ new TwitterAuthProvider(appSettings),
+ new BasicAuthProvider(appSettings),
+ });
+
+ RegistrationFeature.Init(this);
+
+ //Requires ConnectionString configured in Web.Config
+ var connectionString = ConfigurationManager.ConnectionStrings["AppDb"].ConnectionString;
+ container.Register<IDbConnectionFactory>(c =>
+ new OrmLiteConnectionFactory(connectionString, SqlServerOrmLiteDialectProvider.Instance));
+
+ container.Register<IUserAuthRepository>(c =>
+ new OrmLiteAuthRepository(c.Resolve<IDbConnectionFactory>()));
+
+ var authRepo = (OrmLiteAuthRepository)container.Resolve<IUserAuthRepository>();
+ authRepo.CreateMissingTables();
+ }
+ */
+
public static void Start()
{
new AppHost().Init();
@@ -2,7 +2,7 @@
<package xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<id>ServiceStack.Host.AspNet</id>
- <version>3.2.2</version>
+ <version>3.2.6</version>
<authors>Demis Bellot</authors>
<owners>Demis Bellot</owners>
<summary>Opensource .NET and Mono REST Web Services framework</summary>
Oops, something went wrong.

0 comments on commit 0fe8e96

Please sign in to comment.