Skip to content

Instantly share code, notes, and snippets.

View woloski's full-sized avatar

Matias Woloski woloski

View GitHub Profile
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Runtime.Serialization.Json;
using System.Text;
using System.Web;
using System.Linq;
using DotNetOpenAuth.AspNet;
using DotNetOpenAuth.AspNet.Clients;
@woloski
woloski / HttpDomainRoute.cs
Created September 22, 2012 13:07
HttpDomainRoute
public class HttpDomainRoute
: HttpRoute
{
private Regex domainRegex;
private Regex pathRegex;
public HttpDomainRoute(string domain, string routeTemplate, HttpRouteValueDictionary defaults, HttpRouteValueDictionary constraints)
: base(routeTemplate, defaults, constraints)
{
this.Domain = domain;
@woloski
woloski / gist:3145640
Created July 19, 2012 17:52
link account jabbr
private void LinkAccount(IJabbrRepository repository, IChatService chatService, HttpContext context, string userIdentity, string username, string email)
{
// Try to get the user by identity
ChatUser user = repository.GetUserByIdentity(userIdentity);
// No user with this identity
if (user == null)
{
// See if the user is already logged in (via cookie)
@woloski
woloski / issue.md
Created July 11, 2012 15:33
issue with jabbr and bootrapper pre appstart

I am implementing WIF support for federated auth in Jabbr and I am registering WIF http modules on PreAppStart. The thing is that I need to get access to some config items via IApplicationSettings and to get access to that I need the container. So we had to move Bootstrapper to use PreAppStart instead of post. But after moving Bootstrapper to PreAppStart the hubs are not getting injected, seems like the resolver didn't discovered the Chat type with its ctor.

[MissingMethodException: No parameterless constructor defined for this object.]
   System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0
   System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache) +98
   System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache) +241
   System.Activator.Creat
@woloski
woloski / ws-fed
Created July 11, 2012 03:20
ws-fed
https://{identityprovider-url}?
wa=wsignin1.0 -- signin verb. This is fixed.
wtrealm={your-application-identifier} -- logical identifier of your application.
wctx={context-information} -- [optional] contextual information that you want to keep around (e.g.: wctx=ru=/home/some-deep-link this would the original url the user was navigating to)
whr={identity-provider-identifier} -- [optional] hint the idp to use a specific identity provider (e.g.: whr=urn:Google)
@woloski
woloski / gist:3068606
Created July 7, 2012 23:46
error resgen
remote: D:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1
835,9): error MSB3091: Task failed because "resgen.exe" was not found, or the co
rrect Microsoft Windows SDK is not installed. The task is looking for "resgen.ex
e" in the "bin" subdirectory beneath the location specified in the InstallationF
older value of the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft
SDKs\Windows\v7.0A. You may be able to solve the problem by doing one of the fol
lowing: 1) Install the Microsoft Windows SDK. 2) Install Visual Studio 2010.
3) Manually set the above registry key to the correct location. 4) Pass the cor
rect location into the "ToolPath" parameter of the task. [C:\DWASFiles\Sites\aut
hbridge\VirtualDirectory0\site\repository\src\ClaimsPolicyEngine\ClaimsPolicyEng
@woloski
woloski / Usage.md
Created July 7, 2012 15:18
Create a self signed certificate on Windows
@woloski
woloski / Global.asax.cs
Created June 21, 2012 19:28
WIF disabling encryption and signature on cookies
protected void Application_Start()
{
FederatedAuthentication.ServiceConfigurationCreated += OnServiceConfigurationCreated;
}
void OnServiceConfigurationCreated(object sender,
ServiceConfigurationCreatedEventArgs e)
{
List<CookieTransform> sessionTransforms =
@woloski
woloski / BasicIdea.cs
Created April 25, 2012 15:51
Fire and forget with TPL and retry on ASP.NET
Task.Factory.StartNew((state) =>
{
try
{
// use http://nuget.org/packages/TransientFaultHandling.Core
// the defaultfixed strategy retries 10 times every 1 second
RetryPolicy.DefaultFixed.ExecuteAction(() =>
{
// do something that might throw an exception like calling an http endpoint
});
@woloski
woloski / Console Output
Created April 12, 2012 20:57
ADFS Audit Event Collector
This would be the console output
Claims for: https://myadfs/ (Correlation: 84b46102-3ed2-4ff2-88ac-eace0709667c)
http://schemas.microsoft.com/ws/2008/06/identity/claims/organization : myadfs
http://schemas.microsoft.com/ws/2008/06/identity/claims/authenticationinstant : 2012-04-12T21:15:32.410Z
http://schemas.microsoft.com/ws/2008/06/identity/claims/authenticationmethod : http://schemas.microsoft.com/ws/20
enticationmethod/windows
http://schemas.microsoft.com/ws/2008/06/identity/claims/primarygroupsid : S-1-5-21-1409732942-2814574796-20323036
http://schemas.microsoft.com/ws/2008/06/identity/claims/groupsid : S-1-5-21-1409732942-2814574796-203230364-513
http://schemas.microsoft.com/ws/2008/06/identity/claims/groupsid : S-1-1-0