Skip to content

Instantly share code, notes, and snippets.

<3 code

Josh Williams jackjwilliams

<3 code
Block or report user

Report or block jackjwilliams

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View CustomPasswordHasher.cs
public class CustomPasswordHasher : IPasswordHasher
public IPasswordHasher<User> AspNetPasswordHasher { get; set; }
public byte Version => throw new NotImplementedException();
public CustomPasswordHasher(IPasswordHasher<User> ph)
AspNetPasswordHasher = ph;
jackjwilliams / Startup.cs
Last active Nov 18, 2017
Startup.cs - Configure
View Startup.cs
namespace Test
public class Startup
// 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
public void ConfigureServices(IServiceCollection services)
jackjwilliams / User.cs
Created Nov 18, 2017
AspNetUser : IUserAuth
View User.cs
public class User : IUserAuth
public string Email { get; set; }
public bool EmailConfirmed { get; set; } = false;
public string PasswordHash { get; set; }
jackjwilliams / CustomAuthProvider.cs
Last active Oct 9, 2019
ServiceStack Custom Auth Provider
View CustomAuthProvider.cs
public class CustomAuthProvider : CredentialsAuthProvider
public override IHttpResult OnAuthenticated(IServiceBase authService, IAuthSession session, IAuthTokens tokens, Dictionary<string, string> authInfo)
var dbFactory = authService.ResolveService<IDbConnectionFactory>();
using (var db = dbFactory.Open())
var user = db.LoadSelect<User>(x => x.Email.ToLower() == session.UserAuthName.ToLower()).FirstOrDefault();
View CustomAuthRepository.cs
public class CustomAuthRepository : OrmLiteAuthRepository<AspNetUser, UserAuthDetails>
public CustomAuthRepository(IDbConnectionFactory dbFactory, string namedConnnection = null) : base(dbFactory, namedConnnection)
public override void AssignRoles(string userAuthId, ICollection<string> roles = null, ICollection<string> permissions = null)
var userAuth = GetUserAuth(userAuthId) as User;
jackjwilliams / S0002-AuthUserUpdates
Last active Nov 11, 2017
Migration from ASP.NET Identity 2 to Service Stack
View S0002-AuthUserUpdates
[PrimaryEmail] nvarchar(max) NULL,
[DisplayName] nvarchar(max) NULL,
[Company] nvarchar(max) NULL,
[Birthdate] datetime NULL,
[BirthdateRaw] nvarchar(max) NULL,
[Address] nvarchar(max) NULL,
[Address2] nvarchar(max) NULL,
[City] nvarchar(max) NULL,
View MenuLinkTagHelper.cs
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.AspNetCore.Mvc.TagHelpers;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
You can’t perform that action at this time.