This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LogOutFilterAttribute : ActionFilterAttribute | |
{ | |
public override void OnActionExecuting(ActionExecutingContext filterContext) | |
{ | |
var authenticationManager = filterContext.HttpContext.GetOwinContext().Authentication; | |
authenticationManager.SignOut(); | |
base.OnActionExecuting(filterContext); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using CommonDomain.Core; | |
using CommonDomain.Persistence.EventStore; | |
using FluentAssertions; | |
using NEventStore; | |
using Xunit; | |
public class NEventStoreRepositoryTests | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"color_scheme": "Packages/Color Scheme - Default/Sunburst.tmTheme", | |
"dictionary": "Packages/Language - English/en_GB.dic", | |
"font_face": "Source Code Pro Light", | |
"font_size": 11, | |
"highlight_line": true, | |
"highlight_modified_tabs": true, | |
"ignored_packages": | |
[ | |
"Vintage" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Data.Entity; | |
using System.Threading.Tasks; | |
using IoCIdentity.Models; | |
using Microsoft.AspNet.Identity.EntityFramework; | |
namespace IoCIdentity.Identity | |
{ | |
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>, IApplicationDbContext | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public async Task<ActionResult> DoSeed() | |
{ | |
return await InitializeIdentityForEF(db) | |
} | |
private async Task InitializeIdentityForEF(ApplicationDbContext db) | |
{ | |
var userManager = HttpContext.Current.GetOwinContext().GetUserManager<ApplicationUserManager>(); | |
var roleManager = HttpContext.Current.GetOwinContext().Get<ApplicationRoleManager>(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[TestCase("Projects Topside", "Projects Systems")] | |
[TestCase("Topside", "Systems")] | |
public void ProjectsTopsides_vs_ProjectsSystems(string one, string another) | |
{ | |
// Act | |
var fuzzyMatchValue = one.FuzzyMatch(another); | |
var diceCoefficient = one.DiceCoefficient(another); | |
var levenshteinDistance = one.LevenshteinDistance(another); | |
var lcs = one.LongestCommonSubsequence(another); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public partial class Startup | |
{ | |
private static string clientId = CloudConfigurationManager.GetSetting("ida:ClientId"); | |
private static string appKey = CloudConfigurationManager.GetSetting("ida:ClientSecret"); | |
private static string aadInstance = CloudConfigurationManager.GetSetting("ida:AADInstance"); | |
private static string tenantId = CloudConfigurationManager.GetSetting("ida:TenantId"); | |
private static string postLogoutRedirectUri = CloudConfigurationManager.GetSetting("ida:PostLogoutRedirectUri"); | |
public static readonly string Authority = aadInstance + tenantId; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Management.Instrumentation; | |
using Autofac; | |
using Autofac.Builder; | |
using Autofac.Core; | |
using Autofac.Features.ResolveAnything; | |
using Moq; | |
using MyProject.Domain.Services.Configuration; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#addin "nuget:?package=Cake.SqlServer" | |
var target = Argument("target", "Default"); | |
var configuration = Argument("configuration", "Release"); | |
Task("Testing-Database") | |
.Does(() => | |
{ | |
LocalDbCreateInstance("v12.0", LocalDbVersion.V12); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Defers the use of runtime data after object graph construction | |
// see: https://www.cuttingedge.it/blogs/steven/pivot/entry.php?id=99 | |
public sealed class AspNetPrincipalProxy : IPrincipal | |
{ | |
public IIdentity Identity => User.Identity; | |
public bool IsInRole(string role) => User.IsInRole(role); | |
private IPrincipal User => HttpContext.Current.User; | |
} |