Skip to content
Permalink
Browse files

sync refactor

  • Loading branch information...
mythz committed May 24, 2019
1 parent b6a8881 commit 9a4a29734576891d896d6aba108dcf122c845e77
Showing with 1,409 additions and 227 deletions.
  1. +1 −1 MyApp.ServiceInterface/MyServices.cs
  2. +46 −0 MyApp/Configure.Auth.cs
  3. +30 −0 MyApp/Configure.AuthRepository.cs
  4. +2 −2 MyApp/Properties/launchSettings.json
  5. +10 −5 MyApp/Startup.cs
  6. +5 −15 MyApp/appsettings.Development.json
  7. +8 −1 MyApp/appsettings.json
  8. +42 −30 MyApp/npm-shrinkwrap.json
  9. +6 −7 MyApp/package.json
  10. +7 −2 MyApp/public/index.html
  11. +16 −23 MyApp/src/App.vue
  12. BIN MyApp/src/assets/img/logo.png
  13. +2 −0 MyApp/src/assets/img/logo.svg
  14. +12 −0 MyApp/src/components/About.vue
  15. +12 −0 MyApp/src/components/Admin/index.vue
  16. +6 −5 MyApp/src/{home/Home.vue → components/Home/HelloApi.vue}
  17. +40 −0 MyApp/src/components/Home/index.vue
  18. +12 −0 MyApp/src/components/Profile.vue
  19. +82 −0 MyApp/src/components/SignIn.vue
  20. +12 −0 MyApp/src/components/SignUp.vue
  21. +74 −0 MyApp/src/controls/core.ts
  22. +33 −0 MyApp/src/controls/form/CheckBox.vue
  23. +16 −0 MyApp/src/controls/form/ErrorSummary.vue
  24. +84 −0 MyApp/src/controls/form/Input.vue
  25. +56 −0 MyApp/src/controls/form/Select.vue
  26. +52 −0 MyApp/src/controls/index.ts
  27. +24 −0 MyApp/src/controls/nav/Forbidden.vue
  28. +20 −0 MyApp/src/controls/nav/Link.vue
  29. +48 −0 MyApp/src/controls/nav/LinkButton.vue
  30. +20 −0 MyApp/src/controls/nav/Nav.vue
  31. +68 −0 MyApp/src/controls/nav/NavLink.vue
  32. +20 −0 MyApp/src/controls/nav/Navbar.vue
  33. +13 −0 MyApp/src/controls/ui/SvgClass.vue
  34. +41 −0 MyApp/src/controls/ui/SvgImage.vue
  35. +0 −42 MyApp/src/dtos.ts
  36. +3 −0 MyApp/src/global.d.ts
  37. +3 −2 MyApp/src/main.ts
  38. +0 −21 MyApp/src/router.ts
  39. +0 −6 MyApp/src/shared.ts
  40. +359 −0 MyApp/src/shared/dtos.ts
  41. +68 −0 MyApp/src/shared/index.ts
  42. +49 −0 MyApp/src/shared/router.ts
  43. +0 −24 MyApp/src/view1/View1.vue
  44. +0 −15 MyApp/src/view2/View2.vue
  45. +0 −5 MyApp/src/views/About.vue
  46. +0 −18 MyApp/src/views/Home.vue
  47. +5 −1 MyApp/tslint.json
  48. +2 −1 MyApp/vue.config.js
  49. +0 −1 MyApp/wwwroot/index.html
