<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>brockallen</title>
	<atom:link href="http://brockallen.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://brockallen.com</link>
	<description>You&#039;ve got your good thing, and you&#039;ve got mine</description>
	<lastBuildDate>Mon, 17 Jun 2013 19:16:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='brockallen.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://0.gravatar.com/blavatar/ca1698a818f41196724300c662864e07?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>brockallen</title>
		<link>http://brockallen.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://brockallen.com/osd.xml" title="brockallen" />
	<atom:link rel='hub' href='http://brockallen.com/?pushpress=hub'/>
		<item>
		<title>Announcing Thinktecture AuthorizationServer</title>
		<link>http://brockallen.com/2013/06/13/announcing-thinktecture-authorizationserver/</link>
		<comments>http://brockallen.com/2013/06/13/announcing-thinktecture-authorizationserver/#comments</comments>
		<pubDate>Thu, 13 Jun 2013 17:25:06 +0000</pubDate>
		<dc:creator>brockallen</dc:creator>
				<category><![CDATA[ASP.NET]]></category>

		<guid isPermaLink="false">http://brockallen.com/2013/06/13/announcing-thinktecture-authorizationserver/</guid>
		<description><![CDATA[Reblogged from www.leastprivilege.com: Today at NDC I announced Brock's and my new open source project - Thinktecture.AuthorizationServer. AuthorizationServer (AS from now on) is an implementation of the OAuth2 patterns I described here.It has an implementation of the four OAuth2 flows and a nice UI that let's you model your applications, clients and scopes. It also [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=brockallen.com&#038;blog=23669881&#038;post=1028&#038;subd=brockallen&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<div class="reblog-post"><p class="reblog-from"><img alt='' src='http://1.gravatar.com/avatar/75681814fbbb90c9224ea5ed0f8324ee?s=25&amp;d=identicon&amp;r=G' class='avatar avatar-25' height='25' width='25' /> <a href="http://leastprivilege.com/2013/06/13/announcing-thinktecture-authorizationserver/">Reblogged from www.leastprivilege.com:</a></p><div class="wpcom-enhanced-excerpt"><div class="wpcom-enhanced-excerpt-content">
<p>Today at <a href="http://www.ndcoslo.com/">NDC</a> I announced <a href="http://brockallen.com/">Brock's</a> and my new open source project - <strong>Thinktecture.AuthorizationServer</strong>.</p>
<p>AuthorizationServer (AS from now on) is an implementation of the OAuth2 patterns I described <a href="http://leastprivilege.com/2013/06/12/oauth2-done-right/">here</a>.It has an implementation of the four OAuth2 flows and a nice UI that let's you model your applications, clients and scopes. It also includes samples that you can go through to see what it does.</p>
</div> <p class="read-more"><a href="http://leastprivilege.com/2013/06/13/announcing-thinktecture-authorizationserver/" target="_self"><span>Read more&hellip;</span> 76 more words</a></p></div></div> ]]></content:encoded>
			<wfw:commentRss>http://brockallen.com/2013/06/13/announcing-thinktecture-authorizationserver/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/f17c1816a6f9bff29a515c75b950460a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">brockallen</media:title>
		</media:content>
	</item>
		<item>
		<title>Configuration for WIF session helper APIs in Thinktecture IdentityModel</title>
		<link>http://brockallen.com/2013/05/28/configuration-for-wif-session-helper-apis-in-thinktecture-identitymodel/</link>
		<comments>http://brockallen.com/2013/05/28/configuration-for-wif-session-helper-apis-in-thinktecture-identitymodel/#comments</comments>
		<pubDate>Tue, 28 May 2013 17:40:33 +0000</pubDate>
		<dc:creator>brockallen</dc:creator>
				<category><![CDATA[IdentityModel]]></category>

		<guid isPermaLink="false">http://brockallen.com/?p=1022</guid>
		<description><![CDATA[I just added a custom configuration section in Thinktecture IdentityModel that will automatically drive the various SAM and FAM helper functions I added a while ago. The configuration looks something like this: &#60;configuration&#62;   &#60;configSections&#62;     &#60;section name="securitySessionConfiguration" type="Thinktecture.IdentityModel.Web.Configuration.SecuritySessionSection, Thinktecture.IdentityModel"/&#62;   &#60;/configSections&#62;   &#60;securitySessionConfiguration     sessionTokenCacheType="WebRP.EF.EFTokenCacheRepository, WebRP"     useMackineKeyProtectionForSessionTokens="true"     defaultSessionDuration="01:00:00"     persistentSessionDuration="01:00:00:00"     cacheSessionsOnServer="true" [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=brockallen.com&#038;blog=23669881&#038;post=1022&#038;subd=brockallen&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>I just added a custom configuration section in Thinktecture <a href="http://thinktecture.github.io/Thinktecture.IdentityModel.45/">IdentityModel</a> that will automatically drive the <a href="http://brockallen.com/2013/02/12/wif-session-helper-apis-for-passive-applications-in-thinktecture-identitymodel/">various SAM and FAM helper functions</a> I added a while ago. The configuration looks something like this:</p>
<pre>&lt;configuration&gt;
  &lt;configSections&gt;
    &lt;section name="securitySessionConfiguration" 
             type="Thinktecture.IdentityModel.Web.Configuration.SecuritySessionSection, Thinktecture.IdentityModel"/&gt;
  &lt;/configSections&gt;

  &lt;securitySessionConfiguration
    sessionTokenCacheType="WebRP.EF.EFTokenCacheRepository, WebRP"
    useMackineKeyProtectionForSessionTokens="true"
    defaultSessionDuration="01:00:00"
    persistentSessionDuration="01:00:00:00"
    cacheSessionsOnServer="true"
    enableSlidingSessionExpirations="true"
    overrideWSFedTokenLifetime="true"
    suppressLoginRedirectsForApiCalls="true"
    suppressSecurityTokenExceptions="true"
  /&gt;
&lt;/configuration&gt;</pre>
<p>With this in place you no longer need to explicitly invoke the various <em>PassiveSessionConfiguration</em> or <em>PassiveModuleConfiguration</em> APIs from <em>global.asax</em>. Also, each of these attributes is optional so you only need to specify the ones you care about.</p>
<p>HTH</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/brockallen.wordpress.com/1022/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/brockallen.wordpress.com/1022/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=brockallen.com&#038;blog=23669881&#038;post=1022&#038;subd=brockallen&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://brockallen.com/2013/05/28/configuration-for-wif-session-helper-apis-in-thinktecture-identitymodel/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/f17c1816a6f9bff29a515c75b950460a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">brockallen</media:title>
		</media:content>
	</item>
		<item>
		<title>Demos &#8212; 6th Annual Hartford Code Camp 2013</title>
		<link>http://brockallen.com/2013/05/18/demos-6th-annual-hartford-code-camp-2013/</link>
		<comments>http://brockallen.com/2013/05/18/demos-6th-annual-hartford-code-camp-2013/#comments</comments>
		<pubDate>Sun, 19 May 2013 00:09:29 +0000</pubDate>
		<dc:creator>brockallen</dc:creator>
				<category><![CDATA[Speaking]]></category>

		<guid isPermaLink="false">http://brockallen.com/?p=1013</guid>
		<description><![CDATA[Demos and slides for my sessions are here. Links for topics I mentioned: DevelopMentor classroom training DevelopMentor online training Thinktecture IdentityModel security library Thinktecture IdentityServer Identity Provider/STS Thanks for coming.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=brockallen.com&#038;blog=23669881&#038;post=1013&#038;subd=brockallen&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Demos and slides for my sessions are <a href="http://sdrv.ms/12KtRw8">here</a>.</p>
<p>Links for topics I mentioned:</p>
<ul>
<li><a href="http://www.develop.com/">DevelopMentor classroom training</a></li>
<li><a href="http://learninglineapp.com/">DevelopMentor online training</a></li>
<li><a href="https://github.com/thinktecture/Thinktecture.IdentityModel.45/">Thinktecture IdentityModel security library</a></li>
<li><a href="https://github.com/thinktecture/Thinktecture.IdentityServer.v2/">Thinktecture IdentityServer Identity Provider/STS</a></li>
</ul>
<p>Thanks for coming.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/brockallen.wordpress.com/1013/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/brockallen.wordpress.com/1013/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=brockallen.com&#038;blog=23669881&#038;post=1013&#038;subd=brockallen&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://brockallen.com/2013/05/18/demos-6th-annual-hartford-code-camp-2013/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/f17c1816a6f9bff29a515c75b950460a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">brockallen</media:title>
		</media:content>
	</item>
		<item>
		<title>Validating inputs for PATCH requests in ASP.NET WebAPI</title>
		<link>http://brockallen.com/2013/05/10/validating-inputs-for-patch-request-in-asp-net-webapi/</link>
		<comments>http://brockallen.com/2013/05/10/validating-inputs-for-patch-request-in-asp-net-webapi/#comments</comments>
		<pubDate>Fri, 10 May 2013 15:54:48 +0000</pubDate>
		<dc:creator>brockallen</dc:creator>
				<category><![CDATA[REST / WebAPI]]></category>

		<guid isPermaLink="false">http://brockallen.com/?p=1001</guid>
		<description><![CDATA[In ASP.NET WebAPI (with its recent OData additions) there is good support for HTTP PATCH requests via the Delta&#60;T&#62; class. I won&#8217;t bother reproducing a tutorial here since there&#8217;s already a good one online. The only problem with the PATCH support and tutorial is that there is no guidance on how to validate the model [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=brockallen.com&#038;blog=23669881&#038;post=1001&#038;subd=brockallen&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>In <a href="http://www.asp.net/web-api">ASP.NET WebAPI</a> (with its recent <a href="http://www.asp.net/web-api/overview/odata-support-in-aspnet-web-api">OData additions)</a> there is good support for HTTP PATCH requests via the <em>Delta&lt;T&gt;</em> class. I won&#8217;t bother reproducing a tutorial here since there&#8217;s already a good one <a href="http://www.asp.net/web-api/overview/odata-support-in-aspnet-web-api/supporting-odata-crud-operations">online</a>.</p>
<p>The only problem with the PATCH support and tutorial is that there is no guidance on how to validate the model once you&#8217;ve accepted the partially updated data. So here&#8217;s what I came up with to validate the model once we&#8217;ve called <em>Patch</em>:</p>
<pre>public HttpResponseMessage Patch(Guid id, Delta&lt;TenantData&gt; data)
{
    var tenant = this.TenantRepository.Get(id);
    if (tenant == null) return Request.CreateResponse(HttpStatusCode.NotFound);

    data.Patch(tenant);

    // this is where we do the validation on the model after we've
    // merged in the patch values
    var svc = this.Configuration.Services;
    var validator = svc.GetBodyModelValidator();
    var ad = svc.GetActionSelector().SelectAction(this.ControllerContext);
    var ac = new HttpActionContext(this.ControllerContext, ad);
    var mp = svc.GetModelMetadataProvider();
    if (!validator.Validate(tenant, typeof(TenantData), mp, ac, "data"))
    {
        // validation failed, so return our error and pass along the 
        // ModelState from the action context (which is a different
        // instance than this.ModelState)
        return Request.CreateErrorResponse(HttpStatusCode.BadRequest, 
                                           ac.ModelState);
    }

    this.TenantRepository.SaveChanges();

    return Request.CreateResponse(HttpStatusCode.OK, tenant);
}</pre>
<p>In essence, I needed to manually trigger validation that normally happens during model binding. I wish there was a nice API built-in for this, but alas there is not.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/brockallen.wordpress.com/1001/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/brockallen.wordpress.com/1001/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=brockallen.com&#038;blog=23669881&#038;post=1001&#038;subd=brockallen&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://brockallen.com/2013/05/10/validating-inputs-for-patch-request-in-asp-net-webapi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/f17c1816a6f9bff29a515c75b950460a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">brockallen</media:title>
		</media:content>
	</item>
		<item>
		<title>6th Annual Hartford Code Camp 2013</title>
		<link>http://brockallen.com/2013/05/06/6th-annual-hartford-code-camp-2013/</link>
		<comments>http://brockallen.com/2013/05/06/6th-annual-hartford-code-camp-2013/#comments</comments>
		<pubDate>Mon, 06 May 2013 21:13:39 +0000</pubDate>
		<dc:creator>brockallen</dc:creator>
				<category><![CDATA[Speaking]]></category>

		<guid isPermaLink="false">http://brockallen.com/?p=999</guid>
		<description><![CDATA[I’ll be speaking at the 6th Annual Hartford Code Camp on May 18th, 2013. I’ll be presenting two topics: one on Claims-based Security with Windows Identity Foundation and another on Securing ASP.NET WebAPI Services. Hope to see you there! &#160;<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=brockallen.com&#038;blog=23669881&#038;post=999&#038;subd=brockallen&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>I’ll be speaking at the <a href="http://www.ctdotnet.org/code-camp-6/">6th Annual Hartford Code Camp</a> on May 18th, 2013. I’ll be presenting two topics: one on <em>Claims-based Security with Windows Identity Foundation</em> and another on <em>Securing ASP.NET WebAPI Services</em>. Hope to see you there!</p>
<p>&nbsp;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/brockallen.wordpress.com/999/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/brockallen.wordpress.com/999/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=brockallen.com&#038;blog=23669881&#038;post=999&#038;subd=brockallen&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://brockallen.com/2013/05/06/6th-annual-hartford-code-camp-2013/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/f17c1816a6f9bff29a515c75b950460a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">brockallen</media:title>
		</media:content>
	</item>
		<item>
		<title>Getting JSON web tokens (JWTs) from ADFS via Thinktecture IdentityServer&#8217;s ADFS Integration</title>
		<link>http://brockallen.com/2013/04/14/getting-json-web-tokens-jwts-from-adfs-via-thinktecture-identityservers-adfs-integration/</link>
		<comments>http://brockallen.com/2013/04/14/getting-json-web-tokens-jwts-from-adfs-via-thinktecture-identityservers-adfs-integration/#comments</comments>
		<pubDate>Sun, 14 Apr 2013 20:01:27 +0000</pubDate>
		<dc:creator>brockallen</dc:creator>
				<category><![CDATA[IdentityServer]]></category>

		<guid isPermaLink="false">http://brockallen.com/?p=983</guid>
		<description><![CDATA[Dominick and I recently added three features to IdentityServer that collectively we call &#8220;ADFS Integration&#8221;. This &#8220;ADFS Integration&#8221; is a new protocol (which can be enabled, disabled and configured like any other protocol IdentityServer supports). In short this new protocol helps obtain JWTs (indirectly) from ADFS (or really any WS-Trust enabled STS). I&#8217;ll describe the [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=brockallen.com&#038;blog=23669881&#038;post=983&#038;subd=brockallen&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p><a href="http://leastprivilege.com/">Dominick</a> and I recently added three features to <a href="http://thinktecture.github.io/Thinktecture.IdentityServer.v2/">IdentityServer</a> that collectively we call &#8220;ADFS Integration&#8221;. This &#8220;ADFS Integration&#8221; is a new protocol (which can be enabled, disabled and configured like any other protocol IdentityServer supports). In short this new protocol helps obtain JWTs (indirectly) from ADFS (or really any WS-Trust enabled STS). I&#8217;ll describe the three use cases here and how we provide a solution for each:</p>
<p><strong>Scenario #1 &#8212; Converting SAML to JWT for delegation-like use:</strong></p>
<p>Imagine you&#8217;re building a website that authenticates users by accepting SAML tokens from an ADFS STS that your app trusts (standard WS-Fed). Your app then wants to invoke a WebAPI using the end-user&#8217;s identity (a delegation-like scenario). The WebAPI trusts ADFS and wants to leverage all the features of ADFS in producing the token for the WebAPI (such as the authorization rules, claims issuance rules, etc.), but the WebAPI only wants to accept JWTs. How does your web app get a JWT from ADFS for the WebAPI?</p>
<p>If the WebAPI accepted SAML tokens, then this wouldn&#8217;t be a problem &#8212; the web app would just use WS-Trust and obtain a delegation token directly from ADFS for the WebAPI. But the main obstacle is the JWT requirement.</p>
<p><strong>Solution #1 &#8212; IdentityServer&#8217;s ADFS SAML authentication: </strong></p>
<p>IdentityServer now supports a new ADFS integration endpoint which can be used to obtain a JWT from a SAML token. For the above scenario, the web application would need to preserve the original SAML token via WIF&#8217;s &#8220;maintain bootstrap token option&#8221;. The web app would then contact the ADFS integration endpoint in IdentityServer passing the SAML token and the realm for which it requires a delegation token (this would be the realm identifier for the WebAPI). IdentityServer would then do the necessary calls to ADFS to obtain a new SAML token for the WebAPI and then IdentityServer will finally convert the SAML token into a JWT and return it to the web application. The web application can then use that as the token when invoking the WebAPI.</p>
<p>For this magic to happen, there is some configuration required in ADFS. First, IdentityServer needs to be configured as a claims provider trust. Second, the WebAPI needs to be configured as a relying party. But with those two configuration settings (and any other rules related to authorization and claims desired) you are really just using the normal features of ADFS to create the token for the WebAPI.</p>
<p>As far as implementation details, essentially IdentityServer is using the bootstrap token to create its own token for the user (as a claims provider trust). It then calls the normal WS-Trust federation endpoints to have ADFS create a token for the WebAPI RP using the token from IdentityServer as the authentication mechanism. So, this isn&#8217;t truly creating a delegation token in the sense that the delegation chain is maintained, but the token can be used like a delegation token to pass the end-user&#8217;s identity to downstream relying parties.</p>
<p>The configuration needed in IdentityServer for this solution looks as follows:</p>
<p><a href="http://brockallen.files.wordpress.com/2013/04/samlauthentication.png"><img class="aligncenter size-full wp-image-987" alt="SAMLAuthentication" src="http://brockallen.files.wordpress.com/2013/04/samlauthentication.png?w=600&#038;h=435" width="600" height="435" /></a>You need to:</p>
<ul>
<li>Enable the ADFS Integration protocol</li>
<li>Enable the SAML authentication option</li>
<li>Indicate a token lifetime</li>
<li>Disable the Pass-thru authentication token option (otherwise SAML will be returned not JWT)</li>
<li>Indicate the ADFS federation endpoint (the mixed/symmetric/basic256 WS-Trust endpoint)</li>
<li>Indicate the ADFS identifier</li>
<li>Indicate the ADFS signing certificate thumbprint</li>
<li>Indicate the ADFS encryption certificate</li>
</ul>
<p><strong>Scenario #2 &#8211;<strong>Converting JWT to JWT for delegation-like use</strong>: </strong></p>
<p>Now imagine you&#8217;re building the WebAPI application being invoked from the web app mentioned above. You&#8217;ve received a JWT that authenticates the user (and it&#8217;s audience is for your application), but you then want to invoke a second WebAPI delegating the user&#8217;s identity. We have almost the same problem as above &#8211; the second WebAPI wants ADFS to produce the token but wants it in JWT form. The only difference in this scenario is that the app has a JWT for the user and not a SAML token.</p>
<p><strong>Solution #2 &#8212; IdentityServer&#8217;s ADFS JWT authentication: </strong></p>
<p>The solution here is almost identical to the solution above. The ADFS integration endpoint can accept a SAML token (as described above) but it will also accept a JWT. So really this one endpoint solves both scenario #1 and scenario #2.</p>
<p>In IdentityServer the same configuration would be needed as above, except you would also need to enabled the &#8220;Enable JWT authentication&#8221; option.</p>
<p><strong>Scenario #3 &#8212; Obtaining JWT for AD users from a native/mobile app: </strong></p>
<p>Imagine you&#8217;re building a native mobile application (iOS, Android, etc.) for your company and it needs to invoke a WebAPI with the user&#8217;s identity. Same as above, the WebAPI want ADFS to produce the token but wants it in JWT form. These mobile platforms don&#8217;t have native AD authentication or WS-Trust libraries and yet need some means to authenticate the user and get a JWT for the WebAPI.</p>
<p><strong>Solution #3 &#8212; IdentityServer&#8217;s ADFS password authentication: </strong></p>
<p>The final credential type that the ADFS integration endpoint supports is username and password. The native application will collect the user&#8217;s credentials and, similar to the other two scenarios,  it will pass to IdentityServer those credentials and the realm identifier for the WebAPI it wants to invoke. IdentityServer will contact ADFS and return a JWT to the native app. The native app can use that as the token when calling the WebAPI.</p>
<p>If this last scenario is all you needed, then the minimal configuration needed in IdentityServer would be this:</p>
<p><a href="http://brockallen.files.wordpress.com/2013/04/passwordauthentication.png"><img class="aligncenter size-full wp-image-989" alt="PasswordAuthentication" src="http://brockallen.files.wordpress.com/2013/04/passwordauthentication.png?w=600&#038;h=435" width="600" height="435" /></a>You need to:</p>
<ul>
<li>Enable the ADFS Integration protocol</li>
<li>Enable the password authentication option</li>
<li>Indicate a token lifetime</li>
<li>Disable the Pass-thru authentication token option (otherwise SAML will be returned not JWT)</li>
<li>Indicate the ADFS username endpoint (the username/mixed WS-Trust endpoint)</li>
<li>Indicate the ADFS signing certificate thumbprint</li>
</ul>
<p>The one last thing I&#8217;ll say after this new ADFS integration feature &#8212; when IdentityServer converts a SAML token from ADFS into a JWT it is signing the JWT with its signing key. So this means that the signing thumbprint all the relying parties trust need to be that of IdentityServer. This might be different than the signing key of ADFS, or it could be the same &#8212; this configuration choice would be up to you. But this is a detail that is important to be aware of.</p>
<p>There are two samples that illustrate exercising these endpoints. <a href="https://github.com/thinktecture/Thinktecture.IdentityServer.v2/tree/master/samples/AdfsIntegrationSampleClient">First</a> there&#8217;s a sample that just invokes the endpoints and <a href="https://github.com/thinktecture/Thinktecture.IdentityServer.v2/tree/master/samples/AdfsIntegrationFullSample">second</a> there&#8217;s a more full fledged sample that illustrates the real flow through the web application and then to two downstream relying party WebAPI apps.</p>
<p><a href="https://github.com/thinktecture/Thinktecture.IdentityServer.v2/issues">Feedback</a> welcome and enjoy!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/brockallen.wordpress.com/983/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/brockallen.wordpress.com/983/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=brockallen.com&#038;blog=23669881&#038;post=983&#038;subd=brockallen&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://brockallen.com/2013/04/14/getting-json-web-tokens-jwts-from-adfs-via-thinktecture-identityservers-adfs-integration/feed/</wfw:commentRss>
		<slash:comments>26</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/f17c1816a6f9bff29a515c75b950460a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">brockallen</media:title>
		</media:content>

		<media:content url="http://brockallen.files.wordpress.com/2013/04/samlauthentication.png" medium="image">
			<media:title type="html">SAMLAuthentication</media:title>
		</media:content>

		<media:content url="http://brockallen.files.wordpress.com/2013/04/passwordauthentication.png" medium="image">
			<media:title type="html">PasswordAuthentication</media:title>
		</media:content>
	</item>
		<item>
		<title>CORS open source contribution to ASP.NET and System.Web.Cors</title>
		<link>http://brockallen.com/2013/03/13/cors-open-source-contribution-to-asp-net-and-system-web-cors/</link>
		<comments>http://brockallen.com/2013/03/13/cors-open-source-contribution-to-asp-net-and-system-web-cors/#comments</comments>
		<pubDate>Wed, 13 Mar 2013 04:00:08 +0000</pubDate>
		<dc:creator>brockallen</dc:creator>
				<category><![CDATA[CORS]]></category>
		<category><![CDATA[REST / WebAPI]]></category>

		<guid isPermaLink="false">http://brockallen.com/?p=954</guid>
		<description><![CDATA[Dominick is the person who convinced me to build the CORS implementation in Thinktecture IdentityModel. I didn&#8217;t realize it would be used as much as it has. Given the popularity and the need for something built into ASP.NET (and specifically WebAPI), I submitted my CORS implementation  as a contribution to the ASP.NET web stack. Microsoft [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=brockallen.com&#038;blog=23669881&#038;post=954&#038;subd=brockallen&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p><a href="http://leastprivilege.com/">Dominick</a> is the person who convinced me to build the <a href="http://brockallen.com/2012/06/28/cors-support-in-webapi-mvc-and-iis-with-thinktecture-identitymodel/">CORS implementation</a> in Thinktecture IdentityModel. I didn&#8217;t realize it would be used as much as it has. Given the popularity and the need for something built into ASP.NET (and specifically WebAPI), I submitted my CORS implementation  as a contribution to the <a href="http://aspnetwebstack.codeplex.com/">ASP.NET web stack</a>. Microsoft accepted my contribution and I worked with them for a couple of weeks to rework the design for inclusion into the platform.</p>
<p>I&#8217;m happy to announce that today Microsoft (specifically <a href="http://www.codeplex.com/site/users/view/yaohuang">Yao</a>, who was a pleasure to work with) did the <a href="http://aspnetwebstack.codeplex.com/SourceControl/changeset/4284ca5270b9">checkin</a> into the master branch to support CORS in the <a href="http://aspnetwebstack.codeplex.com/">ASP.NET web stack</a>. This means we&#8217;ll have framework support for CORS in the next release of WebAPI. It also means that I get the honor and privilege to be <a href="http://aspnetwebstack.codeplex.com/wikipage?title=Contributors">listed</a> as a contributor to ASP.NET.</p>
<p>Yao has already provided some initial documentation <a href="http://aspnetwebstack.codeplex.com/wikipage?title=CORS%20support%20for%20ASP.NET%20Web%20API">here</a>.</p>
<p><strong>Edit:</strong> Here&#8217;s the Channel9 <a href="http://channel9.msdn.com/Shows/Web+Camps+TV/ASPNET-Web-API-and-CORS-Support">interview</a> related to this.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/brockallen.wordpress.com/954/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/brockallen.wordpress.com/954/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=brockallen.com&#038;blog=23669881&#038;post=954&#038;subd=brockallen&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://brockallen.com/2013/03/13/cors-open-source-contribution-to-asp-net-and-system-web-cors/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/f17c1816a6f9bff29a515c75b950460a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">brockallen</media:title>
		</media:content>
	</item>
		<item>
		<title>Thinktecture IdentityServer now supports localization</title>
		<link>http://brockallen.com/2013/03/10/thinktecture-identityserver-now-supports-localization/</link>
		<comments>http://brockallen.com/2013/03/10/thinktecture-identityserver-now-supports-localization/#comments</comments>
		<pubDate>Sun, 10 Mar 2013 22:48:30 +0000</pubDate>
		<dc:creator>brockallen</dc:creator>
				<category><![CDATA[IdentityServer]]></category>

		<guid isPermaLink="false">http://brockallen.com/?p=966</guid>
		<description><![CDATA[Thanks to the contribution by Sébastien and Bruno, IdentityServer now supports localization! They performed the work to allow localization and provided the default English and French translations. I just performed the merge today and it was a large one (467 changed files) which illustrates the effort they put into it. Merci! If anyone else is [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=brockallen.com&#038;blog=23669881&#038;post=966&#038;subd=brockallen&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Thanks to the contribution by <a href="https://github.com/sebastien-allard">Sébastien</a> and <a href="https://github.com/BRovito">Bruno</a>, <a href="http://thinktecture.github.com/Thinktecture.IdentityServer.v2/">IdentityServer</a> now supports localization! They performed the work to allow localization and provided the default English and French translations. I just performed the merge today and it was a large one (<strong>467 changed files</strong>) which illustrates the effort they put into it. Merci!</p>
<p>If anyone else is interested in providing the translations to other languages, feel free to <a href="https://github.com/thinktecture/Thinktecture.IdentityServer.v2/issues">contact</a> us and we can discuss!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/brockallen.wordpress.com/966/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/brockallen.wordpress.com/966/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=brockallen.com&#038;blog=23669881&#038;post=966&#038;subd=brockallen&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://brockallen.com/2013/03/10/thinktecture-identityserver-now-supports-localization/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/f17c1816a6f9bff29a515c75b950460a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">brockallen</media:title>
		</media:content>
	</item>
		<item>
		<title>Demos &#8212; DevWeek 2013</title>
		<link>http://brockallen.com/2013/03/09/demos-devweek-2013/</link>
		<comments>http://brockallen.com/2013/03/09/demos-devweek-2013/#comments</comments>
		<pubDate>Sat, 09 Mar 2013 10:43:33 +0000</pubDate>
		<dc:creator>brockallen</dc:creator>
				<category><![CDATA[Speaking]]></category>

		<guid isPermaLink="false">http://brockallen.com/?p=962</guid>
		<description><![CDATA[Despite being completely exhausted, I had a great time at my first DevWeek. It was great chatting with the attendees as well as the other speakers. The sessions I presented were: Day-long pre-conference session:  A day of jQuery and jQuery Mobile Async ASP.NET Internals of security in ASP.NET Mobile development with MVC 4 and jQuery [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=brockallen.com&#038;blog=23669881&#038;post=962&#038;subd=brockallen&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Despite being completely exhausted, I had a great time at my first <a href="http://www.devweek.com/">DevWeek</a>. It was great chatting with the attendees as well as the other speakers.</p>
<p>The sessions I presented were:</p>
<ul>
<li>Day-long pre-conference session:  A day of jQuery and jQuery Mobile</li>
<li>Async ASP.NET</li>
<li>Internals of security in ASP.NET</li>
<li>Mobile development with MVC 4 and jQuery Mobile</li>
<li>Day-long post-conference session: A day of identity and access control for .NET 4.5 (co-speaking with <a href="http://leastprivilege.com/">Dominick</a>)</li>
</ul>
<p>The demos for the talks are located <a href="http://sdrv.ms/13MLNKH">here</a>. Also, links to the various open source projects mentioned are:</p>
<ul>
<li><a href="http://thinktecture.github.com/Thinktecture.IdentityServer.v2/">Thinktecture IdentityServer</a></li>
<li><a href="http://thinktecture.github.com/Thinktecture.IdentityModel.45/">Thinktecture IdentityModel</a></li>
<li><a href="https://github.com/brockallen/BrockAllen.MembershipReboot">MembershipReboot</a></li>
</ul>
<p>Many thanks to all for a great week.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/brockallen.wordpress.com/962/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/brockallen.wordpress.com/962/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=brockallen.com&#038;blog=23669881&#038;post=962&#038;subd=brockallen&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://brockallen.com/2013/03/09/demos-devweek-2013/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/f17c1816a6f9bff29a515c75b950460a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">brockallen</media:title>
		</media:content>
	</item>
		<item>
		<title>Dynamic issuer name registry direct from STS federation metadata with Thinktecture IdentityModel</title>
		<link>http://brockallen.com/2013/02/22/dynamic-issuer-name-registry-direct-from-sts-federation-metadata-with-thinktecture-identitymodel/</link>
		<comments>http://brockallen.com/2013/02/22/dynamic-issuer-name-registry-direct-from-sts-federation-metadata-with-thinktecture-identitymodel/#comments</comments>
		<pubDate>Fri, 22 Feb 2013 12:16:04 +0000</pubDate>
		<dc:creator>brockallen</dc:creator>
				<category><![CDATA[IdentityModel]]></category>
		<category><![CDATA[WIF / Claims]]></category>

		<guid isPermaLink="false">http://brockallen.com/?p=950</guid>
		<description><![CDATA[In order for a RP to trust a token issued by an STS it must be configured with the public key (or public key thumbprint) from the STS’ metadata. These keys expire and thus periodically the RP must be updated. For a large number of RPs this is a non-trivial task. Therefore it is desirable [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=brockallen.com&#038;blog=23669881&#038;post=950&#038;subd=brockallen&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>In order for a RP to trust a token issued by an STS it must be configured with the public key (or public key thumbprint) from the STS’ metadata. These keys expire and thus periodically the RP must be updated. For a large number of RPs this is a non-trivial task. Therefore it is desirable to have an automated or dynamic mechanism for updating an RP with the set of signing keys used by a STS.</p>
<p>In order to always have the latest federation metadata from the STS, a <i>MetadataBasedIssuerNameRegistry</i> class was added to <a href="http://thinktecture.github.com/Thinktecture.IdentityModel.45/">Thinktecture IdentityModel</a>. It is configured with the issuer name desired to be used by the RP and the URL of the STS’s federation metadata endpoint and then loaded at runtime to discover the STS’ signing keys and those are used to build the WIF’s issuer name registry.</p>
<p>The <i>MetadataBasedIssuerNameRegistry</i> can be configured in <i>web.config</i>:</p>
<pre>&lt;system.identityModel&gt;
  &lt;identityConfiguration&gt;
    &lt;issuerNameRegistry
       type="Thinktecture.IdentityModel.Tokens.MetadataBasedIssuerNameRegistry,
             Thinktecture.IdentityModel"&gt;
      &lt;trustedIssuerMetadata issuerName="sts"
                             metadataAddress="https://localhost/sts/FederationMetadata/2007-06/FederationMetadata.xml"&gt;
      &lt;/trustedIssuerMetadata&gt;
    &lt;/issuerNameRegistry&gt;</pre>
<p>The <em>&lt;trustedIssuerMetadata&gt;</em> element has attributes for the issuer name and the URL for the federation metatadata.</p>
<p>The <i>MetadataBasedIssuerNameRegistry</i> can also be configured code from <i>global.asax</i>:</p>
<pre>protected void Application_Start()
{
    FederatedAuthentication.FederationConfigurationCreated +=
        FederatedAuthentication_FederationConfigurationCreated;

    ...
}

void FederatedAuthentication_FederationConfigurationCreated(
    object sender, FederationConfigurationCreatedEventArgs e)
{
    var url = "https://localhost/sts/FederationMetadata/2007-06/FederationMetadata.xml";

    e.FederationConfiguration.IdentityConfiguration.IssuerNameRegistry =
        new MetadataBasedIssuerNameRegistry(new Uri(url), "sts");
}</pre>
<p>The main downside with the <i>MetadataBasedIssuerNameRegistry</i> is that the metadata is loaded each time the RP application starts. It was then desired to provide a caching mechanism on top of the <i>MetadataBasedIssuerNameRegistry</i>, and thus the <i>CachingMetadataBasedIssuerNameRegistry</i> was also developed.</p>
<p>The <i>CachingMetadataBasedIssuerNameRegistry</i> inherits from <i>MetadataBasedIssuerNameRegistry</i> and simply provides caching logic on top of the dynamically loaded metadata. The cache is abstracted with an <i>IMetadataCache</i> interface so different implementations can be provided as needed.</p>
<p>The <i>IMetadataCache</i> definition is:</p>
<pre>public interface IMetadataCache
{
    TimeSpan Age { get; }
    byte[] Load();
    void Save(byte[] data);
}</pre>
<p>Given the semantics of the metadata there is only one item (as a <i>byte[]</i>) that needs to be cached. Its age is needed for repopulating the cache. For reference a file system based implementation is provided and is called <i>FileBasedMetadataCache</i>.</p>
<p>Configuring the <i>CachingMetadataBasedIssuerNameRegistry</i> can be done in <i>web.config</i>:</p>
<pre>&lt;issuerNameRegistry
     type="Thinktecture.IdentityModel.Tokens.CachingMetadataBasedIssuerNameRegistry,
           Thinktecture.IdentityModel"&gt;
  &lt;trustedIssuerMetadata issuerName="sts"
                         metadataAddress="https://localhost/sts/FederationMetadata/2007-06/FederationMetadata.xml"&gt;&lt;/trustedIssuerMetadata&gt;
  &lt;metadataCache cacheDuration="30"
                 cacheType="Thinktecture.IdentityModel.Tokens.FileBasedMetadataCache,
                            Thinktecture.IdentityModel"
                  &gt;
    &lt;file path="c:\demos\cache.xml"&gt;&lt;/file&gt;
  &lt;/metadataCache&gt;
&lt;/issuerNameRegistry&gt;</pre>
<p>The <em>&lt;trustedIssuerMetadata&gt;</em> configuration is the same as before. The <em>&lt;metadataCache&gt;</em> element provides a <em>cacheDuration</em> attribute for the number of days to cache the metadata. There is also a <em>cacheType</em> attribute that indicates the class that implements the <i>IMetadataCache</i> interface. As displayed above, the <i>FileBasedMetadataCache</i> supports its own <em>&lt;file&gt;</em> configuration element to indicate the <em>path</em> to the file. The IIS worker process identity will require write privileges to this file.</p>
<p>Configuring the <i>CachingMetadataBasedIssuerNameRegistry</i> can be done in code in <i>global.asax</i>:</p>
<pre>void FederatedAuthentication_FederationConfigurationCreated(
    object sender, FederationConfigurationCreatedEventArgs e)
{
    var url = "https://localhost/sts/FederationMetadata/2007-06/FederationMetadata.xml";
    var cache = new FileBasedMetadataCache(@"c:\demos\cache.xml");
    e.FederationConfiguration.IdentityConfiguration.IssuerNameRegistry =
        new CachingMetadataBasedIssuerNameRegistry(new Uri(url), "sts",
                                                   cache, 30);
}</pre>
<p>The <i>CachingMetadataBasedIssuerNameRegistry</i> will load the metadata the first time from the STS but then cache it via the <i>IMetadataCache</i> for the duration specified. Each time the application then starts the cache should be used. The cache will also be pre-populated asynchronously if the age is less than half the remaining time of the cache duration. In other words, if the cache duration is 30 days and there is 15 or fewer days before expiration then the <i>CachingMetadataBasedIssuerNameRegistry</i> will attempt to contact the STS, acquire the latest metadata and update the cache.</p>
<p>One last aspect of the <i>CachingMetadataBasedIssuerNameRegistry</i> is that the cache is encrypted and signed via the <a href="http://brockallen.com/2012/06/21/use-the-machinekey-api-to-protect-values-in-asp-net/"><i>MachineKey</i></a> APIs in ASP.NET. This can be disabled by setting the optional protect flag to <i>false</i> in config or via the constructor argument.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/brockallen.wordpress.com/950/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/brockallen.wordpress.com/950/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=brockallen.com&#038;blog=23669881&#038;post=950&#038;subd=brockallen&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://brockallen.com/2013/02/22/dynamic-issuer-name-registry-direct-from-sts-federation-metadata-with-thinktecture-identitymodel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/f17c1816a6f9bff29a515c75b950460a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">brockallen</media:title>
		</media:content>
	</item>
	</channel>
</rss>
