Skip to content

Instantly share code, notes, and snippets.

View sandrinodimattia's full-sized avatar
🏠
Working from home

Sandrino Di Mattia sandrinodimattia

🏠
Working from home
View GitHub Profile
@sandrinodimattia
sandrinodimattia / gist:3147367
Created July 19, 2012 22:41
Allowing Anonymous
<system.web>
<authorization>
<deny users="?" />
</authorization>
...
</system.web>
public class CustomerController : Controller
{
[Authorize]
public ActionResult Index()
{
return View();
}
}
@sandrinodimattia
sandrinodimattia / gist:3147376
Created July 19, 2012 22:42
Realm Configuration
<microsoft.identityModel>
<service>
<audienceUris>
<add value="http://localhost:5100/" />
</audienceUris>
<federatedAuthentication>
<wsFederation passiveRedirectEnabled="true" issuer="https://....accesscontrol.windows.net/v2/wsfederation" realm="http://localhost:5100" requireHttps="false" />
<cookieHandler requireSsl="false" />
</federatedAuthentication>
...
@sandrinodimattia
sandrinodimattia / Global.asax.cs
Created July 19, 2012 22:43
MVC Application w/ dynamic realm
public class MvcApplication : System.Web.HttpApplication
{
...
private void WSFederationAuthenticationModule_RedirectingToIdentityProvider(object sender, RedirectingToIdentityProviderEventArgs e)
{
// Get the request url.
var request = HttpContext.Current.Request;
var requestUrl = request.Url;
<audienceUris>
<add value="https://localhost:5100/" />
<add value="https://something.cloudapp.net" />
<add value="https://something.com" />
</audienceUris>
@sandrinodimattia
sandrinodimattia / gist:3147430
Created July 19, 2012 22:54
Find IdentityModel certificate
<microsoft.identityModel>
<service>
...
<serviceCertificate>
<certificateReference x509FindType="FindByThumbprint"
findValue="0FD1AC13BB1F1B19997DAD5413EA138AC47471F0" />
</serviceCertificate>
</service>
</microsoft.identityModel>
@sandrinodimattia
sandrinodimattia / Global.asax.cs
Created July 19, 2012 22:55
FederatedAuthentication
protected void Application_Start()
{
...
FederatedAuthentication.ServiceConfigurationCreated += OnServiceConfigurationCreated;
}
private void OnServiceConfigurationCreated(object sender, ServiceConfigurationCreatedEventArgs e)
{
var sessionTransforms = new List<CookieTransform>(new CookieTransform[]
{
@sandrinodimattia
sandrinodimattia / gist:3153037
Created July 20, 2012 20:28
LogMeIn Startup Task
Startup\logmein.msi /quiet USERPASSWORD=myLogMeInPassword USERVERIFYPWD=myLogMeInPassword [email protected] USERWEBPASSWORD=myLogMeInPassword LicenseType=pro
@sandrinodimattia
sandrinodimattia / gist:3153060
Created July 20, 2012 20:31
LogMeIn Startup Taks in ServiceDefinition file
<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="MyRole" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition">
<WebRole name="WebRole" vmsize="ExtraSmall">
...
<Startup>
<Task commandLine="Startup\LogMeIn.cmd" executionContext="elevated" taskType="simple" />
</Startup>
</WebRole>
</ServiceDefinition>
@sandrinodimattia
sandrinodimattia / gist:3153566
Created July 20, 2012 22:01
e-contract Claims
schemas.xmlsoap.org/ws/2005/05/identity/claims/name
schemas.microsoft.com/ws/2008/06/identity/claims/role
schemas.xmlsoap.org/ws/2005/05/identity/claims/surname
schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname
schemas.xmlsoap.org/ws/2005/05/identity/claims/privatepersonalidentifier
schemas.xmlsoap.org/ws/2005/05/identity/claims/streetaddress
schemas.xmlsoap.org/ws/2005/05/identity/claims/locality
schemas.xmlsoap.org/ws/2005/05/identity/claims/postalcode
schemas.xmlsoap.org/ws/2005/05/identity/claims/gender
schemas.xmlsoap.org/ws/2005/05/identity/claims/dateofbirth