@@ -19,7 +19,7 @@ public class MyServices : Service
{
//Return index.html for unmatched requests so routing is handled on client
public object Any(FallbackForClientRoutes request) =>
new PageResult(Request.GetPage("/"));
Request.GetPageResult("/");

public object Any(Hello request)
{
@@ -0,0 +1,46 @@
using System.Collections.Generic;
using Funq;
using ServiceStack;
using ServiceStack.Auth;
using ServiceStack.Caching;
using ServiceStack.Configuration;
using ServiceStack.FluentValidation;

namespace MyApp
{
[Priority(-2)] // Run before ConfigureAuthRepository
public class ConfigureAuth : IConfigureAppHost
{
public void Configure(IAppHost appHost)
{
var AppSettings = appHost.AppSettings;
appHost.Plugins.Add(new AuthFeature(() => new CustomUserSession(),
new IAuthProvider[] {
new CredentialsAuthProvider(), //Enable UserName/Password Credentials Auth
}));

appHost.Plugins.Add(new RegistrationFeature()); //Enable /register Service

//override the default registration validation with your own custom implementation
appHost.RegisterAs<CustomRegistrationValidator, IValidator<Register>>();

//appHost.Register<ICacheClient>(new MemoryCacheClient()); //Store User Sessions in Memory Cache (default)
}
}

// Type class to store additional metadata in Users Session
public class CustomUserSession : AuthUserSession {}

// Custom Validator to add custom validators to built-in /register Service requiring DisplayName and ConfirmPassword
public class CustomRegistrationValidator : RegistrationValidator
{
public CustomRegistrationValidator()
{
RuleSet(ApplyTo.Post, () =>
{
RuleFor(x => x.DisplayName).NotEmpty();
RuleFor(x => x.ConfirmPassword).NotEmpty();
});
}
}
}
@@ -0,0 +1,30 @@
using System.Collections.Generic;
using ServiceStack;
using ServiceStack.Auth;
using ServiceStack.Configuration;

namespace MyApp
{
[Priority(-1)] // Run before AppHost.Configure()
public class ConfigureAuthRepository : IConfigureAppHost
{
public void Configure(IAppHost appHost)
{
appHost.Register<IAuthRepository>(new InMemoryAuthRepository()); //Store Authenticated Users in Memory

CreateUser(appHost, "admin@email.com", "Admin User", "p@55wOrd", roles:new[]{ RoleNames.Admin });
}

// Add initial Users to the configured Auth Repository
public void CreateUser(IAppHost appHost, string email, string name, string password, string[] roles)
{
var authRepo = appHost.TryResolve<IAuthRepository>();
if (authRepo.GetUserAuthByUserName(email) == null)
{
var newAdmin = new UserAuth { Email = email, DisplayName = name };
var user = authRepo.CreateUserAuth(newAdmin, password);
authRepo.AssignRoles(user, roles);
}
}
}
}
@@ -3,7 +3,7 @@
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:5000/;https://localhost:5001/",
"applicationUrl": "https://localhost:5001/",
"sslPort": 0
}
},
@@ -21,7 +21,7 @@
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:5000/;https://localhost:5001/"
"applicationUrl": "https://localhost:5001/"
}
}
}
@@ -8,17 +8,22 @@
using ServiceStack;
using ServiceStack.Configuration;
using MyApp.ServiceInterface;
using ServiceStack.Script;
using ServiceStack.Web;
using System;
using ServiceStack.Text;
using ServiceStack.Logging;

namespace MyApp
{
public class Startup
public class Startup : ModularStartup
{
public IConfiguration Configuration { get; }
public Startup(IConfiguration configuration) => Configuration = configuration;
public Startup(IConfiguration configuration)
: base(configuration, typeof(MyServices).Assembly) {}

// This method gets called by the runtime. Use this method to add services to the container.
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)
public new void ConfigureServices(IServiceCollection services)
{
}

@@ -49,7 +54,7 @@ public override void Configure(Container container)
SetConfig(new HostConfig
{
AddRedirectParamsToQueryString = true,
DebugMode = AppSettings.Get(nameof(HostConfig.DebugMode), false)
DebugMode = AppSettings.Get(nameof(HostConfig.DebugMode), HostingEnvironment.IsDevelopment()),
});
}
}
@@ -1,20 +1,10 @@
{
{
"DebugMode": true,
"Logging": {
"IncludeScopes": false,
"Debug": {
"LogLevel": {
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
}
},
"Console": {
"LogLevel": {
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
}
"LogLevel": {
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
}
}
}
@@ -11,5 +11,12 @@
"Default": "Warning"
}
}
}
},
"NavItems": [
{ "href":"/", "label": "Home", "exact":true },
{ "href":"/about", "label": "About" },
{ "href":"/signin", "label": "Sign In", "hide":"auth" },
{ "href":"/profile", "label": "Profile", "show":"auth" },
{ "href":"/admin", "label": "Admin", "show":"role:Admin" }
]
}

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

@@ -6,7 +6,7 @@
"postinstall": "npm run build",
"dev": "vue-cli-service build --watch",
"serve": "vue-cli-service serve",
"dtos": "cd src && typescript-ref",
"dtos": "typescript-ref",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint",
"publish": "vue-cli-service build && dotnet publish -c Release",
@@ -15,25 +15,24 @@
"e2e": "vue-cli-service test:e2e"
},
"dependencies": {
"@servicestack/client": "^1.0.20",
"@servicestack/client": "^1.0.23",
"bootstrap": "^4.3.1",
"es6-shim": "^0.35.5",
"font-awesome": "^4.7.0",
"vue": "^2.6.10",
"vue-class-component": "^7.0.2",
"vue-property-decorator": "^8.1.0",
"vue-class-component": "^7.1.0",
"vue-property-decorator": "^8.1.1",
"vue-router": "^3.0.6"
},
"devDependencies": {
"@types/jest": "^24.0.11",
"@types/jest": "^24.0.13",
"@vue/cli-plugin-babel": "^3.7.0",
"@vue/cli-plugin-e2e-cypress": "^3.7.0",
"@vue/cli-plugin-typescript": "^3.7.0",
"@vue/cli-plugin-unit-jest": "^3.7.0",
"@vue/cli-service": "^3.7.0",
"@vue/test-utils": "^1.0.0-beta.28",
"babel-core": "7.0.0-bridge.0",
"gulp": "^4.0.1",
"gulp": "^4.0.2",
"node-sass": "^4.12.0",
"sass-loader": "^7.1.0",
"ts-jest": "^24.0.2",

0 comments on commit 9a4a297

Please sign in to comment.
You can’t perform that action at this time.