<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>www.leastprivilege.com</title>
    <link>http://www.leastprivilege.com/</link>
    <description>dominick baier on .net, security and other stuff</description>
    <image>
      <url>http://www.leastprivilege.com/favicon.ico</url>
      <title>www.leastprivilege.com</title>
      <link>http://www.leastprivilege.com/</link>
    </image>
    <copyright>Dominick Baier</copyright>
    <lastBuildDate>Tue, 09 Mar 2010 09:45:21 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.0.7226.0</generator>
    <managingEditor>dbaier@pleasepleasenospam_leastprivilege.com</managingEditor>
    <webMaster>dbaier@pleasepleasenospam_leastprivilege.com</webMaster>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=367023a1-2891-4858-8e00-e251dec0853f</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=367023a1-2891-4858-8e00-e251dec0853f</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Our very own <a href="http://www.thinktecture.com/staff/joerg">Jörg</a><a href="http://headwriteline.blogspot.com/">Neumann</a> had
this cooking for quite a while. tt.DOM is a library that lets you add features like
change tracking, undo, redo, views, transactions and n-tier support to arbitrary types
(or lists of types). This makes typical data scenarios in 3-tier applications *much*
easier to handle.
</p>
        <p>
Expect more information and documentation soon (of course ;).
</p>
        <p>
In the meanwhile feel free to play around with it and give us feedback via the codeplex
forum!
</p>
        <p>
          <a href="http://dataobjectmodel.codeplex.com">http://dataobjectmodel.codeplex.com</a>
        </p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=367023a1-2891-4858-8e00-e251dec0853f" />
      </body>
      <title>Thinktecture.DataObjectModel</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=367023a1-2891-4858-8e00-e251dec0853f</guid>
      <link>http://www.leastprivilege.com/ThinktectureDataObjectModel.aspx</link>
      <pubDate>Tue, 09 Mar 2010 09:45:21 GMT</pubDate>
      <description>&lt;p&gt;
Our very own &lt;a href="http://www.thinktecture.com/staff/joerg"&gt;Jörg&lt;/a&gt; &lt;a href="http://headwriteline.blogspot.com/"&gt;Neumann&lt;/a&gt; had
this cooking for quite a while. tt.DOM is a library that lets you add features like
change tracking, undo, redo, views, transactions and n-tier support to arbitrary types
(or lists of types). This makes typical data scenarios in 3-tier applications *much*
easier to handle.
&lt;/p&gt;
&lt;p&gt;
Expect more information and documentation soon (of course ;).
&lt;/p&gt;
&lt;p&gt;
In the meanwhile feel free to play around with it and give us feedback via the codeplex
forum!
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://dataobjectmodel.codeplex.com"&gt;http://dataobjectmodel.codeplex.com&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=367023a1-2891-4858-8e00-e251dec0853f" /&gt;</description>
      <category>Tools for Thinktecture</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=ad944967-53fd-4fe1-9ff5-7c5f173de8a9</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=ad944967-53fd-4fe1-9ff5-7c5f173de8a9</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Looking forward to this week’s nice little security <a href="http://www.troopers.de/">conference</a> organized
by my old friends at <a href="http://www.ernw.de">ERNW</a>.
</p>
        <p>
          <strong>Federated Identity - Opportunities and Risks</strong>
          <br />
The world is moving towards a federated identity model. Public facing websites like
Google or Facebook utilize technologies like OpenID, OAuth and WRAP to provide single-sign-on
capabilities. Enterprises and ISVs start deploying WS-Federation, WS-Trust and SAML
to federate with customers, partners and even internally. The goals are always the
same: provide a more meaningful representation of "identity" for authentication, authorization
and personalization. This talks sheds light on all these technologies, how they work
and how to secure them.
</p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=ad944967-53fd-4fe1-9ff5-7c5f173de8a9" />
      </body>
      <title>This week: Trooper Heidelberg</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=ad944967-53fd-4fe1-9ff5-7c5f173de8a9</guid>
      <link>http://www.leastprivilege.com/ThisWeekTrooperHeidelberg.aspx</link>
      <pubDate>Sun, 07 Mar 2010 17:45:39 GMT</pubDate>
      <description>&lt;p&gt;
Looking forward to this week’s nice little security &lt;a href="http://www.troopers.de/"&gt;conference&lt;/a&gt; organized
by my old friends at &lt;a href="http://www.ernw.de"&gt;ERNW&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Federated Identity - Opportunities and Risks&lt;/strong&gt;
&lt;br&gt;
The world is moving towards a federated identity model. Public facing websites like
Google or Facebook utilize technologies like OpenID, OAuth and WRAP to provide single-sign-on
capabilities. Enterprises and ISVs start deploying WS-Federation, WS-Trust and SAML
to federate with customers, partners and even internally. The goals are always the
same: provide a more meaningful representation of "identity" for authentication, authorization
and personalization. This talks sheds light on all these technologies, how they work
and how to secure them.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=ad944967-53fd-4fe1-9ff5-7c5f173de8a9" /&gt;</description>
      <category>Conferences</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=b530dfcd-3389-453d-9164-5934b588bedb</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=b530dfcd-3389-453d-9164-5934b588bedb</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
RTM finally ;)
</p>
        <p>
          <img src="http://weblogs.thinktecture.com/.a/6a012876b389bb970c01310f589418970c-pi" />
        </p>
        <p>
Book <a href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=4c09ffe4-43dd-4fcc-be35-c897c9bc4386">here</a>.<br />
Code <a href="http://www.microsoft.com/downloads/details.aspx?familyid=33829BCF-F5EA-4650-B807-57C63A753753&amp;displaylang=en">here</a>.<br />
More info <a href="mailto:dominick.baier(_at_)thinktecture.com">here</a>.
</p>
        <p>
Enjoy!!!
</p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=b530dfcd-3389-453d-9164-5934b588bedb" />
      </body>
      <title>Guide to Claims-based Identity and Access Control</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=b530dfcd-3389-453d-9164-5934b588bedb</guid>
      <link>http://www.leastprivilege.com/GuideToClaimsbasedIdentityAndAccessControl.aspx</link>
      <pubDate>Fri, 05 Mar 2010 12:36:46 GMT</pubDate>
      <description>&lt;p&gt;
RTM finally ;)
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://weblogs.thinktecture.com/.a/6a012876b389bb970c01310f589418970c-pi"&gt;
&lt;/p&gt;
&lt;p&gt;
Book &lt;a href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;amp;FamilyID=4c09ffe4-43dd-4fcc-be35-c897c9bc4386"&gt;here&lt;/a&gt;.&lt;br&gt;
Code &lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=33829BCF-F5EA-4650-B807-57C63A753753&amp;amp;displaylang=en"&gt;here&lt;/a&gt;.&lt;br&gt;
More info &lt;a href="mailto:dominick.baier(_at_)thinktecture.com"&gt;here&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
Enjoy!!!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=b530dfcd-3389-453d-9164-5934b588bedb" /&gt;</description>
      <category>IdentityModel</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=54bb6d22-766a-40c4-9ecc-e084656a035f</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=54bb6d22-766a-40c4-9ecc-e084656a035f</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Mein geschätzter Kollege <a href="http://blogs.msdn.com/vbertocci">Vittorio</a> Bertocci
führt einen 2-Tägigen <a href="http://blogs.msdn.com/dparys/archive/2010/03/05/interesse-an-windows-identity-foundation.aspx">Workshop</a> zum
Thema Windows Identity Foundation in München durch. Das ist bestimmt eine gute Gelegenheit
sich mal abseits vom Projektalltag mit dem Thema genauer zu beschäftigen.
</p>
        <p>
Wenn danach alle (un)Klarheiten beseitigt sind, und Sie weiterführenden Informationen
oder Unterstützung zur Implementierung von Claims in der Praxis benötigen – einfach
Email an mich (dominick.baier (_at_) thinktecture.com). Ich helfe gerne weiter. Viel
Spaß!
</p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=54bb6d22-766a-40c4-9ecc-e084656a035f" />
      </body>
      <title>WIF Workshop</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=54bb6d22-766a-40c4-9ecc-e084656a035f</guid>
      <link>http://www.leastprivilege.com/WIFWorkshop.aspx</link>
      <pubDate>Fri, 05 Mar 2010 12:28:46 GMT</pubDate>
      <description>&lt;p&gt;
Mein geschätzter Kollege &lt;a href="http://blogs.msdn.com/vbertocci"&gt;Vittorio&lt;/a&gt; Bertocci
führt einen 2-Tägigen &lt;a href="http://blogs.msdn.com/dparys/archive/2010/03/05/interesse-an-windows-identity-foundation.aspx"&gt;Workshop&lt;/a&gt; zum
Thema Windows Identity Foundation in München durch. Das ist bestimmt eine gute Gelegenheit
sich mal abseits vom Projektalltag mit dem Thema genauer zu beschäftigen.
&lt;/p&gt;
&lt;p&gt;
Wenn danach alle (un)Klarheiten beseitigt sind, und Sie weiterführenden Informationen
oder Unterstützung zur Implementierung von Claims in der Praxis benötigen – einfach
Email an mich (dominick.baier (_at_) thinktecture.com). Ich helfe gerne weiter. Viel
Spaß!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=54bb6d22-766a-40c4-9ecc-e084656a035f" /&gt;</description>
      <category>IdentityModel</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=fbf249d1-5e49-4a79-8508-b268bdbbe2ba</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=fbf249d1-5e49-4a79-8508-b268bdbbe2ba</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
So – zurück und (wichtiger) erholt von der BASTA. Muss sagen – es war mal wieder sehr
nett – großes Lob an Veranstalter und Teilnehmer. Hat Spaß gemacht!
</p>
        <p>
Am meisten war ich über das große Interesse an WIF überrascht. Ein voller Raum für
nen Security Talk – und das direkt nach dem Essen ;)
</p>
        <p>
          <a href="http://www.aspnetzone.de/blogs/juergengutsch/archive/2010/02/24/basta-tag-3-windows-identity-foundation.aspx">Hier</a> habe
ich eine sehr gute Zusammenfassung des Talks gefunden – die Punkte, die mir am Herzen
lagen, scheinen angekommen zu sein! Das freut mich!
</p>
        <p>
Ich habe es schon während des Vortrags erwähnt – WIF ist sowohl ein neuer API als
auch ein neues Paradigma. Dafür reichen 75min einfach nicht aus. Wer Fragen dazu hat,
oder Unterstützung braucht – einfach Mail an mich.
</p>
        <p>
Bis zum nächsten Mal!
</p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=fbf249d1-5e49-4a79-8508-b268bdbbe2ba" />
      </body>
      <title>Zur&amp;uuml;ck von der BASTA</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=fbf249d1-5e49-4a79-8508-b268bdbbe2ba</guid>
      <link>http://www.leastprivilege.com/ZuruumlckVonDerBASTA.aspx</link>
      <pubDate>Mon, 01 Mar 2010 08:06:39 GMT</pubDate>
      <description>&lt;p&gt;
So – zurück und (wichtiger) erholt von der BASTA. Muss sagen – es war mal wieder sehr
nett – großes Lob an Veranstalter und Teilnehmer. Hat Spaß gemacht!
&lt;/p&gt;
&lt;p&gt;
Am meisten war ich über das große Interesse an WIF überrascht. Ein voller Raum für
nen Security Talk – und das direkt nach dem Essen ;)
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.aspnetzone.de/blogs/juergengutsch/archive/2010/02/24/basta-tag-3-windows-identity-foundation.aspx"&gt;Hier&lt;/a&gt; habe
ich eine sehr gute Zusammenfassung des Talks gefunden – die Punkte, die mir am Herzen
lagen, scheinen angekommen zu sein! Das freut mich!
&lt;/p&gt;
&lt;p&gt;
Ich habe es schon während des Vortrags erwähnt – WIF ist sowohl ein neuer API als
auch ein neues Paradigma. Dafür reichen 75min einfach nicht aus. Wer Fragen dazu hat,
oder Unterstützung braucht – einfach Mail an mich.
&lt;/p&gt;
&lt;p&gt;
Bis zum nächsten Mal!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=fbf249d1-5e49-4a79-8508-b268bdbbe2ba" /&gt;</description>
      <category>Conferences</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=508c317c-4896-486f-9b52-4680bc121dce</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=508c317c-4896-486f-9b52-4680bc121dce</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
The v1 beta of <a href="http://startersts.codeplex.com/">StarterSTS</a> has an updated
relying party configuration section. This allows to “plugin” the STS into ADFS2 or
Sharepoint as a claims provider.
</p>
        <p>
Here’s a quick walkthrough for ADFS2:
</p>
        <p>
          <strong>Register StarterSTS as claims provider in ADFS</strong>
          <br />
This is really easy. Simply go to the ADFS2 configuration console and add a new claims
provider. Then point the wizard to the StarterSTS WS-Federation metadata file (either
by URL or using a file path). Afterwards you have to add some claim rules – to get
started you could add a pass-through rule for the name claim.
</p>
        <p>
You will also need to export the ADFS2 certificate that is used for token decryption.
</p>
        <p>
          <strong>Registering ADFS2 as a relying party in StarterSTS</strong>
          <br />
The next step is to register ADFS2 in StarterSTS. This is done by modifying the <em>relyingParty.config</em> file
(in the configuration sub folder). You need three things for that – the ADFS issuer
URI, the physical address of the ADFS2 sign-in page and the ADFS2 token encryption
certificate. The certificate could be either imported into the certificate store or
you copy it to ~/App_Data/certificates.
</p>
        <p>
The config entry looks similar to this:
</p>
        <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal">
          <span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US">&lt;</span>
          <span style="font-family: consolas; color: #a31515; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US">add</span>
          <span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US">
          </span>
          <span style="font-family: consolas; color: red; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US">realm</span>
          <span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US">=</span>
          <span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US">"<span style="color: blue">http://&lt;adfsname&gt;/adfs/services/trust</span>"<br /></span>
          <span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US">
            <span style="mso-spacerun: yes">     </span>
          </span>
          <span style="font-family: consolas; color: red; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US">replyTo</span>
          <span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US">=</span>
          <span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US">"<span style="color: blue">https://&lt;adfsname&gt;/adfs/ls/</span>"<span style="color: blue">&gt;<br /></span></span>
          <span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US">
            <span style="mso-spacerun: yes">  </span>&lt;</span>
          <span style="font-family: consolas; color: #a31515; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US">certificate</span>
          <span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US">
          </span>
          <span style="font-family: consolas; color: red; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US">filename</span>
          <span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US">=</span>
          <span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US">"<span style="color: blue">tokendecryption.cer</span>"<span style="color: blue"> /&gt;<br /></span></span>
          <span style="font-family: consolas; color: blue; mso-no-proof: yes">&lt;/</span>
          <span style="font-family: consolas; color: #a31515; mso-no-proof: yes">add</span>
          <span style="font-family: consolas; color: blue; mso-no-proof: yes">&gt;</span>
        </p>
        <p>
HTH
</p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=508c317c-4896-486f-9b52-4680bc121dce" />
      </body>
      <title>Adding StarterSTS as a Claims Provider for ADFS2</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=508c317c-4896-486f-9b52-4680bc121dce</guid>
      <link>http://www.leastprivilege.com/AddingStarterSTSAsAClaimsProviderForADFS2.aspx</link>
      <pubDate>Mon, 01 Mar 2010 07:30:14 GMT</pubDate>
      <description>&lt;p&gt;
The v1 beta of &lt;a href="http://startersts.codeplex.com/"&gt;StarterSTS&lt;/a&gt; has an updated
relying party configuration section. This allows to “plugin” the STS into ADFS2 or
Sharepoint as a claims provider.
&lt;/p&gt;
&lt;p&gt;
Here’s a quick walkthrough for ADFS2:
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Register StarterSTS as claims provider in ADFS&lt;/strong&gt;
&lt;br&gt;
This is really easy. Simply go to the ADFS2 configuration console and add a new claims
provider. Then point the wizard to the StarterSTS WS-Federation metadata file (either
by URL or using a file path). Afterwards you have to add some claim rules – to get
started you could add a pass-through rule for the name claim.
&lt;/p&gt;
&lt;p&gt;
You will also need to export the ADFS2 certificate that is used for token decryption.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Registering ADFS2 as a relying party in StarterSTS&lt;/strong&gt;
&lt;br&gt;
The next step is to register ADFS2 in StarterSTS. This is done by modifying the &lt;em&gt;relyingParty.config&lt;/em&gt; file
(in the configuration sub folder). You need three things for that – the ADFS issuer
URI, the physical address of the ADFS2 sign-in page and the ADFS2 token encryption
certificate. The certificate could be either imported into the certificate store or
you copy it to ~/App_Data/certificates.
&lt;/p&gt;
&lt;p&gt;
The config entry looks similar to this:
&lt;/p&gt;
&lt;p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;
&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-family: consolas; color: #a31515; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;add&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt; &lt;/span&gt;&lt;span style="font-family: consolas; color: red; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;realm&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;=&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;"&lt;span style="color: blue"&gt;http://&amp;lt;adfsname&amp;gt;/adfs/services/trust&lt;/span&gt;"&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: consolas; color: red; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;replyTo&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;=&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;"&lt;span style="color: blue"&gt;https://&amp;lt;adfsname&amp;gt;/adfs/ls/&lt;/span&gt;"&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-family: consolas; color: #a31515; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;certificate&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt; &lt;/span&gt;&lt;span style="font-family: consolas; color: red; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;filename&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;=&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;"&lt;span style="color: blue"&gt;tokendecryption.cer&lt;/span&gt;"&lt;span style="color: blue"&gt; /&amp;gt;&lt;br&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-no-proof: yes"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="font-family: consolas; color: #a31515; mso-no-proof: yes"&gt;add&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-no-proof: yes"&gt;&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
HTH
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=508c317c-4896-486f-9b52-4680bc121dce" /&gt;</description>
      <category>IdentityModel</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=fb85fdf8-59ed-4feb-a289-cc3aea31b2d5</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=fb85fdf8-59ed-4feb-a289-cc3aea31b2d5</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <title>WCF, WIF and Load Balancing (and a bit of Azure)</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=fb85fdf8-59ed-4feb-a289-cc3aea31b2d5</guid>
      <link>http://www.leastprivilege.com/WCFWIFAndLoadBalancingAndABitOfAzure.aspx</link>
      <pubDate>Fri, 19 Feb 2010 07:36:26 GMT</pubDate>
      <description>&lt;p&gt;
Pablo wrote a &lt;a href="http://weblogs.asp.net/cibrax/archive/2010/02/17/the-system-cannot-find-the-file-specified-error-in-the-wif-fam-module.aspx"&gt;post&lt;/a&gt; yesterday
giving some background information on how session tokens are protected in WIF – here
some additional info for WCF:
&lt;/p&gt;
&lt;p&gt;
The ws* bindings in WCF establish a security session by default (via WS-SecureConversation).
This has some implications, e.g.
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
You end up with a stateful service – or more important – with a stateful programming
model. You have all the typical session “problems” like faulted sessions, timeout,
retries etc… 
&lt;li&gt;
By default SecureConversation only transmits a session identifier (like a ASP.NET
session cookie) – the actual session is stored in-memory at the server. Not good for
load balancing.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
When you want to use WCF in a load balanced environment (e.g Azure) – you have to
change the default behavior – you basically have two options:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Turn off SecureConversation all together. This has the advantage of being stateless
(at least in that part of the communication). But this also means, that the bootstrap
(SAML) token will get parsed on every request – this includes invoking the &lt;em&gt;ClaimsAuthenticationManager&lt;/em&gt;.
This might have performance implications – but depends on your scenario. 
&lt;li&gt;
Force WCF into “cookie mode”. This means that the complete &lt;em&gt;IClaimsPrincipal&lt;/em&gt; (after &lt;em&gt;ClaimsAuthenticationManager&lt;/em&gt; has
run) gets serialized and round-tripped in the SOAP header.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;strong&gt;Turning off SecureConversation&lt;/strong&gt;
&lt;br&gt;
Unfortunately WCF 3.5 does not directly allow that on the standard federation bindings.
You would need to create a custom binding that uses an authentication mode of &lt;em&gt;IssuedTokenOverTransport&lt;/em&gt; (for
mixed mode) or &lt;em&gt;IssuedTokenForCertificate&lt;/em&gt; (for message security).
&lt;/p&gt;
&lt;p&gt;
In .NET 4 you can simply set &lt;em&gt;establishSecurityContext&lt;/em&gt; to false on the standard
ws-fed binding.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Cookie Mode&lt;/strong&gt;
&lt;br&gt;
Forcing WCF into cookie mode requires a custom binding. The “trick” here is to set &lt;em&gt;requireSecurityContextCancellation&lt;/em&gt; to
false – which is just a fancy name for “serialize the context into the message”. Here’s
the binding I am using (mixed mode security):
&lt;/p&gt;
&lt;p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;
&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us" lang="EN-US"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-family: consolas; color: #a31515; mso-ansi-language: en-us" lang="EN-US"&gt;customBinding&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us" lang="EN-US"&gt;&amp;gt;&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us" lang="EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-family: consolas; color: #a31515; mso-ansi-language: en-us" lang="EN-US"&gt;binding&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us" lang="EN-US"&gt; &lt;/span&gt;&lt;span style="font-family: consolas; color: red; mso-ansi-language: en-us" lang="EN-US"&gt;name&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us" lang="EN-US"&gt;=&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us" lang="EN-US"&gt;"&lt;span style="color: blue"&gt;federation_cookie&lt;/span&gt;"&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us" lang="EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-family: consolas; color: #a31515; mso-ansi-language: en-us" lang="EN-US"&gt;security&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us" lang="EN-US"&gt; &lt;/span&gt;&lt;span style="font-family: consolas; color: red; mso-ansi-language: en-us" lang="EN-US"&gt;authenticationMode&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us" lang="EN-US"&gt;=&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us" lang="EN-US"&gt;"&lt;span style="color: blue"&gt;SecureConversation&lt;/span&gt;"&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us" lang="EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: consolas; color: red; mso-ansi-language: en-us" lang="EN-US"&gt;messageSecurityVersion&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us" lang="EN-US"&gt;=&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us" lang="EN-US"&gt;"&lt;span style="color: blue"&gt;WSSecurity11&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
WSTrust13&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
WSSecureConversation13&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
WSSecurityPolicy12&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
BasicSecurityProfile10&lt;/span&gt;"&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us" lang="EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: consolas; color: red; mso-ansi-language: en-us" lang="EN-US"&gt;requireSecurityContextCancellation&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us" lang="EN-US"&gt;=&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us" lang="EN-US"&gt;"&lt;span style="color: blue"&gt;false&lt;/span&gt;"&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us" lang="EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-family: consolas; color: #a31515; mso-ansi-language: en-us" lang="EN-US"&gt;secureConversationBootstrap&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us" lang="EN-US"&gt; &lt;/span&gt;&lt;span style="font-family: consolas; color: red; mso-ansi-language: en-us" lang="EN-US"&gt;authenticationMode&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us" lang="EN-US"&gt;=&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us" lang="EN-US"&gt;"&lt;span style="color: blue"&gt;IssuedTokenOverTransport&lt;/span&gt;"&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us" lang="EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: consolas; color: red; mso-ansi-language: en-us" lang="EN-US"&gt;messageSecurityVersion&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us" lang="EN-US"&gt;=&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us" lang="EN-US"&gt;"&lt;span style="color: blue"&gt;WSSecurity11&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
WSTrust13&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
WSSecureConversation13&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
WSSecurityPolicy12&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
BasicSecurityProfile10&lt;/span&gt;"&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us" lang="EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-family: consolas; color: #a31515; mso-ansi-language: en-us" lang="EN-US"&gt;issuedTokenParameters&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us" lang="EN-US"&gt;&amp;gt;&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us" lang="EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-family: consolas; color: #a31515; mso-ansi-language: en-us" lang="EN-US"&gt;issuerMetadata&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us" lang="EN-US"&gt; &lt;/span&gt;&lt;span style="font-family: consolas; color: red; mso-ansi-language: en-us" lang="EN-US"&gt;address&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us" lang="EN-US"&gt;="&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us" lang="EN-US"&gt;&lt;span style="color: blue"&gt;https://…"&lt;/span&gt;&lt;span style="color: blue"&gt; /&amp;gt;&lt;br&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us" lang="EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;/&lt;/span&gt;&lt;span style="font-family: consolas; color: #a31515; mso-ansi-language: en-us" lang="EN-US"&gt;issuedTokenParameters&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us" lang="EN-US"&gt;&amp;gt;&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us" lang="EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;/&lt;/span&gt;&lt;span style="font-family: consolas; color: #a31515; mso-ansi-language: en-us" lang="EN-US"&gt;secureConversationBootstrap&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us" lang="EN-US"&gt;&amp;gt;&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us" lang="EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;/&lt;/span&gt;&lt;span style="font-family: consolas; color: #a31515; mso-ansi-language: en-us" lang="EN-US"&gt;security&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us" lang="EN-US"&gt;&amp;gt;&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us" lang="EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&lt;br&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us" lang="EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-family: consolas; color: #a31515; mso-ansi-language: en-us" lang="EN-US"&gt;textMessageEncoding&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us" lang="EN-US"&gt; /&amp;gt;&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us" lang="EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-family: consolas; color: #a31515; mso-ansi-language: en-us" lang="EN-US"&gt;httpsTransport&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us" lang="EN-US"&gt; /&amp;gt;&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us" lang="EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: consolas; color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="font-family: consolas; color: #a31515"&gt;binding&lt;/span&gt;&lt;span style="font-family: consolas; color: blue"&gt;&amp;gt;&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="font-family: consolas; color: #a31515"&gt;customBinding&lt;/span&gt;&lt;span style="font-family: consolas; color: blue"&gt;&lt;?xml:namespace prefix = o /&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
As Pablo points out in his &lt;a href="http://weblogs.asp.net/cibrax/archive/2010/02/17/the-system-cannot-find-the-file-specified-error-in-the-wif-fam-module.aspx"&gt;post&lt;/a&gt;,
the session cookie must be protected somehow. The standard WIF behavior is to the
DPAPI user key. This key cannot be easily shared between nodes in a cluster (unless
the nodes are all domain members and roaming profiles are activated). Another more
explicit (and practical) option is to use an RSA key. Most typically you would feed
your SSL certificate or the certificate used to decrypt incoming tokens into the following
session token handler: 
&lt;/p&gt;
&lt;p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;
&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;public&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt; &lt;span style="color: blue"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af"&gt;WebFarmSessionSecurityTokenHandler&lt;/span&gt; : &lt;span style="color: #2b91af"&gt;SessionSecurityTokenHandler&lt;br&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;{&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;public&lt;/span&gt; WebFarmSessionSecurityTokenHandler(&lt;span style="color: #2b91af"&gt;X509Certificate2&lt;/span&gt; protectionCertificate)&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;: &lt;span style="color: blue"&gt;base&lt;/span&gt;(CreateRsaTransforms(protectionCertificate))&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{
}&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;
&lt;o:p&gt;&amp;nbsp;&lt;br&gt;
&lt;/o:p&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;private&lt;/span&gt; &lt;span style="color: blue"&gt;static&lt;/span&gt; &lt;span style="color: #2b91af"&gt;ReadOnlyCollection&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;CookieTransform&lt;/span&gt;&amp;gt;
CreateRsaTransforms&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (&lt;span style="color: #2b91af"&gt;X509Certificate2&lt;/span&gt; protectionCertificate)&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;var&lt;/span&gt; transforms
= &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;CookieTransform&lt;/span&gt;&amp;gt;() 
&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{ 
&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;DeflateCookieTransform&lt;/span&gt;(), 
&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;RsaEncryptionCookieTransform&lt;/span&gt;(protectionCertificate),&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;RsaSignatureCookieTransform&lt;/span&gt;(protectionCertificate),&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;};&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;
&lt;o:p&gt;&amp;nbsp;&lt;br&gt;
&lt;/o:p&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;return&lt;/span&gt; transforms.AsReadOnly();&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: consolas; mso-no-proof: yes"&gt;}&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; mso-no-proof: yes"&gt;}&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
One way of wiring up the above handler would be a service host factory for the WIF
enabled WCF service. If you want to put a little more work in it you can also make
the handler configuration friendly (see &lt;a href="http://www.leastprivilege.com/WIFConfigurationNdashPart3Extensibility.aspx"&gt;here&lt;/a&gt;).
&lt;/p&gt;
&lt;p&gt;
In general I’d recommend watching Hervey’s excellent &lt;a href="http://microsoftpdc.com/Sessions/SVC17"&gt;talk&lt;/a&gt; from
PDC09 about WIF in load balanced environments (e.g. Azure).
&lt;/p&gt;
&lt;p&gt;
HTH
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=fb85fdf8-59ed-4feb-a289-cc3aea31b2d5" /&gt;</description>
      <category>IdentityModel</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=4d1c9537-63d8-43af-a792-1c07ae82d73a</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=4d1c9537-63d8-43af-a792-1c07ae82d73a</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <title>Securing WCF Data Services using WIF</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=4d1c9537-63d8-43af-a792-1c07ae82d73a</guid>
      <link>http://www.leastprivilege.com/SecuringWCFDataServicesUsingWIF.aspx</link>
      <pubDate>Mon, 15 Feb 2010 13:48:40 GMT</pubDate>
      <description>&lt;p&gt;
This questions comes up every once in a while..
&lt;/p&gt;
&lt;p&gt;
Since WCF Data Services is just a normal WCF service (using the web programming model),
all the typical security APIs and extensibility points apply.
&lt;/p&gt;
&lt;p&gt;
That said, depending on your scenario you might have to be a little more creative
for REST-style services. Here’s a quick walkthrough:
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Enabling WIF in the Data Service&lt;br&gt;
&lt;/strong&gt;The easiest way to get WIF wired up is by writing a custom service host factory.
You simply have to derive from &lt;em&gt;DataServiceHostFactory&lt;/em&gt;, override &lt;em&gt;CreateServiceHost&lt;/em&gt; and
call &lt;em&gt;FederatedServiceCredentials.ConfigureServiceHost&lt;/em&gt; before you return the
host to the plumbing.
&lt;/p&gt;
&lt;p&gt;
This gives you the standard WIF integration for all standard HTTP credential types
(Basic, Integrated etc…) and the typical extensibility points like &lt;em&gt;ClaimsAuthorizationManager&lt;/em&gt;.
&lt;/p&gt;
&lt;p&gt;
For accepting and converting more advanced token types like SWT or SAML, you need
to plugin your own token handling. I gave it a try for SWT tokens (see &lt;a href="http://www.leastprivilege.com/IntegratingSimpleWebTokensSWTWithWCFRESTServicesUsingWIF.aspx"&gt;here&lt;/a&gt; for
the general SWT integration story).
&lt;/p&gt;
&lt;p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;
&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;public&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt; &lt;span style="color: blue"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af"&gt;ProtectedDataServiceHostFactory&lt;/span&gt; : &lt;span style="color: #2b91af"&gt;DataServiceHostFactory&lt;br&gt;
&lt;/span&gt;{&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;protected&lt;/span&gt; &lt;span style="color: blue"&gt;override&lt;/span&gt; &lt;span style="color: #2b91af"&gt;ServiceHost&lt;/span&gt; CreateServiceHost(&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Type&lt;/span&gt; serviceType, &lt;span style="color: #2b91af"&gt;Uri&lt;/span&gt;[]
baseAddresses)&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal"&gt;
&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
var&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt; host
= &lt;span style="color: blue"&gt;base&lt;/span&gt;.CreateServiceHost(serviceType, baseAddresses);&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;host.Authorization.ServiceAuthorizationManager
= &lt;span style="color: blue"&gt;new&lt;/span&gt; 
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;SimpleWebTokenAuthorizationManager&lt;/span&gt;(&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;acsAddress,&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;expectedAudience,&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;acsKey);&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;host.Authorization.PrincipalPermissionMode
= 
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;PrincipalPermissionMode&lt;/span&gt;.Custom;&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;return&lt;/span&gt; host;&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;}&lt;/span&gt;
&lt;/p&gt;
&lt;p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;
This uses my SWT &lt;a href="http://www.leastprivilege.com/IntegratingSimpleWebTokensSWTWithWCFRESTServicesUsingWIF.aspx"&gt;plumbing&lt;/a&gt; to
turn incoming SWT tokens into an &lt;em&gt;IClaimsPrincipal&lt;/em&gt;. You could easily do the
same thing for SAML (but be aware that SAML tokens can become quite big – and you
typically want to transmit them using an HTTP header for this scenario).
&lt;/p&gt;
&lt;p&gt;
You could now use the resulting claims for authorization as well as WCFDS interceptors,
e.g.:
&lt;/p&gt;
&lt;p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;
&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;[&lt;span style="color: #2b91af"&gt;QueryInterceptor&lt;/span&gt;(&lt;span style="color: #a31515"&gt;"Users"&lt;/span&gt;)]&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;public&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt; &lt;span style="color: #2b91af"&gt;Expression&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;Func&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;Users&lt;/span&gt;, &lt;span style="color: blue"&gt;bool&lt;/span&gt;&amp;gt;&amp;gt;
OnQueryUsers()&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;{&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;var&lt;/span&gt; principal
= &lt;span style="color: #2b91af"&gt;Thread&lt;/span&gt;.CurrentPrincipal &lt;span style="color: blue"&gt;as&lt;/span&gt; &lt;span style="color: #2b91af"&gt;IClaimsPrincipal&lt;/span&gt;;&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;var&lt;/span&gt; customer
= principal.GetClaimValue("&lt;span style="color: #a31515"&gt;http://claims/customerName"&lt;/span&gt;);&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;return&lt;/span&gt; user
=&amp;gt; user.Applications.ApplicationName == customer;&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; mso-no-proof: yes"&gt;}&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Sending a token header to the Data Service&lt;/strong&gt;
&lt;br&gt;
The next step is to send a token to the Data Service. This can be achieved by handling
the &lt;em&gt;SendingRequest&lt;/em&gt; event on the &lt;em&gt;DataServiceContext&lt;/em&gt; derived client
plumbing, e.g.:
&lt;/p&gt;
&lt;p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;
&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;class&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt; &lt;span style="color: #2b91af"&gt;ProviderEntitiesWithToken&lt;/span&gt; : &lt;span style="color: #2b91af"&gt;ProviderEntities&lt;br&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;{&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;string&lt;/span&gt; _token;&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;string&lt;/span&gt; _tokenHeader
= &lt;span style="color: #a31515"&gt;"Authorization"&lt;/span&gt;;&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&lt;?xml:namespace prefix = o /&gt;
&lt;o:p&gt;&amp;nbsp;&lt;br&gt;
&lt;/o:p&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;public&lt;/span&gt; ProviderEntitiesWithToken(&lt;span style="color: #2b91af"&gt;Uri&lt;/span&gt; address, &lt;span style="color: blue"&gt;string&lt;/span&gt; token)
: &lt;span style="color: blue"&gt;base&lt;/span&gt;(address)&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;_token
= token;&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;SendingRequest
+= OnSendingRequest;&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;
&lt;o:p&gt;&amp;nbsp;&lt;br&gt;
&lt;/o:p&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;void&lt;/span&gt; OnSendingRequest(&lt;span style="color: blue"&gt;object&lt;/span&gt; sender, &lt;span style="color: #2b91af"&gt;SendingRequestEventArgs&lt;/span&gt; e)&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;e.RequestHeaders[_tokenHeader]
= 
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: #2b91af"&gt;SimpleWebToken&lt;/span&gt;.GetAuthorizationHeader(_token);&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: consolas; mso-no-proof: yes"&gt;}&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; mso-no-proof: yes"&gt;}&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Using the Data Service&lt;/strong&gt;
&lt;br&gt;
The usage pattern is the same as without any tokens or WIF. New up your derived class,
set the token and use e.g. LINQ to query the Data Service.
&lt;/p&gt;
&lt;p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;
&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;static&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; Main(&lt;span style="color: blue"&gt;string&lt;/span&gt;[]
args)&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;{&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;var&lt;/span&gt; token
= RequestToken();&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;var&lt;/span&gt; service
= &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;ProviderEntitiesWithToken&lt;/span&gt;(&lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Uri&lt;/span&gt;(dataServiceAddress),
token);&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&lt;br&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;var&lt;/span&gt; users
= &lt;span style="color: blue"&gt;from&lt;/span&gt; u &lt;span style="color: blue"&gt;in&lt;/span&gt; service.Users&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;select&lt;/span&gt; u;&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;
&lt;o:p&gt;&amp;nbsp;&lt;br&gt;
&lt;/o:p&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;users.ToList().ForEach(u
=&amp;gt; &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(u.UserName));&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; mso-no-proof: yes"&gt;}&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
HTH
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=4d1c9537-63d8-43af-a792-1c07ae82d73a" /&gt;</description>
      <category>IdentityModel</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=5cb66ec9-5e79-4987-a9e9-7e71a0b231c0</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=5cb66ec9-5e79-4987-a9e9-7e71a0b231c0</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
The Simple Web Token (SWT) is a new &amp; simple token format that was created by
Microsoft, Google and others. See <a href="http://groups.google.com/group/oauth-wrap-wg">here</a> for
specs. The Azure platform App Fabric Access Control service e.g. uses this token type.
</p>
        <p>
Why yet another token type? Well – the advantages of SWT are that it is simple to
construct (form encoded key value pairs), that only simple crypto is needed (SHA256
HMACs) and that it is compact on the wire which allows easy embedding in HTTP headers
or query strings.
</p>
        <p>
The downsides are – it is not a widely adopted token format (current spec version
is 0.9.5.1) and the lack of asymmetric signatures (e.g. X.509 based).
</p>
        <p>
Since I had to do some ACS work recently, I crafted up a simple SWT integration for
WCF based REST services (works in ASP.NET as well). The plumbing looks for a SWT token
either on the Authorization or X-Authorization header as well as on the query string.
Using the power of WIF, it is simple to transform the SWT token into an <em>IClaimsPrincipal</em>. 
</p>
        <p>
From that point on, you have all the unified identity representation benefits of WIF.
</p>
        <p>
Download <a href="http://www.leastprivilege.com/content/binary/SWT4WCF.zip">here</a>.
</p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=5cb66ec9-5e79-4987-a9e9-7e71a0b231c0" />
      </body>
      <title>Integrating Simple Web Tokens (SWT) with WCF REST Services using WIF</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=5cb66ec9-5e79-4987-a9e9-7e71a0b231c0</guid>
      <link>http://www.leastprivilege.com/IntegratingSimpleWebTokensSWTWithWCFRESTServicesUsingWIF.aspx</link>
      <pubDate>Mon, 08 Feb 2010 14:30:41 GMT</pubDate>
      <description>&lt;p&gt;
The Simple Web Token (SWT) is a new &amp;amp; simple token format that was created by
Microsoft, Google and others. See &lt;a href="http://groups.google.com/group/oauth-wrap-wg"&gt;here&lt;/a&gt; for
specs. The Azure platform App Fabric Access Control service e.g. uses this token type.
&lt;/p&gt;
&lt;p&gt;
Why yet another token type? Well – the advantages of SWT are that it is simple to
construct (form encoded key value pairs), that only simple crypto is needed (SHA256
HMACs) and that it is compact on the wire which allows easy embedding in HTTP headers
or query strings.
&lt;/p&gt;
&lt;p&gt;
The downsides are – it is not a widely adopted token format (current spec version
is 0.9.5.1) and the lack of asymmetric signatures (e.g. X.509 based).
&lt;/p&gt;
&lt;p&gt;
Since I had to do some ACS work recently, I crafted up a simple SWT integration for
WCF based REST services (works in ASP.NET as well). The plumbing looks for a SWT token
either on the Authorization or X-Authorization header as well as on the query string.
Using the power of WIF, it is simple to transform the SWT token into an &lt;em&gt;IClaimsPrincipal&lt;/em&gt;. 
&lt;/p&gt;
&lt;p&gt;
From that point on, you have all the unified identity representation benefits of WIF.
&lt;/p&gt;
&lt;p&gt;
Download &lt;a href="http://www.leastprivilege.com/content/binary/SWT4WCF.zip"&gt;here&lt;/a&gt;.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=5cb66ec9-5e79-4987-a9e9-7e71a0b231c0" /&gt;</description>
      <category>IdentityModel</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=88d87693-4c69-4639-9a55-2bcf8db30987</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=88d87693-4c69-4639-9a55-2bcf8db30987</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <title>Using SAML as a Client Credential Type in WCF (updated to WIF RTM)</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=88d87693-4c69-4639-9a55-2bcf8db30987</guid>
      <link>http://www.leastprivilege.com/UsingSAMLAsAClientCredentialTypeInWCFUpdatedToWIFRTM.aspx</link>
      <pubDate>Fri, 05 Feb 2010 06:44:39 GMT</pubDate>
      <description>&lt;p&gt;
A reader has asked me to update the Client SAML sample to WIF RTM (for background
and motivation please read &lt;a href="http://www.leastprivilege.com/UsingSAMLAsAClientCredentialTypeInWCFWithGeneva.aspx"&gt;here&lt;/a&gt; first).
&lt;/p&gt;
&lt;p&gt;
The main work was in the SAML security token handler Validate method, this looks now
like this:
&lt;/p&gt;
&lt;p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;
&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;public&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt; &lt;span style="color: blue"&gt;override&lt;/span&gt; &lt;span style="color: #2b91af"&gt;ClaimsIdentityCollection&lt;/span&gt; ValidateToken(&lt;span style="color: #2b91af"&gt;SecurityToken&lt;/span&gt; token)&lt;br&gt;
{&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;if&lt;/span&gt; (token
== &lt;span style="color: blue"&gt;null&lt;/span&gt;)&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;throw&lt;/span&gt; &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;ArgumentNullException&lt;/span&gt;(&lt;span style="color: #a31515"&gt;"token"&lt;/span&gt;);&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
&lt;br&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;var&lt;/span&gt; samlToken
= token &lt;span style="color: blue"&gt;as&lt;/span&gt; &lt;span style="color: #2b91af"&gt;SamlSecurityToken&lt;/span&gt;;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;if&lt;/span&gt; (samlToken
== &lt;span style="color: blue"&gt;null&lt;/span&gt;)&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;throw&lt;/span&gt; &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;ArgumentException&lt;/span&gt;(&lt;span style="color: #a31515"&gt;"token"&lt;/span&gt;);&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;if&lt;/span&gt; (samlToken.Assertion
== &lt;span style="color: blue"&gt;null&lt;/span&gt;)&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;throw&lt;/span&gt; &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;ArgumentException&lt;/span&gt;(&lt;span style="color: #a31515"&gt;"token"&lt;/span&gt;);&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;var&lt;/span&gt; assertion
= samlToken.Assertion &lt;span style="color: blue"&gt;as&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Saml11Assertion&lt;/span&gt;;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;this&lt;/span&gt;.ValidateConditions(samlToken.Assertion.Conditions, &lt;span style="color: blue"&gt;false&lt;/span&gt;);&lt;br&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green"&gt;//
extract claims from token&lt;/span&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;var&lt;/span&gt; identity
= &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;ClaimsIdentity&lt;/span&gt;(&lt;span style="color: #a31515"&gt;"ClientSaml"&lt;/span&gt;);&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;ProcessStatement(assertion.Statements,
identity, &lt;span style="color: #a31515"&gt;"Client"&lt;/span&gt;);&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green"&gt;//
call authentication and filtering logic&lt;/span&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;IClaimsIdentity&lt;/span&gt; newIdentity;&lt;br&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;try&lt;/span&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;if&lt;/span&gt; (ValidateUser(identity, &lt;span style="color: blue"&gt;out&lt;/span&gt; newIdentity))&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;return&lt;/span&gt; &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;ClaimsIdentityCollection&lt;/span&gt;(&lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;IClaimsIdentity&lt;/span&gt;[]
{ newIdentity });&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;else&lt;/span&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;throw&lt;/span&gt; &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;SecurityTokenValidationException&lt;/span&gt;(&lt;span style="color: #a31515"&gt;"Authentication
failed"&lt;/span&gt;);&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;catch&lt;/span&gt; (&lt;span style="color: #2b91af"&gt;Exception&lt;/span&gt; ex)&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;throw&lt;/span&gt; &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;SecurityTokenValidationException&lt;/span&gt;(&lt;span style="color: #a31515"&gt;"Security
token validation failed"&lt;/span&gt;, ex);&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br&gt;&lt;?xml:namespace prefix = o /&gt;
}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
You would then derive from the base handler and implement the &lt;em&gt;ValidateUser&lt;/em&gt; method.
This method does some sort of authentication based on the incoming claims and returns
an &lt;em&gt;IClaimsIdentity &lt;/em&gt;containing the claims that should get passed through to
the service code, e.g.:
&lt;/p&gt;
&lt;p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;
&lt;span style="font-family: consolas; color: green; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;//
sample implementation - do not use for production ;)&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;protected&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt; &lt;span style="color: blue"&gt;override&lt;/span&gt; &lt;span style="color: blue"&gt;bool&lt;/span&gt; ValidateUser(&lt;span style="color: #2b91af"&gt;ClaimsIdentity&lt;/span&gt; id, &lt;span style="color: blue"&gt;out&lt;/span&gt; &lt;span style="color: #2b91af"&gt;IClaimsIdentity&lt;/span&gt; newIdentity)&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;{&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;newIdentity = &lt;span style="color: blue"&gt;null&lt;/span&gt;;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;var&lt;/span&gt; usernameClaim
= id.Claims.First(c =&amp;gt; c.ClaimType == &lt;span style="color: #2b91af"&gt;WSIdentityConstants&lt;/span&gt;.&lt;span style="color: #2b91af"&gt;ClaimTypes&lt;/span&gt;.Name);&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;var&lt;/span&gt; passwordClaim
= id.Claims.First(c =&amp;gt; c.ClaimType == _passwordClaimType);&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;var&lt;/span&gt; customerIdClaim
= id.Claims.First(c =&amp;gt; c.ClaimType == _customerIdClaimType);&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;if&lt;/span&gt; (usernameClaim.Value
== passwordClaim.Value)&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;newIdentity
= &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;ClaimsIdentity&lt;/span&gt;(&lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Claim&lt;/span&gt;[] 
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;usernameClaim,&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;customerIdClaim&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}, &lt;span style="color: #a31515"&gt;"ClientSaml"&lt;/span&gt;);&lt;br&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;return&lt;/span&gt; &lt;span style="color: blue"&gt;true&lt;/span&gt;;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;return&lt;/span&gt; &lt;span style="color: blue"&gt;false&lt;/span&gt;;&lt;br&gt;
}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
You can find the complete source code &lt;a href="http://www.leastprivilege.com/content/binary/ClientSamlCredentialRTM.zip"&gt;here&lt;/a&gt;.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=88d87693-4c69-4639-9a55-2bcf8db30987" /&gt;</description>
      <category>IdentityModel</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=e0d46819-6126-4715-b263-ce26802d885f</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=e0d46819-6126-4715-b263-ce26802d885f</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
OK – I finally was able to carve out some time…This is the first feature complete
release of the <a href="http://startersts.codeplex.com/">StarterSTS</a>!
</p>
        <p>
          <strong>New features include:</strong>
        </p>
        <ul>
          <li>
client certificate support for WS-Fed and WS-Trust endpoints 
</li>
          <li>
new relying party configuration 
<ul><li>
allows specifying an explicit reply to address 
</li><li>
allows relying parties without encryption</li></ul></li>
          <li>
refactoring of web site / STS code.</li>
        </ul>
        <p>
Still no docs – sorry. Please contact me via the <a href="http://startersts.codeplex.com/Thread/List.aspx">Codeplex</a> forum
if you have any questions.
</p>
        <p>
          <strong>Some brief migration remarks:</strong>
        </p>
        <ul>
          <li>
relying parties are now configured in relyingParties.config. Move the RP entries from
certificates.config to this new config file 
</li>
          <li>
userMappings.config allows mapping client certificates to membership users 
</li>
          <li>
profile configuration has been moved to profile.config</li>
        </ul>
        <p>
          <strong>On the todo list:</strong>
        </p>
        <ul>
          <li>
documentation 
</li>
          <li>
simplified installation 
</li>
          <li>
IIS InetMgr integration for all configuration aspects</li>
        </ul>
        <p>
          <strong>What I need from you:</strong>
        </p>
        <ul>
          <li>
testers! 
</li>
          <li>
input and feedback 
</li>
          <li>
volunteers for completing the todos</li>
        </ul>
        <p>
Have fun!
</p>
        <p>
download here: <a title="http://startersts.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=39891" href="http://startersts.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=39891">http://startersts.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=39891</a></p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=e0d46819-6126-4715-b263-ce26802d885f" />
      </body>
      <title>StarterSTS V1.0 Beta 1</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=e0d46819-6126-4715-b263-ce26802d885f</guid>
      <link>http://www.leastprivilege.com/StarterSTSV10Beta1.aspx</link>
      <pubDate>Wed, 03 Feb 2010 21:22:22 GMT</pubDate>
      <description>&lt;p&gt;
OK – I finally was able to carve out some time…This is the first feature complete
release of the &lt;a href="http://startersts.codeplex.com/"&gt;StarterSTS&lt;/a&gt;!
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;New features include:&lt;/strong&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
client certificate support for WS-Fed and WS-Trust endpoints 
&lt;li&gt;
new relying party configuration 
&lt;ul&gt;
&lt;li&gt;
allows specifying an explicit reply to address 
&lt;li&gt;
allows relying parties without encryption&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
refactoring of web site / STS code.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Still no docs – sorry. Please contact me via the &lt;a href="http://startersts.codeplex.com/Thread/List.aspx"&gt;Codeplex&lt;/a&gt; forum
if you have any questions.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Some brief migration remarks:&lt;/strong&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
relying parties are now configured in relyingParties.config. Move the RP entries from
certificates.config to this new config file 
&lt;li&gt;
userMappings.config allows mapping client certificates to membership users 
&lt;li&gt;
profile configuration has been moved to profile.config&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;strong&gt;On the todo list:&lt;/strong&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
documentation 
&lt;li&gt;
simplified installation 
&lt;li&gt;
IIS InetMgr integration for all configuration aspects&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;strong&gt;What I need from you:&lt;/strong&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
testers! 
&lt;li&gt;
input and feedback 
&lt;li&gt;
volunteers for completing the todos&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Have fun!
&lt;/p&gt;
&lt;p&gt;
download here: &lt;a title="http://startersts.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=39891" href="http://startersts.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=39891"&gt;http://startersts.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=39891&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=e0d46819-6126-4715-b263-ce26802d885f" /&gt;</description>
      <category>IdentityModel</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=30ec6c85-b144-47bc-bc06-d0cfce567fce</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=30ec6c85-b144-47bc-bc06-d0cfce567fce</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <title>Testing Security Code with Moles</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=30ec6c85-b144-47bc-bc06-d0cfce567fce</guid>
      <link>http://www.leastprivilege.com/TestingSecurityCodeWithMoles.aspx</link>
      <pubDate>Mon, 01 Feb 2010 10:36:20 GMT</pubDate>
      <description>&lt;p&gt;
I am by far no (unit) testing expert. But I always found it odd that I sometimes have
to re-structure code to make it explicitly unit-testable.
&lt;/p&gt;
&lt;p&gt;
One typical example is code that relies on some sort of context – e.g. Thread.CurrentPrincipal.
I personally like this pattern in the .NET Framework – but it is not ideal for testing.
&lt;/p&gt;
&lt;p&gt;
Recently I ran across Moles which is a mocking and stubs framework from Microsoft
Research which has some features that can help here. Inspired by this &lt;a href="http://channel9.msdn.com/posts/Peli/Moles-Replace-any-NET-method-with-a-delegate/"&gt;video&lt;/a&gt; –
I gave it a try. 
&lt;/p&gt;
&lt;p&gt;
The following code allows “faking” Thread.CurrentPrincipal:
&lt;/p&gt;
&lt;p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;
&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;using&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt; System.Security.Principal;&lt;br&gt;
&lt;span style="color: blue"&gt;using&lt;/span&gt; System.Threading.Moles;&lt;br&gt;
&lt;span style="color: blue"&gt;using&lt;/span&gt; Microsoft.Moles.Framework;&lt;br&gt;
&lt;span style="color: blue"&gt;using&lt;/span&gt; Microsoft.VisualStudio.TestTools.UnitTesting;&lt;br&gt;
&lt;br&gt;
&lt;b style="mso-bidi-font-weight: normal"&gt;[&lt;span style="color: blue"&gt;assembly&lt;/span&gt;: &lt;span style="color: #2b91af"&gt;MoledType&lt;/span&gt;(&lt;span style="color: blue"&gt;typeof&lt;/span&gt;(System.Threading.&lt;span style="color: #2b91af"&gt;Thread&lt;/span&gt;))]&lt;br&gt;
&lt;/b&gt;
&lt;br&gt;
&lt;span style="color: blue"&gt;namespace&lt;/span&gt; SecurityTest&lt;br&gt;
{&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;[&lt;span style="color: #2b91af"&gt;TestClass&lt;/span&gt;]&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af"&gt;UnitTest1&lt;/span&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;[&lt;span style="color: #2b91af"&gt;TestMethod&lt;/span&gt;]&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b style="mso-bidi-font-weight: normal"&gt;[&lt;span style="color: #2b91af"&gt;HostType&lt;/span&gt;(&lt;span style="color: #a31515"&gt;"Moles"&lt;/span&gt;)]&lt;/b&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; TestSecurityCode()&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b style="mso-bidi-font-weight: normal"&gt;&lt;span style="color: #2b91af"&gt;MThread&lt;/span&gt;.CurrentPrincipalGet
= () =&amp;gt; 
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;GenericPrincipal&lt;/span&gt;(&lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;GenericIdentity&lt;/span&gt;(&lt;span style="color: #a31515"&gt;"dominick"&lt;/span&gt;), &lt;span style="color: blue"&gt;null&lt;/span&gt;);&lt;/b&gt;
&lt;br&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;var&lt;/span&gt; security
= &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;SecurityCode&lt;/span&gt;();&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;var&lt;/span&gt; user
= security.SomeMethod();&lt;br&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.AreEqual(&lt;span style="color: #a31515"&gt;"dominick"&lt;/span&gt;,
user);&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af"&gt;SecurityCode&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;string&lt;/span&gt; SomeMethod()&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green"&gt;//
simulates context&lt;/span&gt;&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Thread&lt;/span&gt;.CurrentPrincipal
= &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;GenericPrincipal&lt;/span&gt;(&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;GenericIdentity&lt;/span&gt;(&lt;span style="color: #a31515"&gt;"bob"&lt;/span&gt;), &lt;span style="color: blue"&gt;null&lt;/span&gt;);&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;return&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Thread&lt;/span&gt;.CurrentPrincipal.Identity.Name;&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br&gt;
}&lt;/span&gt;
&lt;/p&gt;
&lt;p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;
&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&lt;span style="color: #2b91af"&gt;&lt;?xml:namespace prefix = o /&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=30ec6c85-b144-47bc-bc06-d0cfce567fce" /&gt;</description>
      <category>Misc</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=1052867f-bd48-4f47-9e93-81cdb1cd8a50</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=1052867f-bd48-4f47-9e93-81cdb1cd8a50</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Get it here!!!
</p>
        <p>
          <a href="http://msdn.microsoft.com/en-us/library/ff359115.aspx">http://msdn.microsoft.com/en-us/library/ff359115.aspx</a>
        </p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=1052867f-bd48-4f47-9e93-81cdb1cd8a50" />
      </body>
      <title>A Guide to Claims-Based Identity and Access Control</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=1052867f-bd48-4f47-9e93-81cdb1cd8a50</guid>
      <link>http://www.leastprivilege.com/AGuideToClaimsBasedIdentityAndAccessControl.aspx</link>
      <pubDate>Mon, 01 Feb 2010 07:48:16 GMT</pubDate>
      <description>&lt;p&gt;
Get it here!!!
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://msdn.microsoft.com/en-us/library/ff359115.aspx"&gt;http://msdn.microsoft.com/en-us/library/ff359115.aspx&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=1052867f-bd48-4f47-9e93-81cdb1cd8a50" /&gt;</description>
      <category>IdentityModel</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=880cf11a-c3f8-4a4d-bcca-c16589e5f8a6</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=880cf11a-c3f8-4a4d-bcca-c16589e5f8a6</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
The last six months we were working on finalizing the P&amp;P guide to claims based
identity and access control. We finally have a release candidate!
</p>
        <p>
Eugenio has all the details <a href="http://blogs.msdn.com/eugeniop/archive/2009/12/21/updated-code-samples-chapters-for-claims-identity-guide-release-candidate.aspx">here</a>.
As always, feedback is welcome!
</p>
        <p>
Enjoy!
</p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=880cf11a-c3f8-4a4d-bcca-c16589e5f8a6" />
      </body>
      <title>Claims Identity Guide &amp;ndash; Release Candidate</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=880cf11a-c3f8-4a4d-bcca-c16589e5f8a6</guid>
      <link>http://www.leastprivilege.com/ClaimsIdentityGuideNdashReleaseCandidate.aspx</link>
      <pubDate>Tue, 05 Jan 2010 05:37:21 GMT</pubDate>
      <description>&lt;p&gt;
The last six months we were working on finalizing the P&amp;amp;P guide to claims based
identity and access control. We finally have a release candidate!
&lt;/p&gt;
&lt;p&gt;
Eugenio has all the details &lt;a href="http://blogs.msdn.com/eugeniop/archive/2009/12/21/updated-code-samples-chapters-for-claims-identity-guide-release-candidate.aspx"&gt;here&lt;/a&gt;.
As always, feedback is welcome!
&lt;/p&gt;
&lt;p&gt;
Enjoy!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=880cf11a-c3f8-4a4d-bcca-c16589e5f8a6" /&gt;</description>
      <category>IdentityModel</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=50f313f9-d109-419a-a01b-77ef3c6057ea</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=50f313f9-d109-419a-a01b-77ef3c6057ea</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Most samples I know of – as well as FedUtil generated configuration set a <em>preCondition="managedHandler"</em> for
the WIF HTTP modules.
</p>
        <p>
This means that the modules (and thus the protection of the requested resource) only
kicks in for “managed” content like .aspx files. <strong>Not</strong> for static content
like .xml etc.
</p>
        <p>
If you like to protect static content using WIF, you have to remove the <em>preCondition</em> in <em>web.config</em>.
Also add the <em>runAllManagedModulesForAllRequests</em> attribute to the <em>modules</em> section
in <em>system.webServer</em> if you are using ASP.NET URL Authorization. Subtle security
hole…
</p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=50f313f9-d109-419a-a01b-77ef3c6057ea" />
      </body>
      <title>Beware of WIF HTTP Modules and Default Configuration</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=50f313f9-d109-419a-a01b-77ef3c6057ea</guid>
      <link>http://www.leastprivilege.com/BewareOfWIFHTTPModulesAndDefaultConfiguration.aspx</link>
      <pubDate>Thu, 24 Dec 2009 10:49:24 GMT</pubDate>
      <description>&lt;p&gt;
Most samples I know of – as well as FedUtil generated configuration set a &lt;em&gt;preCondition="managedHandler"&lt;/em&gt; for
the WIF HTTP modules.
&lt;/p&gt;
&lt;p&gt;
This means that the modules (and thus the protection of the requested resource) only
kicks in for “managed” content like .aspx files. &lt;strong&gt;Not&lt;/strong&gt; for static content
like .xml etc.
&lt;/p&gt;
&lt;p&gt;
If you like to protect static content using WIF, you have to remove the &lt;em&gt;preCondition&lt;/em&gt; in &lt;em&gt;web.config&lt;/em&gt;.
Also add the &lt;em&gt;runAllManagedModulesForAllRequests&lt;/em&gt; attribute to the &lt;em&gt;modules&lt;/em&gt; section
in &lt;em&gt;system.webServer&lt;/em&gt; if you are using ASP.NET URL Authorization. Subtle security
hole…
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=50f313f9-d109-419a-a01b-77ef3c6057ea" /&gt;</description>
      <category>IdentityModel</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=797dded5-a50e-44b6-b164-892c7fe5ec26</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=797dded5-a50e-44b6-b164-892c7fe5ec26</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <title>WIF Configuration &amp;ndash; Part 3: Extensibility</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=797dded5-a50e-44b6-b164-892c7fe5ec26</guid>
      <link>http://www.leastprivilege.com/WIFConfigurationNdashPart3Extensibility.aspx</link>
      <pubDate>Thu, 24 Dec 2009 08:38:32 GMT</pubDate>
      <description>&lt;p&gt;
Some of the WIF configuration elements support extensibility. This means that you
can attach arbitrary XML child elements to the configuration elements. When this is
the case, the WIF configuration system creates the piece of plumbing in question using
a special ctor that takes an &lt;em&gt;XmlNodeList&lt;/em&gt; representing the custom configuration.
You can then parse the XML and configure the class accordingly. Examples are:
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;IssuerNameRegistry&lt;/strong&gt;
&lt;/p&gt;
&lt;p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;
&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-family: consolas; color: #a31515; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;issuerNameRegistry&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt; &lt;/span&gt;&lt;span style="font-family: consolas; color: red; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;type&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;=&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;"&lt;span style="color: blue"&gt;ConfigurationBasedIssuerNameRegistry,
...&lt;/span&gt;"&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;trustedIssuers&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;add&lt;/span&gt;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;foo&lt;/span&gt;"&lt;span style="color: blue"&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: red"&gt;thumbprint&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;xxx&lt;/span&gt;"&lt;span style="color: blue"&gt; /&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;trustedIssuers&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;issuerNameRegistry&lt;/span&gt;&lt;span style="color: blue"&gt;&lt;?xml:namespace prefix = o /&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;ClaimsAuthorizationManager&lt;br&gt;
(see &lt;a href="http://www.leastprivilege.com/ClaimsAuthorizationInGenevaBeta2Introduction.aspx"&gt;here&lt;/a&gt;)&lt;/strong&gt;
&lt;/p&gt;
&lt;p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;
&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-family: consolas; color: #a31515; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;claimsAuthorizationManager&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt; &lt;/span&gt;&lt;span style="font-family: consolas; color: red; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;type&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;=&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;"&lt;span style="color: blue"&gt;PolicyBasedAuthorizationManager&lt;/span&gt;"&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;policy&lt;/span&gt;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;resource&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;Directory&lt;/span&gt;"&lt;span style="color: blue"&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: red"&gt;action&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;Browse&lt;/span&gt;"&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;claim&lt;/span&gt;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;claimType&lt;/span&gt;&lt;span style="color: blue"&gt;="…"&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: red"&gt;claimValue&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;Users&lt;/span&gt;"&lt;span style="color: blue"&gt; /&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;policy&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;claimsAuthorizationManager&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal"&gt;
&lt;span style="mso-ansi-language: en-us" lang="EN-US"&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;SecurityTokenHandler&lt;br&gt;
(see &lt;a href="http://www.leastprivilege.com/UsingTheNETAccessControlServiceWithGeneva.aspx"&gt;here&lt;/a&gt;)&lt;/strong&gt;
&lt;/p&gt;
&lt;p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;
&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-family: consolas; color: #a31515; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;add&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt; &lt;/span&gt;&lt;span style="font-family: consolas; color: red; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;type&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;=&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;"&lt;span style="color: blue"&gt;Saml11SecurityTokenHandler,
...&lt;/span&gt;"&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;samlSecurityTokenRequirement&lt;/span&gt;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;issuerCertificateRevocationMode&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;Online&lt;/span&gt;"&lt;span style="color: blue"&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: red"&gt;issuerCertificateValidationMode&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;ChainTrust&lt;/span&gt;"&lt;span style="color: blue"&gt; /&amp;gt;&lt;br&gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;add&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=797dded5-a50e-44b6-b164-892c7fe5ec26" /&gt;</description>
      <category>IdentityModel</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=ef289c02-2b97-4408-a55b-206d168d23d3</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=ef289c02-2b97-4408-a55b-206d168d23d3</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <title>WIF Configuration &amp;ndash; Part 2: SecurityTokenHandlerConfiguration</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=ef289c02-2b97-4408-a55b-206d168d23d3</guid>
      <link>http://www.leastprivilege.com/WIFConfigurationNdashPart2SecurityTokenHandlerConfiguration.aspx</link>
      <pubDate>Wed, 23 Dec 2009 17:38:38 GMT</pubDate>
      <description>&lt;p&gt;
The workhorse of WIF are security token handler. Again token handler can be use independently
of the WIF configuration system – or together.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;The “stand-alone” use case&lt;/strong&gt;
&lt;br&gt;
You can simply new up a token handler (e.g. the SAML 1.1 handler) in an arbitrary
application. 
&lt;/p&gt;
&lt;p class="MsoNormal"&gt;
&lt;span style="font-family: consolas; color: blue; mso-no-proof: yes"&gt;var&lt;/span&gt;&lt;span style="font-family: consolas; mso-no-proof: yes"&gt; saml11Handler
= &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Saml11SecurityTokenHandler&lt;/span&gt;();&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
But a token handler needs more information to do its work (issuer name registry, audience
URIs, certificate validation etc.). This information is all encapsulated in the &lt;em&gt;SecurityTokenHandlerConfiguration&lt;/em&gt; class.
You can reach into that class from the token handler’s &lt;em&gt;Configuration&lt;/em&gt; property. &lt;em&gt;Configuration&lt;/em&gt; is
null by default and must be newed up and set manually.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Handler collections&lt;/strong&gt;
&lt;br&gt;
Another option is to group a bunch of token handlers into a collection. This is useful
when you have to deal with a number of in/output token types or need to chain token
handlers (e.g. for encryption or compression). Collections also allow to share token
handler configuration across contained handlers.
&lt;/p&gt;
&lt;p&gt;
When you new up a &lt;em&gt;SecurityTokenHandlerCollection&lt;/em&gt; you have the choice of passing
in a &lt;em&gt;SecurityTokenHandlerConfiguration&lt;/em&gt; instance, or you use a default configuration
(not sure if these values are documented – use reflector ;). When you add a handler
to a collection, the collection checks if the handler already has some configuration
set (by checking if &lt;em&gt;Configuration&lt;/em&gt; is not null). If this is not the case,
then handler inherits the collection configuration.
&lt;/p&gt;
&lt;p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;
&lt;span style="font-family: consolas; color: blue; mso-no-proof: yes; mso-ansi-language: en-us" lang="EN-US"&gt;var&lt;/span&gt;&lt;span style="font-family: consolas; mso-no-proof: yes; mso-ansi-language: en-us" lang="EN-US"&gt; samlHandlers
= &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;SecurityTokenHandlerCollection&lt;/span&gt;(&lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;SecurityTokenHandler&lt;/span&gt;[]&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;saml11Handler,&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Saml2SecurityTokenHandler&lt;/span&gt;()&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;?xml:namespace prefix = o /&gt;});&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
Another way to new up a handler collection is to use the static &lt;em&gt;CreateDefaultSecurityTokenHandlerCollection&lt;/em&gt; method
on the collection. This creates a collection with all default token handlers shipping
with WIF. Again you have the option to pass in a configuration object.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Using configuration&lt;br&gt;
&lt;/strong&gt;Token handler configuration is typically an ideal candidate for configuration
files. When you want to support that, you have two choices. Either copy the values
from configuration, or use the configuration system to create and configure the handler.
&lt;/p&gt;
&lt;p&gt;
Copying from configuration can be handy sometimes. To do that use the approach shown
in my &lt;a href="http://www.leastprivilege.com/WIFConfigurationNdashPart1ServiceConfiguration.aspx"&gt;previous&lt;/a&gt; post
to load the service configuration manually.
&lt;/p&gt;
&lt;p&gt;
The WIF security token handler configuration section also has the concept of named
handler collections. There is always a default token handler collection, but you can
have additional ones – each with their own configuration, e.g.: 
&lt;/p&gt;
&lt;p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;
&lt;span style="font-family: consolas; color: blue; mso-no-proof: yes; mso-ansi-language: en-us" lang="EN-US"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-family: consolas; color: #a31515; mso-no-proof: yes; mso-ansi-language: en-us" lang="EN-US"&gt;securityTokenHandlers&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-no-proof: yes; mso-ansi-language: en-us" lang="EN-US"&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;!--&lt;/span&gt;&lt;span style="font-family: consolas; color: green; mso-no-proof: yes; mso-ansi-language: en-us" lang="EN-US"&gt; default
token handlers - inherit global configuration settings &lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-no-proof: yes; mso-ansi-language: en-us" lang="EN-US"&gt;--&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-family: consolas; color: #a31515; mso-no-proof: yes; mso-ansi-language: en-us" lang="EN-US"&gt;securityTokenHandlerConfiguration&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-no-proof: yes; mso-ansi-language: en-us" lang="EN-US"&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;!--&lt;/span&gt;&lt;span style="font-family: consolas; color: green; mso-no-proof: yes; mso-ansi-language: en-us" lang="EN-US"&gt; override
with local configuration &lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-no-proof: yes; mso-ansi-language: en-us" lang="EN-US"&gt;--&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-family: consolas; color: #a31515; mso-no-proof: yes; mso-ansi-language: en-us" lang="EN-US"&gt;audienceUris&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-no-proof: yes; mso-ansi-language: en-us" lang="EN-US"&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-family: consolas; color: #a31515; mso-no-proof: yes; mso-ansi-language: en-us" lang="EN-US"&gt;add&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-no-proof: yes; mso-ansi-language: en-us" lang="EN-US"&gt; &lt;/span&gt;&lt;span style="font-family: consolas; color: red; mso-no-proof: yes; mso-ansi-language: en-us" lang="EN-US"&gt;value&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-no-proof: yes; mso-ansi-language: en-us" lang="EN-US"&gt;=&lt;/span&gt;&lt;span style="font-family: consolas; mso-no-proof: yes; mso-ansi-language: en-us" lang="EN-US"&gt;"&lt;span style="color: blue"&gt;http://bar&lt;/span&gt;"&lt;span style="color: blue"&gt; /&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;audienceUris&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;securityTokenHandlerConfiguration&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;securityTokenHandlers&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;
&lt;br&gt;
&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;securityTokenHandlers&lt;/span&gt;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;AccessToken&lt;/span&gt;"&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;!--&lt;/span&gt;&lt;span style="color: green"&gt; named
token handler collection - inherit global configuration settings &lt;/span&gt;&lt;span style="color: blue"&gt;--&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;securityTokenHandlerConfiguration&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;!--&lt;/span&gt;&lt;span style="color: green"&gt; override
with local configuration &lt;/span&gt;&lt;span style="color: blue"&gt;--&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;audienceUris&lt;/span&gt;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;mode&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;Always&lt;/span&gt;"&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;add&lt;/span&gt;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;value&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;http://custom/*&lt;/span&gt;"&lt;span style="color: blue"&gt; /&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;audienceUris&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;tokenReplayDetection&lt;/span&gt;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;enabled&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;true&lt;/span&gt;"&lt;span style="color: blue"&gt; /&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;certificateValidation&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;certificateValidator&lt;/span&gt;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;type&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;AccessCertValidation,
...&lt;/span&gt;"&lt;span style="color: blue"&gt;/&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;certificateValidation&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;securityTokenHandlerConfiguration&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;clear&lt;/span&gt;&lt;span style="color: blue"&gt; /&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;add&lt;/span&gt;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;type&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;AccessSecurityTokenHandler,
…&lt;/span&gt;"&lt;span style="color: blue"&gt; /&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;add&lt;/span&gt;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;type&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;CompressedSecurityTokenHandler,
…&lt;/span&gt;"&lt;span style="color: blue"&gt; /&amp;gt;&lt;br&gt;
&lt;br&gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;securityTokenHandlers&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
Programmatically, you can get to the standard token handler collection using the &lt;em&gt;SecurityTokenHandlers&lt;/em&gt; property
on &lt;em&gt;ServiceConfiguration&lt;/em&gt;.
&lt;/p&gt;
&lt;p&gt;
To get to the named token handlers, you use the &lt;em&gt;SecurityTokenHandlerCollectionManager&lt;/em&gt;,
e.g. like this:
&lt;/p&gt;
&lt;p class="MsoNormal"&gt;
&lt;span style="font-family: consolas; color: blue; mso-no-proof: yes; mso-ansi-language: en-us" lang="EN-US"&gt;var&lt;/span&gt;&lt;span style="font-family: consolas; mso-no-proof: yes; mso-ansi-language: en-us" lang="EN-US"&gt; accessHandlers
= config.SecurityTokenHandlerCollectionManager[&lt;span style="color: #a31515"&gt;"AccessToken"&lt;/span&gt;];&lt;/span&gt;&lt;span style="mso-ansi-language: en-us" lang="EN-US"&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;So as a rule of thumb:&lt;/strong&gt; when you new up handlers or collections yourself,
you are responsible for programmatic configuration. When you use &lt;em&gt;ServiceConfiguration&lt;/em&gt;,
the config file settings are applied automatically.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=ef289c02-2b97-4408-a55b-206d168d23d3" /&gt;</description>
      <category>IdentityModel</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=ba512d4c-5912-4864-87fc-3525caad9c4d</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=ba512d4c-5912-4864-87fc-3525caad9c4d</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <title>WIF Configuration &amp;ndash; Part 1: ServiceConfiguration</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=ba512d4c-5912-4864-87fc-3525caad9c4d</guid>
      <link>http://www.leastprivilege.com/WIFConfigurationNdashPart1ServiceConfiguration.aspx</link>
      <pubDate>Tue, 22 Dec 2009 09:34:59 GMT</pubDate>
      <description>&lt;p&gt;
WIF supports a flexible configuration system and various ways to programmatically
interact with that configuration.
&lt;/p&gt;
&lt;p&gt;
This flexibility comes in two ways:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Named configuration elements that you can selectively load (service &amp;amp; token handler
configuration) 
&lt;li&gt;
Configuration extensibility (e.g. for token handlers, issuer name registries or claims
authorization)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
In this first part I’ll focus on the service configuration.
&lt;/p&gt;
&lt;p&gt;
The WIF configuration can have several &lt;em&gt;service&lt;/em&gt; elements. Services can be
named, the unnamed element becomes the default configuration:
&lt;/p&gt;
&lt;p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;
&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-family: consolas; color: #a31515; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;microsoft.identityModel&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-family: consolas; color: #a31515; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;service&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;!--&lt;/span&gt;&lt;span style="font-family: consolas; color: green; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt; default
configuration &lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;--&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;/&lt;/span&gt;&lt;span style="font-family: consolas; color: #a31515; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;service&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&amp;gt;&lt;br&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-family: consolas; color: #a31515; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;service&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt; &lt;/span&gt;&lt;span style="font-family: consolas; color: red; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;name&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;=&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;"&lt;span style="color: blue"&gt;alternateConfiguration&lt;/span&gt;"&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;!--&lt;/span&gt;&lt;span style="color: green"&gt; alternate
configuration &lt;/span&gt;&lt;span style="color: blue"&gt;--&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;service&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;microsoft.identityModel&lt;/span&gt;&lt;span style="color: blue"&gt;&lt;?xml:namespace prefix = o /&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
You can get a handle to the configuration by newing up a &lt;em&gt;ServiceConfiguration&lt;/em&gt; object.
The ctor allows to optionally pass in the name of the service. From there on you have
an OM that represents the various configuration options.
&lt;/p&gt;
&lt;p&gt;
This is useful when you build your own integration, but for WCF and ASP.NET there
is already an infrastructure in place.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;How to couple configuration with a relying party&lt;br&gt;
&lt;/strong&gt;By default the standard hosting plumbing uses the default service configuration,
but there are various ways to make this dynamic (e.g. for different environment like
dev, staging etc).
&lt;/p&gt;
&lt;p&gt;
In ASP.NET you can subscribe to the &lt;em&gt;ServiceConfigurationCreated&lt;/em&gt; event of
the &lt;em&gt;FederatedAuthentication&lt;/em&gt; class. This event gets fired during initialization
and gives you the chance to load an arbitrary configuration and pass that back via
the &lt;em&gt;ServiceConfigurationCreatedEventArgs&lt;/em&gt;.&lt;br&gt;
You can then access the current configuration at any point via &lt;em&gt;FederatedAuthentication.ServiceConfiguration&lt;/em&gt; (since
creating a configuration is expensive, this class takes also care of caching). 
&lt;/p&gt;
&lt;p&gt;
In WCF you wire up WIF with by calling &lt;em&gt;FederatedServiceCredentials.ConfigureServiceHost(…)&lt;/em&gt;.
This call allows you to either pass in an instance of ServiceConfiguration or the
stringified name of the service. Another option is to use the &lt;em&gt;ConfigureServiceHostBehavior&lt;/em&gt; from
configuration. Again this behavior has a parameter called &lt;em&gt;serviceName&lt;/em&gt;.&lt;br&gt;
&lt;/p&gt;
&lt;p&gt;
You can then access the current configuration either by
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
finding the &lt;em&gt;FederatedServiceCredentials&lt;/em&gt; behavior from the &lt;em&gt;ServiceHost&lt;/em&gt; description
(if you have access to the &lt;em&gt;ServiceHost&lt;/em&gt;) 
&lt;li&gt;
obtain it from a &lt;em&gt;MessageProperty &lt;/em&gt;called &lt;em&gt;ServiceConfiguration&lt;/em&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
HTH
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=ba512d4c-5912-4864-87fc-3525caad9c4d" /&gt;</description>
      <category>ASP.NET</category>
      <category>IdentityModel</category>
      <category>WCF</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=85e6e7c5-1e07-472d-942d-c057191d69f1</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=85e6e7c5-1e07-472d-942d-c057191d69f1</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
The annual <a href="http://www.troopers.de">Troopers</a> conference takes place in
my home town – Heidelberg – this year. nice ;)
</p>
        <p>
If you wanna know more about all things security wrt e.g. Blackberry, SSL/TLS, outsourcing,
rootkits, botnets, SAP, cloud computing, you name it. This is the place to be.
</p>
        <p>
I will do a talk about the opportunities and risks of federated identity. See you
there!
</p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=85e6e7c5-1e07-472d-942d-c057191d69f1" />
      </body>
      <title>Troopers10</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=85e6e7c5-1e07-472d-942d-c057191d69f1</guid>
      <link>http://www.leastprivilege.com/Troopers10.aspx</link>
      <pubDate>Thu, 10 Dec 2009 07:49:52 GMT</pubDate>
      <description>&lt;p&gt;
The annual &lt;a href="http://www.troopers.de"&gt;Troopers&lt;/a&gt; conference takes place in
my home town – Heidelberg – this year. nice ;)
&lt;/p&gt;
&lt;p&gt;
If you wanna know more about all things security wrt e.g. Blackberry, SSL/TLS, outsourcing,
rootkits, botnets, SAP, cloud computing, you name it. This is the place to be.
&lt;/p&gt;
&lt;p&gt;
I will do a talk about the opportunities and risks of federated identity. See you
there!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=85e6e7c5-1e07-472d-942d-c057191d69f1" /&gt;</description>
      <category>Conferences</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=c8bb7aeb-7bea-4059-b9c4-738b6b2125ca</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=c8bb7aeb-7bea-4059-b9c4-738b6b2125ca</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
We had the pleasure to have a chat with Richard and Carl about what’s nearest and
dearest to my heart – WIF ;) Enjoy…
</p>
        <p>
          <a title="http://www.dotnetrocks.com/default.aspx?showNum=503" href="http://www.dotnetrocks.com/default.aspx?showNum=503">http://www.dotnetrocks.com/default.aspx?showNum=503</a>
        </p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=c8bb7aeb-7bea-4059-b9c4-738b6b2125ca" />
      </body>
      <title>Baier &amp;amp; Weyer on WIF</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=c8bb7aeb-7bea-4059-b9c4-738b6b2125ca</guid>
      <link>http://www.leastprivilege.com/BaierAmpWeyerOnWIF.aspx</link>
      <pubDate>Wed, 02 Dec 2009 20:21:15 GMT</pubDate>
      <description>&lt;p&gt;
We had the pleasure to have a chat with Richard and Carl about what’s nearest and
dearest to my heart – WIF ;) Enjoy…
&lt;/p&gt;
&lt;p&gt;
&lt;a title="http://www.dotnetrocks.com/default.aspx?showNum=503" href="http://www.dotnetrocks.com/default.aspx?showNum=503"&gt;http://www.dotnetrocks.com/default.aspx?showNum=503&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=c8bb7aeb-7bea-4059-b9c4-738b6b2125ca" /&gt;</description>
      <category>IdentityModel</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=aa9e7619-c444-465e-988b-f2d08abc1487</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=aa9e7619-c444-465e-988b-f2d08abc1487</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
This <a href="http://identitymodel.codeplex.com/">version</a> is compiled against
WIF RTM.
</p>
        <p>
Some stuff is still experimental. But feel free to play around ;)
</p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=aa9e7619-c444-465e-988b-f2d08abc1487" />
      </body>
      <title>Thinktecture.IdentityModel v0.6</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=aa9e7619-c444-465e-988b-f2d08abc1487</guid>
      <link>http://www.leastprivilege.com/ThinktectureIdentityModelV06.aspx</link>
      <pubDate>Thu, 26 Nov 2009 12:28:47 GMT</pubDate>
      <description>&lt;p&gt;
This &lt;a href="http://identitymodel.codeplex.com/"&gt;version&lt;/a&gt; is compiled against
WIF RTM.
&lt;/p&gt;
&lt;p&gt;
Some stuff is still experimental. But feel free to play around ;)
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=aa9e7619-c444-465e-988b-f2d08abc1487" /&gt;</description>
      <category>IdentityModel</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=20f00ca6-46c1-4d88-9dc5-43a7b2c76d34</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=20f00ca6-46c1-4d88-9dc5-43a7b2c76d34</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
It’s been a long way….
</p>
        <p>
          <a href="http://msdn.microsoft.com/en-us/evalcenter/dd440951.aspx">http://msdn.microsoft.com/en-us/evalcenter/dd440951.aspx</a>
        </p>
        <p>
I love it!
</p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=20f00ca6-46c1-4d88-9dc5-43a7b2c76d34" />
      </body>
      <title>IDFX to Zermatt to Geneva  &amp;hellip; to &amp;hellip; WIF RTM!</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=20f00ca6-46c1-4d88-9dc5-43a7b2c76d34</guid>
      <link>http://www.leastprivilege.com/IDFXToZermattToGenevaHellipToHellipWIFRTM.aspx</link>
      <pubDate>Wed, 18 Nov 2009 08:02:15 GMT</pubDate>
      <description>&lt;p&gt;
It’s been a long way….
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://msdn.microsoft.com/en-us/evalcenter/dd440951.aspx"&gt;http://msdn.microsoft.com/en-us/evalcenter/dd440951.aspx&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
I love it!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=20f00ca6-46c1-4d88-9dc5-43a7b2c76d34" /&gt;</description>
      <category>IdentityModel</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=ada45c48-8006-4b38-b3b7-2cafbd86732d</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=ada45c48-8006-4b38-b3b7-2cafbd86732d</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <a href="http://startersts.codeplex.com/">Updated</a> StarterRP to go with the 0.95
release of the StarterSTS.
</p>
        <p>
Changes include:
</p>
        <ul>
          <li>
added more SOAP endpoints to the WCF RP</li>
          <ul>
            <li>
message, mixed mode, simple (for Silverlight clients)</li>
          </ul>
          <li>
added a Silverlight client that can retrieve tokens and send them to RPs</li>
          <li>
added OpenID bridge test to the ASP.NET RP</li>
        </ul>
        <p>
Same disclaimer as <a href="http://www.leastprivilege.com/StarterSTSV095ForWIFRC.aspx">here</a> applies.
</p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=ada45c48-8006-4b38-b3b7-2cafbd86732d" />
      </body>
      <title>StarterRP v0.95 (for WIF RC)</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=ada45c48-8006-4b38-b3b7-2cafbd86732d</guid>
      <link>http://www.leastprivilege.com/StarterRPV095ForWIFRC.aspx</link>
      <pubDate>Wed, 11 Nov 2009 08:06:30 GMT</pubDate>
      <description>&lt;p&gt;
&lt;a href="http://startersts.codeplex.com/"&gt;Updated&lt;/a&gt; StarterRP to go with the 0.95
release of the StarterSTS.
&lt;/p&gt;
&lt;p&gt;
Changes include:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
added more SOAP endpoints to the WCF RP&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;
message, mixed mode, simple (for Silverlight clients)&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
added a Silverlight client that can retrieve tokens and send them to RPs&lt;/li&gt;
&lt;li&gt;
added OpenID bridge test to the ASP.NET RP&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Same disclaimer as &lt;a href="http://www.leastprivilege.com/StarterSTSV095ForWIFRC.aspx"&gt;here&lt;/a&gt; applies.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=ada45c48-8006-4b38-b3b7-2cafbd86732d" /&gt;</description>
      <category>IdentityModel</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=a784cf4f-62c6-4a0f-8415-2d699fcb2067</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=a784cf4f-62c6-4a0f-8415-2d699fcb2067</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I uploaded an interim release of the StarterSTS to <a href="http://startersts.codeplex.com/">codeplex</a>.
</p>
        <p>
This release is not fully tested – and is mainly available to provide compatibility
with WIF RC. There are some new features – and I hope I have not introduced any regression
bugs. Please contact me via the codeplex forum when you have questions.
</p>
        <p>
Some new features:
</p>
        <ul>
          <li>
added a simple HTTP and SOAP based endpoint to request token</li>
          <li>
added support to bridge OpenID logons to WS-Federation</li>
          <ul>
            <li>
you can specify a separate signing key for bridged authentication, so RPs can distinguish
between native and bridged authentication</li>
          </ul>
          <li>
config changes to accomodate the various endpoints</li>
          <ul>
            <li>
WS-Trust (message security)</li>
            <li>
WS-Trust (mixed mode security)</li>
            <li>
simple HTTP</li>
            <li>
simple SOAP</li>
            <li>
OpenID bridge</li>
            <li>
WS-Federation metadata</li>
          </ul>
          <li>
did some refactoring to allow easier pluggability and customizations</li>
          <ul>
            <li>
retrieving certificates (CertificateProvider)</li>
            <li>
retrieving claims (ClaimsProvider)</li>
            <li>
analyzing an RST (PolicyOptions and PolicyScope)</li>
            <li>
validating the request against configured policy (PolicyValidator)</li>
          </ul>
          <li>
added optional confirmation screen after login</li>
          <ul>
            <li>
when enabled, the user has to confirm before StarterSTS issues the token</li>
            <li>
this is an additional countermeasure against one-click attacks</li>
          </ul>
        </ul>
        <p>
Have fun.
</p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=a784cf4f-62c6-4a0f-8415-2d699fcb2067" />
      </body>
      <title>StarterSTS v0.95 (for WIF RC)</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=a784cf4f-62c6-4a0f-8415-2d699fcb2067</guid>
      <link>http://www.leastprivilege.com/StarterSTSV095ForWIFRC.aspx</link>
      <pubDate>Tue, 10 Nov 2009 18:07:02 GMT</pubDate>
      <description>&lt;p&gt;
I uploaded an interim release of the StarterSTS to &lt;a href="http://startersts.codeplex.com/"&gt;codeplex&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
This release is not fully tested – and is mainly available to provide compatibility
with WIF RC. There are some new features – and I hope I have not introduced any regression
bugs. Please contact me via the codeplex forum when you have questions.
&lt;/p&gt;
&lt;p&gt;
Some new features:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
added a simple HTTP and SOAP based endpoint to request token&lt;/li&gt;
&lt;li&gt;
added support to bridge OpenID logons to WS-Federation&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;
you can specify a separate signing key for bridged authentication, so RPs can distinguish
between native and bridged authentication&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
config changes to accomodate the various endpoints&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;
WS-Trust (message security)&lt;/li&gt;
&lt;li&gt;
WS-Trust (mixed mode security)&lt;/li&gt;
&lt;li&gt;
simple HTTP&lt;/li&gt;
&lt;li&gt;
simple SOAP&lt;/li&gt;
&lt;li&gt;
OpenID bridge&lt;/li&gt;
&lt;li&gt;
WS-Federation metadata&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
did some refactoring to allow easier pluggability and customizations&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;
retrieving certificates (CertificateProvider)&lt;/li&gt;
&lt;li&gt;
retrieving claims (ClaimsProvider)&lt;/li&gt;
&lt;li&gt;
analyzing an RST (PolicyOptions and PolicyScope)&lt;/li&gt;
&lt;li&gt;
validating the request against configured policy (PolicyValidator)&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
added optional confirmation screen after login&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;
when enabled, the user has to confirm before StarterSTS issues the token&lt;/li&gt;
&lt;li&gt;
this is an additional countermeasure against one-click attacks&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;p&gt;
Have fun.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=a784cf4f-62c6-4a0f-8415-2d699fcb2067" /&gt;</description>
      <category>IdentityModel</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=6269e417-d097-4660-99b6-8d4ffa373fd4</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=6269e417-d097-4660-99b6-8d4ffa373fd4</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
download <a href="http://identitymodel.codeplex.com">here</a>.
</p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=6269e417-d097-4660-99b6-8d4ffa373fd4" />
      </body>
      <title>Thinktecture.IdentityModel updated for WIF RC</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=6269e417-d097-4660-99b6-8d4ffa373fd4</guid>
      <link>http://www.leastprivilege.com/ThinktectureIdentityModelUpdatedForWIFRC.aspx</link>
      <pubDate>Sun, 08 Nov 2009 12:40:48 GMT</pubDate>
      <description>&lt;p&gt;
download &lt;a href="http://identitymodel.codeplex.com"&gt;here&lt;/a&gt;.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=6269e417-d097-4660-99b6-8d4ffa373fd4" /&gt;</description>
      <category>IdentityModel</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=e951a985-2466-4f30-a8ca-4b54f8839ee3</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=e951a985-2466-4f30-a8ca-4b54f8839ee3</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <title>Using Silverlight to Access WIF secured WCF Services</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=e951a985-2466-4f30-a8ca-4b54f8839ee3</guid>
      <link>http://www.leastprivilege.com/UsingSilverlightToAccessWIFSecuredWCFServices.aspx</link>
      <pubDate>Wed, 28 Oct 2009 08:04:00 GMT</pubDate>
      <description>&lt;p&gt;
This topic comes up quite often recently – so I hope the title is search engine friendly.
&lt;/p&gt;
&lt;p&gt;
Disclaimer: At the time of this writing, the current version of Silverlight is v3
and WIF is in beta 2. Hopefully this will be a non-issue soon.
&lt;/p&gt;
&lt;p&gt;
I talk a lot about claims, tokens and WIF/ADFS 2 to customers. All is good and fine
and they like it. Another technology that comes up very often is Silverlight – and
especially the “story” of Silverlight and WCF/WIF. Now this is not an easy question
to answer.
&lt;/p&gt;
&lt;p&gt;
When thinking about Silverlight and back-end security in general – there are two fundamental
scenarios – short of really good names – I call them “passive” and “active”.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Passive&lt;br&gt;
&lt;/strong&gt;With passive I mean, that the browser has already established a security
context with the back-end system the Silverlight .XAP uses (and typically is also
hosted at). An example would be that the user first authenticates with the web application
and then starts the Silverlight app from there. In this case all the authentication
related work was done by browser beforehand and all back-end requests simply re-transmit
authentication headers, cookies and the like.
&lt;/p&gt;
&lt;p&gt;
This is not different with WIF secured ASP.NET applications. Eugenio has a good example
of this &lt;a href="http://blogs.msdn.com/eugeniop/archive/2009/10/09/ria-services-and-windows-identity-foundation-claims-enabling-a-ria-application.aspx"&gt;here&lt;/a&gt;.
This approach works fine while running in the browser and using “application-local”
resources only.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Active&lt;/strong&gt;
&lt;br&gt;
This is the scenario I really want to talk about. In this case the .XAP comes from
some server down to the client (in or out-of-browser) and wants to communicate with
some back-end service on a different machine. This back-end service requires an issued
token from a STS.
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://www.leastprivilege.com/content/binary/SilverlightFederation.png"&gt; 
&lt;/p&gt;
&lt;p&gt;
Those of you with WCF background will say: “that’s what the federation bindings in
WCF are for”. But there is no federation binding in Silverlight.
&lt;/p&gt;
&lt;p&gt;
If you need to enable such a scenario, you have to use several workarounds.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Requesting a Token&lt;/strong&gt;
&lt;br&gt;
Since Silverlight has no support for WS-Trust, we must find another way to request
a token from a STS. Thanks to WIF this is not hard to do when you control the token
service. You could add a simple REST or SOAP head that returns tokens. I wrote about
this approach &lt;a href="http://www.leastprivilege.com/AddingARESTEndpointToAWIFTokenService.aspx"&gt;here&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
Some remarks here:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Since you cannot do the proof of possession crypto in Silverlight, you need to request
bearer tokens from the STS. 
&lt;li&gt;
The STS roundtrip is a cross-domain request. This means that the STS needs a client
access policy (see &lt;a href="http://msdn.microsoft.com/en-us/library/cc645032(VS.95).aspx"&gt;here&lt;/a&gt;). 
&lt;li&gt;
You have to somehow authenticate with the STS. Silverlight has no support for Kerberos
or client certificates. Basically you are stuck with some kind of userid/secret credential.
I wrote about that &lt;a href="http://www.leastprivilege.com/RestfulTokenServiceEndpointsAndSilverlightClients.aspx"&gt;here&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;strong&gt;Sending the token to the Service&lt;/strong&gt;
&lt;br&gt;
This is the slightly more complicated part. Since Silverlight has no support for issued
tokens, you have to manually embed the token in the outgoing SOAP security header.
This is not as scary as it sounds.
&lt;/p&gt;
&lt;p&gt;
There is the so called Basic Security Profile in WS-Security which allows sending
a simple security header with a timestamp and a token over SSL. This can be encapsulated
in a &lt;em&gt;MessageHeader&lt;/em&gt; derived class.
&lt;/p&gt;
&lt;span style="line-height: 115%; font-family: consolas; color: blue; font-size: 11pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: en-us; mso-fareast-language: en-us; mso-bidi-language: ar-sa; mso-no-proof: yes" lang="EN-US"&gt;public&lt;/span&gt;&lt;span style="line-height: 115%; font-family: consolas; font-size: 11pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: en-us; mso-fareast-language: en-us; mso-bidi-language: ar-sa; mso-no-proof: yes" lang="EN-US"&gt; &lt;span style="color: blue"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af"&gt;SecurityMessageHeader&lt;/span&gt; : &lt;span style="color: #2b91af"&gt;MessageHeader&lt;br&gt;
&lt;/span&gt;{&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;string&lt;/span&gt; _token;&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;string&lt;/span&gt; _nsUtility
= &lt;span style="color: #a31515"&gt;"..."&lt;/span&gt;;&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;public&lt;/span&gt; SecurityMessageHeader(&lt;span style="color: blue"&gt;string&lt;/span&gt; token) &lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;_token
= token;&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;protected&lt;/span&gt; &lt;span style="color: blue"&gt;override&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; OnWriteHeaderContents(&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;XmlDictionaryWriter&lt;/span&gt; writer, &lt;span style="color: #2b91af"&gt;MessageVersion&lt;/span&gt; messageVersion)&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;DateTime&lt;/span&gt; now
= &lt;span style="color: #2b91af"&gt;DateTime&lt;/span&gt;.UtcNow;&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;string&lt;/span&gt; created
= &lt;span style="color: #2b91af"&gt;XmlConvert&lt;/span&gt;.ToString(&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;now, &lt;span style="color: #a31515"&gt;"yyyy-MM-ddTHH:mm:ss.fffZ"&lt;/span&gt;);&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;string&lt;/span&gt; expires
= &lt;span style="color: #2b91af"&gt;XmlConvert&lt;/span&gt;.ToString(&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;now.AddMinutes(5), &lt;span style="color: #a31515"&gt;"yyyy-MM-ddTHH:mm:ss.fffZ"&lt;/span&gt;);&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;writer.WriteStartElement(&lt;span style="color: #a31515"&gt;"Timestamp"&lt;/span&gt;,
_nsUtility);&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;writer.WriteAttributeString(&lt;span style="color: #a31515"&gt;"Id"&lt;/span&gt;,
_nsUtility, &lt;span style="color: #a31515"&gt;"_0"&lt;/span&gt;);&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;writer.WriteElementString(&lt;span style="color: #a31515"&gt;"Created"&lt;/span&gt;,
_nsUtility, created);&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;writer.WriteElementString(&lt;span style="color: #a31515"&gt;"Expires"&lt;/span&gt;,
_nsUtility, expires);&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;writer.WriteEndElement();&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;writer.WriteNode(&lt;span style="color: #2b91af"&gt;XmlReader&lt;/span&gt;.Create(&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;StringReader&lt;/span&gt;(_token)), &lt;span style="color: blue"&gt;false&lt;/span&gt;);&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;override&lt;/span&gt; &lt;span style="color: blue"&gt;string&lt;/span&gt; Name&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;get&lt;/span&gt; { &lt;span style="color: blue"&gt;return&lt;/span&gt; &lt;span style="color: #a31515"&gt;"Security"&lt;/span&gt;;
}&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;override&lt;/span&gt; &lt;span style="color: blue"&gt;string&lt;/span&gt; Namespace&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;get&lt;/span&gt; { &lt;span style="color: blue"&gt;return&lt;/span&gt; &lt;span style="color: #a31515"&gt;"..."&lt;/span&gt;;
}&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;}&lt;/span&gt; 
&lt;p&gt;
Afterwards you can attach the header to outgoing calls:
&lt;/p&gt;
&lt;p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;
&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;var&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt; factory
= &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;ChannelFactory&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;ServiceContract&lt;/span&gt;&amp;gt;(&lt;span style="color: #a31515"&gt;"client"&lt;/span&gt;);&lt;br&gt;
&lt;span style="color: blue"&gt;var&lt;/span&gt; proxy = factory.CreateChannel();&lt;br&gt;
&lt;br&gt;
&lt;span style="color: blue"&gt;using&lt;/span&gt; (&lt;span style="color: blue"&gt;var&lt;/span&gt; scope
= &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;OperationContextScope&lt;/span&gt;(proxy &lt;span style="color: blue"&gt;as&lt;/span&gt; &lt;span style="color: #2b91af"&gt;IContextChannel&lt;/span&gt;))&lt;br&gt;
{&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;OperationContext&lt;/span&gt;.Current.OutgoingMessageHeaders.Add(&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;SecurityMessageHeader&lt;/span&gt;(token));&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;proxy.BeginOperation(result
=&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;...&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}, &lt;span style="color: blue"&gt;null&lt;/span&gt;);&lt;br&gt;&lt;?xml:namespace prefix = o /&gt;
}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
The binding on the client side is a binding with no client credential but SSL (the
binary encoder is not required and used only for performance):
&lt;/p&gt;
&lt;p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;
&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-family: consolas; color: #a31515; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;customBinding&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-family: consolas; color: #a31515; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;binding&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt; &lt;/span&gt;&lt;span style="font-family: consolas; color: red; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;name&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;=&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;"&lt;span style="color: blue"&gt;BearerTokensOverTransport&lt;/span&gt;"&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;binaryMessageEncoding&lt;/span&gt;&lt;span style="color: blue"&gt; /&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;httpsTransport &lt;/span&gt;&lt;span style="color: blue"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="color: blue"&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;binding&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;customBinding&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
On the service side, you need a binding that accepts bearer tokens over transport
security, like this:
&lt;/p&gt;
&lt;p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;
&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-family: consolas; color: #a31515; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;customBinding&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-family: consolas; color: #a31515; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;binding&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt; &lt;/span&gt;&lt;span style="font-family: consolas; color: red; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;name&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;=&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;"&lt;span style="color: blue"&gt;simple&lt;/span&gt;"&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;security&lt;/span&gt;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;authenticationMode&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;IssuedTokenOverTransport&lt;/span&gt;"&lt;span style="color: blue"&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: red"&gt;messageSecurityVersion&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;WSSecurity11&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;WSTrust13&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;WSSecureConversation13&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;WSSecurityPolicy12&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;BasicSecurityProfile10&lt;/span&gt;"&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;issuedTokenParameters&lt;/span&gt;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;keyType&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;BearerKey&lt;/span&gt;"&lt;span style="color: blue"&gt; /&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;security&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;binaryMessageEncoding&lt;/span&gt;&lt;span style="color: blue"&gt; /&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;httpsTransport&lt;/span&gt;&lt;span style="color: blue"&gt; /&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;binding&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;customBinding&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
The rest works as normal. You have to enable WIF in the service and you get your &lt;em&gt;IClaimsPrincipal&lt;/em&gt;.
&lt;/p&gt;
&lt;p&gt;
Some remarks:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Again this service needs a client access policy for Silverlight cross domain calls.&lt;/li&gt;
&lt;li&gt;
Keep in mind that these are bearer tokens. When you have a scenario that requires
proof of possession, this will not work&lt;/li&gt;
&lt;li&gt;
The SOAP response from the service will also contain a security header. Since the
client is not configured for security this header may be unexpected. Silverlight does
not seem to care, but other web service stacks might. In WCF you can work around that
problem by adding the &lt;em&gt;ValidateMustUnderstand&lt;/em&gt; behavior to the client stack.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
The complete code (STS extensions, Silverlight client and back-end service) is included
in the next drop of the StarterSTS (version 0.95). I will upload that soon.
&lt;/p&gt;
&lt;p&gt;
HTH
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=e951a985-2466-4f30-a8ca-4b54f8839ee3" /&gt;</description>
      <category>IdentityModel</category>
      <category>WCF</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=531a6655-e3ab-4ea6-b6df-910b4a977c23</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=531a6655-e3ab-4ea6-b6df-910b4a977c23</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Over the last years I have worked with several incarnations of what is now called
the Windows Identity Foundation (<a href="http://www.microsoft.com/wif">WIF</a>).
Throughout that time I continuously built a little helper library that made common
tasks easier to accomplish. Now that WIF is near to its release, I put that library
(now called <em>Thinktecture.IdentityModel</em>) on Codeplex.
</p>
        <p>
The library includes:
</p>
        <ul>
          <li>
Extension methods for 
</li>
          <ul>
            <li>
IClaimsIdentity, IClaimsPrincipal, IPrincipal</li>
            <li>
XmlElement, XElement, XmlReader</li>
            <li>
RSA, GenericXmlSecurityToken</li>
          </ul>
          <li>
Extensions to ClaimsAuthorizationManager (inspecting messages, custom principals)</li>
          <li>
Logging extensions for SecurityTokenService</li>
          <li>
Simple STS (e.g. for REST)</li>
          <li>
Helpers for WS-Federation message handling (e.g. as a replacement for the STS WebControl)</li>
          <li>
Sample security tokens and security token handlers</li>
          <ul>
            <li>
simple access token with expiration</li>
            <li>
compressed security token</li>
          </ul>
          <li>
API and configuration section for easy certificate loading</li>
          <li>
Diagnostics helpers</li>
          <li>
ASP.NET WebControl for invoking an identity selector (e.g. CardSpace)</li>
        </ul>
        <p>
I have also added some samples and a rudimentary API documentation. You can download
the whole package <a href="http://identitymodel.codeplex.com/">identitymodel.codeplex.com</a>.
</p>
        <p>
Feel free to contact me via the forum when you have questions or found a bug.
</p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=531a6655-e3ab-4ea6-b6df-910b4a977c23" />
      </body>
      <title>Thinktecture.IdentityModel</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=531a6655-e3ab-4ea6-b6df-910b4a977c23</guid>
      <link>http://www.leastprivilege.com/ThinktectureIdentityModel.aspx</link>
      <pubDate>Mon, 26 Oct 2009 17:01:47 GMT</pubDate>
      <description>&lt;p&gt;
Over the last years I have worked with several incarnations of what is now called
the Windows Identity Foundation (&lt;a href="http://www.microsoft.com/wif"&gt;WIF&lt;/a&gt;).
Throughout that time I continuously built a little helper library that made common
tasks easier to accomplish. Now that WIF is near to its release, I put that library
(now called &lt;em&gt;Thinktecture.IdentityModel&lt;/em&gt;) on Codeplex.
&lt;/p&gt;
&lt;p&gt;
The library includes:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Extension methods for 
&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;
IClaimsIdentity, IClaimsPrincipal, IPrincipal&lt;/li&gt;
&lt;li&gt;
XmlElement, XElement, XmlReader&lt;/li&gt;
&lt;li&gt;
RSA, GenericXmlSecurityToken&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
Extensions to ClaimsAuthorizationManager (inspecting messages, custom principals)&lt;/li&gt;
&lt;li&gt;
Logging extensions for SecurityTokenService&lt;/li&gt;
&lt;li&gt;
Simple STS (e.g. for REST)&lt;/li&gt;
&lt;li&gt;
Helpers for WS-Federation message handling (e.g. as a replacement for the STS WebControl)&lt;/li&gt;
&lt;li&gt;
Sample security tokens and security token handlers&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;
simple access token with expiration&lt;/li&gt;
&lt;li&gt;
compressed security token&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
API and configuration section for easy certificate loading&lt;/li&gt;
&lt;li&gt;
Diagnostics helpers&lt;/li&gt;
&lt;li&gt;
ASP.NET WebControl for invoking an identity selector (e.g. CardSpace)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
I have also added some samples and a rudimentary API documentation. You can download
the whole package &lt;a href="http://identitymodel.codeplex.com/"&gt;identitymodel.codeplex.com&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
Feel free to contact me via the forum when you have questions or found a bug.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=531a6655-e3ab-4ea6-b6df-910b4a977c23" /&gt;</description>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=46cb036c-8d6e-4251-8793-34f3ed98ae0a</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=46cb036c-8d6e-4251-8793-34f3ed98ae0a</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
WCF extensibility is not trivial – <a href="http://msdn.microsoft.com/en-us/library/ee667276.aspx">this</a> looks
like it could become a very valuable source…
</p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=46cb036c-8d6e-4251-8793-34f3ed98ae0a" />
      </body>
      <title>Guide to WCF Extensibility</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=46cb036c-8d6e-4251-8793-34f3ed98ae0a</guid>
      <link>http://www.leastprivilege.com/GuideToWCFExtensibility.aspx</link>
      <pubDate>Sat, 17 Oct 2009 08:51:42 GMT</pubDate>
      <description>&lt;p&gt;
WCF extensibility is not trivial – &lt;a href="http://msdn.microsoft.com/en-us/library/ee667276.aspx"&gt;this&lt;/a&gt; looks
like it could become a very valuable source…
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=46cb036c-8d6e-4251-8793-34f3ed98ae0a" /&gt;</description>
      <category>WCF</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=5ed47b51-42cf-499b-85d3-3744537ab2f2</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=5ed47b51-42cf-499b-85d3-3744537ab2f2</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <a href="http://blogs.msdn.com/dparys/">Dariusz</a> interviewed me for Channel9. You
can find the recording <a href="http://channel9.msdn.com/posts/Dariusz/Claims-Based-Security-Windows-Identity-Foundation-and-Dominick-Baier/">here</a>.
</p>
        <p>
Have fun ;)
</p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=5ed47b51-42cf-499b-85d3-3744537ab2f2" />
      </body>
      <title>StarterSTS, WIF, Identity on Channel9</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=5ed47b51-42cf-499b-85d3-3744537ab2f2</guid>
      <link>http://www.leastprivilege.com/StarterSTSWIFIdentityOnChannel9.aspx</link>
      <pubDate>Thu, 08 Oct 2009 11:15:46 GMT</pubDate>
      <description>&lt;p&gt;
&lt;a href="http://blogs.msdn.com/dparys/"&gt;Dariusz&lt;/a&gt; interviewed me for Channel9. You
can find the recording &lt;a href="http://channel9.msdn.com/posts/Dariusz/Claims-Based-Security-Windows-Identity-Foundation-and-Dominick-Baier/"&gt;here&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
Have fun ;)
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=5ed47b51-42cf-499b-85d3-3744537ab2f2" /&gt;</description>
      <category>IdentityModel</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=d141b79c-4591-4fc2-ac9e-a8ed89417f14</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=d141b79c-4591-4fc2-ac9e-a8ed89417f14</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <a href="http://blogs.msdn.com/eugeniop/">Eugenio</a> just announced that the codeplex <a href="http://blogs.msdn.com/eugeniop/archive/2009/10/02/claims-based-identity-access-control-guide-early-drafts-available.aspx">site</a> is
up now!
</p>
        <p>
Have a look at the draft documents – feedback is always welcome!!
</p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=d141b79c-4591-4fc2-ac9e-a8ed89417f14" />
      </body>
      <title>Claims based Identity &amp;amp; Access Control Guide &amp;ndash; Early drafts available</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=d141b79c-4591-4fc2-ac9e-a8ed89417f14</guid>
      <link>http://www.leastprivilege.com/ClaimsBasedIdentityAmpAccessControlGuideNdashEarlyDraftsAvailable.aspx</link>
      <pubDate>Mon, 05 Oct 2009 05:47:39 GMT</pubDate>
      <description>&lt;p&gt;
&lt;a href="http://blogs.msdn.com/eugeniop/"&gt;Eugenio&lt;/a&gt; just announced that the codeplex &lt;a href="http://blogs.msdn.com/eugeniop/archive/2009/10/02/claims-based-identity-access-control-guide-early-drafts-available.aspx"&gt;site&lt;/a&gt; is
up now!
&lt;/p&gt;
&lt;p&gt;
Have a look at the draft documents – feedback is always welcome!!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=d141b79c-4591-4fc2-ac9e-a8ed89417f14" /&gt;</description>
      <category>IdentityModel</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=d16e1f13-c46d-4a1a-9640-13615ad406b5</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=d16e1f13-c46d-4a1a-9640-13615ad406b5</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
It turns out that there is no way in Silverlight to send credentials using the standard
HTTP Authorize header (see <a href="http://mark.mymonster.nl/2009/07/11/silverlight-3-did-we-get-support-for-credentials/">here</a>).
WTF?!.
</p>
        <p>
You have to use a custom HTTP header to transmit credentials in this case, e.g. <em>X-Authorize</em> (nice?).
I have adjusted my service code to accept both headers and will update the StarterSTS
bits on Codeplex.
</p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=d16e1f13-c46d-4a1a-9640-13615ad406b5" />
      </body>
      <title>Restful Token Service Endpoints and Silverlight Clients</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=d16e1f13-c46d-4a1a-9640-13615ad406b5</guid>
      <link>http://www.leastprivilege.com/RestfulTokenServiceEndpointsAndSilverlightClients.aspx</link>
      <pubDate>Sun, 13 Sep 2009 08:11:35 GMT</pubDate>
      <description>&lt;p&gt;
It turns out that there is no way in Silverlight to send credentials using the standard
HTTP Authorize header (see &lt;a href="http://mark.mymonster.nl/2009/07/11/silverlight-3-did-we-get-support-for-credentials/"&gt;here&lt;/a&gt;).
WTF?!.
&lt;/p&gt;
&lt;p&gt;
You have to use a custom HTTP header to transmit credentials in this case, e.g. &lt;em&gt;X-Authorize&lt;/em&gt; (nice?).
I have adjusted my service code to accept both headers and will update the StarterSTS
bits on Codeplex.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=d16e1f13-c46d-4a1a-9640-13615ad406b5" /&gt;</description>
      <category>IdentityModel</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=88a4f3b6-98dc-4756-982b-6ebf448d6797</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=88a4f3b6-98dc-4756-982b-6ebf448d6797</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <title>StarterSTS Version 0.93</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=88a4f3b6-98dc-4756-982b-6ebf448d6797</guid>
      <link>http://www.leastprivilege.com/StarterSTSVersion093.aspx</link>
      <pubDate>Fri, 11 Sep 2009 17:43:51 GMT</pubDate>
      <description>&lt;p&gt;
I just uploaded a minor &lt;a href="http://startersts.codeplex.com/"&gt;update&lt;/a&gt;.
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
refactored ScopeOptions to PolicyOptions and added a PolicyScope class&lt;/li&gt;
&lt;li&gt;
CertificateProvider class abstracts physical loading of relying party encryption certificates&lt;/li&gt;
&lt;li&gt;
/users/restIssue.svc is a Restful token issuance endpoint – you can use a simple GET
to retrieve a token (see &lt;a href="http://www.leastprivilege.com/AddingARESTEndpointToAWIFTokenService.aspx"&gt;here&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
btw – this is the client code you can use to talk to the REST issuance endpoint:
&lt;/p&gt;
&lt;p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;
&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;public&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt; &lt;span style="color: blue"&gt;static&lt;/span&gt; &lt;span style="color: blue"&gt;string&lt;/span&gt; GetToken(&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;string&lt;/span&gt; username, &lt;span style="color: blue"&gt;string&lt;/span&gt; password, &lt;span style="color: blue"&gt;string&lt;/span&gt; uri, &lt;span style="color: blue"&gt;string&lt;/span&gt; realm)&lt;br&gt;
{&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;using&lt;/span&gt; (&lt;span style="color: blue"&gt;var&lt;/span&gt; client
= &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;WebClient&lt;/span&gt;())&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;var&lt;/span&gt; encoding
= &lt;span style="color: #2b91af"&gt;Encoding&lt;/span&gt;.GetEncoding(&lt;span style="color: #a31515"&gt;"iso-8859-1"&lt;/span&gt;);&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;string&lt;/span&gt; encodedCreds
= &lt;span style="color: #2b91af"&gt;Convert&lt;/span&gt;.ToBase64String(&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;encoding.GetBytes(&lt;span style="color: #2b91af"&gt;String&lt;/span&gt;.Format(&lt;span style="color: #a31515"&gt;"{0}:{1}"&lt;/span&gt;,
username, password)));&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;string&lt;/span&gt; authHeader
= &lt;span style="color: blue"&gt;string&lt;/span&gt;.Format(&lt;span style="color: #a31515"&gt;"Basic
{0}"&lt;/span&gt;, encodedCreds);&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;realm
= &lt;span style="color: #2b91af"&gt;HttpUtility&lt;/span&gt;.UrlEncode(realm);&lt;br&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;client.Headers.Add(&lt;span style="color: #2b91af"&gt;HttpRequestHeader&lt;/span&gt;&lt;?xml:namespace prefix = o /&gt;.Authorization,
authHeader);&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;
&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;return&lt;/span&gt; client.DownloadString(&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;string&lt;/span&gt;.Format(&lt;span style="color: #a31515"&gt;"{0}/?realm={1}"&lt;/span&gt;,
uri, realm));&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br&gt;
}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=88a4f3b6-98dc-4756-982b-6ebf448d6797" /&gt;</description>
      <category>IdentityModel</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=2d2e872b-1363-493c-b1e3-c203c233ea51</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=2d2e872b-1363-493c-b1e3-c203c233ea51</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <title>Adding a REST Endpoint to a WIF Token Service</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=2d2e872b-1363-493c-b1e3-c203c233ea51</guid>
      <link>http://www.leastprivilege.com/AddingARESTEndpointToAWIFTokenService.aspx</link>
      <pubDate>Fri, 11 Sep 2009 09:51:13 GMT</pubDate>
      <description>&lt;p&gt;
Sometimes it is useful to have a really simple way to acquire a token from a token
service – without having to fiddle around with WS-Federation or WS-Trust. Issuing
a simple GET request against a token issuance endpoint seems to fulfill that requirement.
&lt;/p&gt;
&lt;p&gt;
So I decided to a add a simple HTTP endpoint to my STS using the WCF web programming
model:
&lt;/p&gt;
&lt;p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;
&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;[&lt;span style="color: #2b91af"&gt;ServiceContract&lt;/span&gt;]&lt;br&gt;
&lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;interface&lt;/span&gt; &lt;span style="color: #2b91af"&gt;IRestfulTokenServiceContract&lt;/span&gt;
&lt;br&gt;
{&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;[&lt;span style="color: #2b91af"&gt;OperationContract&lt;/span&gt;]&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;[&lt;span style="color: #2b91af"&gt;WebGet&lt;/span&gt;(UriTemplate
= &lt;span style="color: #a31515"&gt;"/?realm={realm}"&lt;/span&gt;)]&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;XElement&lt;/span&gt; Issue(&lt;span style="color: blue"&gt;string&lt;/span&gt; realm);&lt;br&gt;&lt;?xml:namespace prefix = o /&gt;
}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
You could provide more parameters here (like token type, lifetime etc.) but i decided
to keep it simple.
&lt;/p&gt;
&lt;p&gt;
For the implementation you have to decide which authentication types you want to support.
Since I needed username/password authentication I used Cibrax’ excellent basic authentication &lt;a href="http://weblogs.asp.net/cibrax/archive/2009/03/20/custom-basic-authentication-for-restful-services.aspx"&gt;extension&lt;/a&gt;.
If you need to support client certificates, you would get the certificate details
from WCF’s &lt;em&gt;AuthorizationContext&lt;/em&gt;.
&lt;/p&gt;
&lt;p&gt;
To route the GET request to the existing token issuance logic, you can create the
STS using the static &lt;em&gt;CreateSecurityTokenService&lt;/em&gt; method on the &lt;em&gt;SecurityTokenServiceConfiguration&lt;/em&gt; class.
Then you have to construct a RST and &lt;em&gt;IClaimsPrincipal&lt;/em&gt; to describe the token
request and pass that into the &lt;em&gt;Issue&lt;/em&gt; method. Afterwards you serialize the
security token back as a HTTP response and you are done.
&lt;/p&gt;
&lt;p&gt;
I will incorporate that into the next drop of the StarterSTS – but for now here is
the code:
&lt;/p&gt;
&lt;span style="font-family: consolas; color: blue; font-size: 11pt; mso-ansi-language: en-us; mso-no-proof: yes; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-fareast-language: en-us; mso-bidi-language: ar-sa" lang="EN-US"&gt;public&lt;/span&gt;&lt;span style="font-family: consolas; font-size: 11pt; mso-ansi-language: en-us; mso-no-proof: yes; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-fareast-language: en-us; mso-bidi-language: ar-sa" lang="EN-US"&gt; &lt;span style="color: blue"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af"&gt;RestfulTokenService&lt;/span&gt; : &lt;span style="color: #2b91af"&gt;IRestfulTokenServiceContract&lt;br&gt;
&lt;/span&gt;{&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: #2b91af"&gt;XElement&lt;/span&gt; Issue(&lt;span style="color: blue"&gt;string&lt;/span&gt; realm)&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;EndpointAddress&lt;/span&gt; epRealm;&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;try&lt;/span&gt;&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;epRealm
= &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;EndpointAddress&lt;/span&gt;(realm);&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;catch&lt;/span&gt;&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;WebOperationContext&lt;/span&gt;.Current.OutgoingResponse.StatusCode
= &lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; HttpStatusCode&lt;/span&gt;.BadRequest;&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;return&lt;/span&gt; &lt;span style="color: blue"&gt;null&lt;/span&gt;;&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;RequestSecurityToken&lt;/span&gt; rst
= &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;RequestSecurityToken&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;AppliesTo
= epRealm,&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;KeyType
= &lt;span style="color: #2b91af"&gt;KeyTypeConstants&lt;/span&gt;.Bearer&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;};&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;var&lt;/span&gt; sts
= 
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;StarterTokenServiceConfiguration&lt;/span&gt;().CreateSecurityTokenService();&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;var&lt;/span&gt; rstr
= sts.Issue(CreatePrincipal(), rst);&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;StringBuilder&lt;/span&gt; sb
= &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;StringBuilder&lt;/span&gt;();&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;var&lt;/span&gt; writer
= &lt;span style="color: #2b91af"&gt;XmlWriter&lt;/span&gt;.Create(sb);&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;var&lt;/span&gt; col
=&lt;br&gt;
&lt;span style="color: #2b91af"&gt;SecurityTokenHandlerCollection&lt;/span&gt;.CreateDefaultSecurityTokenHandlerCollection();&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;col.WriteSecurityToken(writer, 
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rstr.RequestedSecurityToken.SecurityToken);&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;writer.Flush();&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;WebOperationContext&lt;/span&gt;.Current.OutgoingResponse.ContentType
= &lt;span style="color: #a31515"&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "text/xml"&lt;/span&gt;;&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;return&lt;/span&gt; &lt;span style="color: #2b91af"&gt;XElement&lt;/span&gt;.Parse(sb.ToString());&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;private&lt;/span&gt; &lt;span style="color: #2b91af"&gt;IClaimsPrincipal&lt;/span&gt; CreatePrincipal()&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;if&lt;/span&gt; (&lt;span style="color: #2b91af"&gt;Thread&lt;/span&gt;.CurrentPrincipal
== &lt;span style="color: blue"&gt;null&lt;/span&gt; ||&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Thread&lt;/span&gt;.CurrentPrincipal.Identity
== &lt;span style="color: blue"&gt;null&lt;/span&gt; ||&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;string&lt;/span&gt;.IsNullOrEmpty(&lt;span style="color: #2b91af"&gt;Thread&lt;/span&gt;.CurrentPrincipal.Identity.Name))&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;throw&lt;/span&gt; &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;InvalidRequestException&lt;/span&gt;(&lt;span style="color: #a31515"&gt;"unknown
client"&lt;/span&gt;);&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;var&lt;/span&gt; identity
= &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;ClaimsIdentity&lt;/span&gt;(&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Claim&lt;/span&gt;(&lt;span style="color: #2b91af"&gt;WSIdentityConstants&lt;/span&gt;.&lt;span style="color: #2b91af"&gt;ClaimTypes&lt;/span&gt;.Name, &lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
Thread&lt;/span&gt;.CurrentPrincipal.Identity.Name));&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;return&lt;/span&gt; &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;ClaimsPrincipal&lt;/span&gt;(identity);&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;span style="color: #2b91af"&gt;
&lt;br style="mso-special-character: line-break"&gt;
&lt;br style="mso-special-character: line-break"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=2d2e872b-1363-493c-b1e3-c203c233ea51" /&gt;</description>
      <category>IdentityModel</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=6dbfcbc9-f7c0-436d-bbe4-153a4f11b33f</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=6dbfcbc9-f7c0-436d-bbe4-153a4f11b33f</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I have an update to the StarterSTS up on <a href="http://startersts.codeplex.com/">codeplex</a>.
There is also a new <a href="http://identity.thinktecture.com/download/starterSTS/StarterSTS_Update_0.92.wmv">screencast</a> that
details the changes from the last version. 
</p>
        <p>
Have fun!
</p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=6dbfcbc9-f7c0-436d-bbe4-153a4f11b33f" />
      </body>
      <title>StarterSTS Version 0.92</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=6dbfcbc9-f7c0-436d-bbe4-153a4f11b33f</guid>
      <link>http://www.leastprivilege.com/StarterSTSVersion092.aspx</link>
      <pubDate>Tue, 01 Sep 2009 10:32:50 GMT</pubDate>
      <description>&lt;p&gt;
I have an update to the StarterSTS up on &lt;a href="http://startersts.codeplex.com/"&gt;codeplex&lt;/a&gt;.
There is also a new &lt;a href="http://identity.thinktecture.com/download/starterSTS/StarterSTS_Update_0.92.wmv"&gt;screencast&lt;/a&gt; that
details the changes from the last version. 
&lt;/p&gt;
&lt;p&gt;
Have fun!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=6dbfcbc9-f7c0-436d-bbe4-153a4f11b33f" /&gt;</description>
      <category>IdentityModel</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=16ad0344-826f-4e9b-b109-abd2504a881c</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=16ad0344-826f-4e9b-b109-abd2504a881c</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Am 15. September sind Christian und Ich in Frankfurt und plaudern mal nen Abend lang
über unsere Erfahrungen mit Identity und Claims in verteilten Anwendungen.
</p>
        <p>
Wir freuen uns schon und das sollte ein netter Abend werden.
</p>
        <p>
Es sind noch Plätze frei – Anmeldung ist <a href="http://www.dotnet-ug-frankfurt.de/Event/tabid/119/ID/31/Default.aspx">hier</a> erforderlich.
Vielleicht sieht man sich ja dort.
</p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=16ad0344-826f-4e9b-b109-abd2504a881c" />
      </body>
      <title>.NET Usergroup Frankfurt &amp;ndash; WIF, ADFS 2, CardSpace 2</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=16ad0344-826f-4e9b-b109-abd2504a881c</guid>
      <link>http://www.leastprivilege.com/NETUsergroupFrankfurtNdashWIFADFS2CardSpace2.aspx</link>
      <pubDate>Fri, 28 Aug 2009 18:48:03 GMT</pubDate>
      <description>&lt;p&gt;
Am 15. September sind Christian und Ich in Frankfurt und plaudern mal nen Abend lang
über unsere Erfahrungen mit Identity und Claims in verteilten Anwendungen.
&lt;/p&gt;
&lt;p&gt;
Wir freuen uns schon und das sollte ein netter Abend werden.
&lt;/p&gt;
&lt;p&gt;
Es sind noch Plätze frei – Anmeldung ist &lt;a href="http://www.dotnet-ug-frankfurt.de/Event/tabid/119/ID/31/Default.aspx"&gt;hier&lt;/a&gt; erforderlich.
Vielleicht sieht man sich ja dort.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=16ad0344-826f-4e9b-b109-abd2504a881c" /&gt;</description>
      <category>Conferences</category>
      <category>IdentityModel</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=f7b07c57-f877-414a-8a73-1980ab9b643e</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=f7b07c57-f877-414a-8a73-1980ab9b643e</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Summer break is over – and exciting times lie ahead.
</p>
        <p>
Over the course of the next months I will be working with <a href="http://blogs.msdn.com/eugeniop">Eugenio</a>, <a href="http://www.pluralsight.com/community/blogs/keith/default.aspx">Keith</a>, <a href="http://blogs.msdn.com/vbertocci/">Vittorio</a>, <a href="http://blogs.southworks.net/mwoloski/">Matias</a> and <a href="http://blogs.msdn.com/dphill/default.aspx">David</a>.
The end result will (hopefully) be a very interesting, useful and pragmatic guide
to all things claims.
</p>
        <p>
Eugenio already posted <a href="http://blogs.msdn.com/eugeniop/archive/2009/08/11/announcing-new-project-patterns-practices-claims-based-authentication-authorization-guide.aspx">some</a><a href="http://blogs.msdn.com/eugeniop/archive/2009/08/19/welcome-to-the-enterprise-line-our-next-stop-will-be-station-1-sso-mind-the-gap.aspx">details</a> on
the guide and we will be releasing interim version so you can give us feedback.
</p>
        <p>
Watch this space!
</p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=f7b07c57-f877-414a-8a73-1980ab9b643e" />
      </body>
      <title>Patterns &amp;amp; Practices - Claims based Authentication &amp;amp; Authorization Guide</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=f7b07c57-f877-414a-8a73-1980ab9b643e</guid>
      <link>http://www.leastprivilege.com/PatternsAmpPracticesClaimsBasedAuthenticationAmpAuthorizationGuide.aspx</link>
      <pubDate>Mon, 24 Aug 2009 06:11:21 GMT</pubDate>
      <description>&lt;p&gt;
Summer break is over – and exciting times lie ahead.
&lt;/p&gt;
&lt;p&gt;
Over the course of the next months I will be working with &lt;a href="http://blogs.msdn.com/eugeniop"&gt;Eugenio&lt;/a&gt;, &lt;a href="http://www.pluralsight.com/community/blogs/keith/default.aspx"&gt;Keith&lt;/a&gt;, &lt;a href="http://blogs.msdn.com/vbertocci/"&gt;Vittorio&lt;/a&gt;, &lt;a href="http://blogs.southworks.net/mwoloski/"&gt;Matias&lt;/a&gt; and &lt;a href="http://blogs.msdn.com/dphill/default.aspx"&gt;David&lt;/a&gt;.
The end result will (hopefully) be a very interesting, useful and pragmatic guide
to all things claims.
&lt;/p&gt;
&lt;p&gt;
Eugenio already posted &lt;a href="http://blogs.msdn.com/eugeniop/archive/2009/08/11/announcing-new-project-patterns-practices-claims-based-authentication-authorization-guide.aspx"&gt;some&lt;/a&gt; &lt;a href="http://blogs.msdn.com/eugeniop/archive/2009/08/19/welcome-to-the-enterprise-line-our-next-stop-will-be-station-1-sso-mind-the-gap.aspx"&gt;details&lt;/a&gt; on
the guide and we will be releasing interim version so you can give us feedback.
&lt;/p&gt;
&lt;p&gt;
Watch this space!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=f7b07c57-f877-414a-8a73-1980ab9b643e" /&gt;</description>
      <category>IdentityModel</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=b80252c8-1cdb-4ec9-a685-5e4e283421cd</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=b80252c8-1cdb-4ec9-a685-5e4e283421cd</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <a title="http://referencesource.microsoft.com/netframework.aspx" href="http://referencesource.microsoft.com/netframework.aspx">http://referencesource.microsoft.com/netframework.aspx</a>
        </p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=b80252c8-1cdb-4ec9-a685-5e4e283421cd" />
      </body>
      <title>WCF Source Code for Download</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=b80252c8-1cdb-4ec9-a685-5e4e283421cd</guid>
      <link>http://www.leastprivilege.com/WCFSourceCodeForDownload.aspx</link>
      <pubDate>Thu, 30 Jul 2009 05:17:55 GMT</pubDate>
      <description>&lt;p&gt;
&lt;a title="http://referencesource.microsoft.com/netframework.aspx" href="http://referencesource.microsoft.com/netframework.aspx"&gt;http://referencesource.microsoft.com/netframework.aspx&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=b80252c8-1cdb-4ec9-a685-5e4e283421cd" /&gt;</description>
      <category>WCF</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=1986e992-9639-4315-92f5-1ca731ff6d22</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=1986e992-9639-4315-92f5-1ca731ff6d22</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
In the <a href="http://www.leastprivilege.com/ClaimsAuthorizationInGenevaBeta2Introduction.aspx">previous</a> post
I illustrated how the basic claims authorization infrastructure in WIF (formerly Geneva)
works. In this post I want to focus more on how claims authorization behaves when
integrated in WCF and ASP.NET.
</p>
        <p>
          <strong>ASP.NET</strong>
          <br />
In addition to using the claims authorization manager manually like I showed you in
the last post, you can also opt-in to per-request claims authorization (think of it
as a replacement for the “classic” URL authorization module in ASP.NET / IIS). For
this purpose you’ll find an HTTP module called <em>ClaimsAuthorizationModule</em> in
the <em>Microsoft.IdentityModel.Web</em> namespace. 
</p>
        <p>
This module simply subscribes to the <em>AuthorizeRequest</em> processing stage and
calls the configured claims authorization manager for every request. The AuthorizationContext
that gets passed in the manager consists of the current <em>IClaimsPrincipal</em>,
the request URL and the HTTP method.
</p>
        <p>
If you want to do tricks like custom <em>IClaimsPrincipal</em> implementations, you’d
either exchange the principal before you hit the claims authorization manager (in <em>PostAuthenticateRequest</em>)
or after it (in <em>PostAuthorizeRequest</em>).
</p>
        <p>
          <strong>WCF</strong>
          <br />
As usual things are a little more complex in WCF. Authorization (amongst other things)
is driven by a <em>ServiceAuthorizationManager</em> in WCF. When you call <em>ConfigureServiceHost</em>,
WIF puts a special version of that class, the <em>IdentityModelServiceAuthorizationManager</em>,
in place. This class in turn calls out to the configured <em>ClaimsAuthorizationManager</em>.
In that case the WS-Addressing <em>To</em> and the <em>Action</em> header are passed
in for every request.
</p>
        <p>
HTH
</p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=1986e992-9639-4315-92f5-1ca731ff6d22" />
      </body>
      <title>Claims Authorization in WIF Beta 2 &amp;ndash; ASP.NET and WCF Integration</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=1986e992-9639-4315-92f5-1ca731ff6d22</guid>
      <link>http://www.leastprivilege.com/ClaimsAuthorizationInWIFBeta2NdashASPNETAndWCFIntegration.aspx</link>
      <pubDate>Wed, 22 Jul 2009 05:24:30 GMT</pubDate>
      <description>&lt;p&gt;
In the &lt;a href="http://www.leastprivilege.com/ClaimsAuthorizationInGenevaBeta2Introduction.aspx"&gt;previous&lt;/a&gt; post
I illustrated how the basic claims authorization infrastructure in WIF (formerly Geneva)
works. In this post I want to focus more on how claims authorization behaves when
integrated in WCF and ASP.NET.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;ASP.NET&lt;/strong&gt;
&lt;br&gt;
In addition to using the claims authorization manager manually like I showed you in
the last post, you can also opt-in to per-request claims authorization (think of it
as a replacement for the “classic” URL authorization module in ASP.NET / IIS). For
this purpose you’ll find an HTTP module called &lt;em&gt;ClaimsAuthorizationModule&lt;/em&gt; in
the &lt;em&gt;Microsoft.IdentityModel.Web&lt;/em&gt; namespace. 
&lt;/p&gt;
&lt;p&gt;
This module simply subscribes to the &lt;em&gt;AuthorizeRequest&lt;/em&gt; processing stage and
calls the configured claims authorization manager for every request. The AuthorizationContext
that gets passed in the manager consists of the current &lt;em&gt;IClaimsPrincipal&lt;/em&gt;,
the request URL and the HTTP method.
&lt;/p&gt;
&lt;p&gt;
If you want to do tricks like custom &lt;em&gt;IClaimsPrincipal&lt;/em&gt; implementations, you’d
either exchange the principal before you hit the claims authorization manager (in &lt;em&gt;PostAuthenticateRequest&lt;/em&gt;)
or after it (in &lt;em&gt;PostAuthorizeRequest&lt;/em&gt;).
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;WCF&lt;/strong&gt;
&lt;br&gt;
As usual things are a little more complex in WCF. Authorization (amongst other things)
is driven by a &lt;em&gt;ServiceAuthorizationManager&lt;/em&gt; in WCF. When you call &lt;em&gt;ConfigureServiceHost&lt;/em&gt;,
WIF puts a special version of that class, the &lt;em&gt;IdentityModelServiceAuthorizationManager&lt;/em&gt;,
in place. This class in turn calls out to the configured &lt;em&gt;ClaimsAuthorizationManager&lt;/em&gt;.
In that case the WS-Addressing &lt;em&gt;To&lt;/em&gt; and the &lt;em&gt;Action&lt;/em&gt; header are passed
in for every request.
&lt;/p&gt;
&lt;p&gt;
HTH
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=1986e992-9639-4315-92f5-1ca731ff6d22" /&gt;</description>
      <category>WCF</category>
      <category>ASP.NET</category>
      <category>IdentityModel</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=68c5b4e8-34fb-41ad-8c1f-4a5dc268187a</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=68c5b4e8-34fb-41ad-8c1f-4a5dc268187a</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <title>Claims Authorization in Geneva Beta 2 - Introduction</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=68c5b4e8-34fb-41ad-8c1f-4a5dc268187a</guid>
      <link>http://www.leastprivilege.com/ClaimsAuthorizationInGenevaBeta2Introduction.aspx</link>
      <pubDate>Fri, 10 Jul 2009 14:29:17 GMT</pubDate>
      <description>&lt;p&gt;
I guess you already heard the term “claims based authorization” several times by now.
But how exactly does the authorization work?
&lt;/p&gt;
&lt;p&gt;
The typical pattern is that you iterate through the claims associated with the user
and search for a special claim and maybe also a special value of that claim. Based
on that you can grant/deny access or modify behavior or UI elements.
&lt;/p&gt;
&lt;p&gt;
This typically leads to code like this:
&lt;/p&gt;
&lt;p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;
&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;if&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt; (principal.ClaimExists(&lt;span style="color: #a31515"&gt;"http://someclaim"&lt;/span&gt;, &lt;span style="color: #a31515"&gt;"somevalue"&lt;/span&gt;))
{}&lt;/span&gt;
&lt;/p&gt;
&lt;span style="font-family: consolas; font-size: 11pt; mso-ansi-language: de; mso-no-proof: yes; mso-fareast-font-family: simsun; mso-fareast-theme-font: minor-fareast; mso-fareast-language: zh-cn; mso-bidi-language: ar-sa"&gt;&lt;/span&gt; 
&lt;p&gt;
or
&lt;/p&gt;
&lt;p class="MsoNormal"&gt;
&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;principal.DemandClaim(&lt;span style="color: #2b91af"&gt;WSAuthorizationConstants&lt;/span&gt;.Action, &lt;span style="color: #a31515"&gt;"AddCustomer"&lt;/span&gt;);&lt;/span&gt;&lt;span style="mso-ansi-language: en-us" lang="EN-US"&gt;&lt;?xml:namespace prefix = o /&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
This has the downside, that claim types and values are embedded in your application
code and this may become hard to maintain in certain situations. That’s the reason
why the Geneva framework Beta 2 introduced a built-in infrastructure for authorization
that operates at a higher level of abstraction.
&lt;/p&gt;
&lt;p&gt;
In Geneva authorization information is abstracted as a resource that the subject tries
to access and the action the subject wants to perform on that resource. The container
for this information is called the &lt;em&gt;AuthorizationContext&lt;/em&gt;.
&lt;/p&gt;
&lt;p&gt;
Operation and action are collections of claims. This allows to express from simple
to more complicated authorization statements. A simple resource/action pair could
be e.g. Directory/Browse. A more complicated statement could be e.g. “Purge printer
queue of laser printer in building 61”.
&lt;/p&gt;
&lt;p&gt;
That’s how you could construct the corresponding &lt;em&gt;AuthorizationContext&lt;/em&gt;:
&lt;/p&gt;
&lt;p class="MsoNormal"&gt;
&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;var&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt; simpleContext
= &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;AuthorizationContext&lt;/span&gt;(principal, &lt;span style="color: #a31515"&gt;"Directory"&lt;/span&gt;, &lt;span style="color: #a31515"&gt;"Browse"&lt;/span&gt;);&lt;/span&gt;&lt;span style="mso-ansi-language: en-us" lang="EN-US"&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
and
&lt;/p&gt;
&lt;p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;
&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;var&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt; advContext
= &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;AuthorizationContext&lt;/span&gt;(principal,&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Collection&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;Claim&lt;/span&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Claim&lt;/span&gt;(&lt;span style="color: #a31515"&gt;"http://claims/device"&lt;/span&gt;, &lt;span style="color: #a31515"&gt;"Printer"&lt;/span&gt;),&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Claim&lt;/span&gt;(&lt;span style="color: #a31515"&gt;"http://claims/building"&lt;/span&gt;, &lt;span style="color: #a31515"&gt;"61"&lt;/span&gt;)&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;},&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Collection&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;Claim&lt;/span&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Claim&lt;/span&gt;(&lt;span style="color: #2b91af"&gt;WSAuthorizationConstants&lt;/span&gt;.Action, &lt;span style="color: #a31515"&gt;"PurgeQueue"&lt;/span&gt;)&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;});&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
The second piece of plumbing introduced by Geneva is the &lt;em&gt;ClaimsAuthorizationManager&lt;/em&gt;.
You derive from this class and implement the &lt;em&gt;CheckAccess&lt;/em&gt; method. This method
accepts an &lt;em&gt;AuthorizationContext&lt;/em&gt; and returns true/false. In this method you
have to do whatever mapping is necessary to resolve the resource/action pair to claims
of the subject.
&lt;/p&gt;
&lt;p&gt;
Use this sample authorization manager to inspect the data that gets passed in:
&lt;/p&gt;
&lt;p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;
&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;class&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt; &lt;span style="color: #2b91af"&gt;SimpleAuthorizationManager&lt;/span&gt; : &lt;span style="color: #2b91af"&gt;ClaimsAuthorizationManager&lt;br&gt;
&lt;/span&gt;{&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;override&lt;/span&gt; &lt;span style="color: blue"&gt;bool&lt;/span&gt; CheckAccess(&lt;span style="color: #2b91af"&gt;AuthorizationContext&lt;/span&gt; context)&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515"&gt;"SimpleAuthorizationManager:"&lt;/span&gt;);&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515"&gt;"\nSubject:
{0}\n"&lt;/span&gt;, context.Subject.Identity.Name);&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515"&gt;"Actions:"&lt;/span&gt;);&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;foreach&lt;/span&gt; (&lt;span style="color: blue"&gt;var&lt;/span&gt; action &lt;span style="color: blue"&gt;in&lt;/span&gt; context.Action)&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515"&gt;"
{0}"&lt;/span&gt;, action.ClaimType);&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515"&gt;"
{0}\n"&lt;/span&gt;, action.Value);&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515"&gt;"Resources:"&lt;/span&gt;);&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;foreach&lt;/span&gt; (&lt;span style="color: blue"&gt;var&lt;/span&gt; resource &lt;span style="color: blue"&gt;in&lt;/span&gt; context.Resource)&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515"&gt;"
{0}"&lt;/span&gt;, resource.ClaimType);&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515"&gt;"
{0}\n"&lt;/span&gt;, resource.Value);&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;return&lt;/span&gt; &lt;span style="color: blue"&gt;true&lt;/span&gt;;&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;}&lt;span style="color: #2b91af"&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
While you could manually new up that class and directly call &lt;em&gt;CheckAccess&lt;/em&gt; method
– you can also use configuration to create the authorization manager. This has some
interesting features.
&lt;/p&gt;
&lt;p&gt;
First you need to configure the authorization manager in config:
&lt;/p&gt;
&lt;p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;
&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-family: consolas; color: #a31515; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;microsoft.identityModel&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-family: consolas; color: #a31515; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;service&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-family: consolas; color: #a31515; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;claimsAuthorizationManager&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; color: red; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;type&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;=&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;"&lt;span style="color: blue"&gt;LeastPrivilege.PolicyAuthorizationManager,
ClaimsAuthorization&lt;/span&gt;" &lt;span style="color: blue"&gt;/&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;service&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;microsoft.identityModel&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
And then use the following code to create and use the authorization manager:
&lt;/p&gt;
&lt;p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;
&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;var&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt; config
= &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;ServiceConfiguration&lt;/span&gt;();&lt;br&gt;
&lt;span style="color: blue"&gt;var&lt;/span&gt; authz = config.ClaimsAuthorizationManager;&lt;br&gt;
&lt;br&gt;
&lt;span style="color: blue"&gt;var&lt;/span&gt; simpleContext = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;AuthorizationContext&lt;/span&gt;(&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;principal, &lt;span style="color: #a31515"&gt;"Directory"&lt;/span&gt;, &lt;span style="color: #a31515"&gt;"Browse"&lt;/span&gt;);&lt;br&gt;
&lt;span style="color: blue"&gt;var&lt;/span&gt; allowed = authz.CheckAccess(simpleContext);&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
You can also use the &lt;em&gt;ClaimsPrincipalPermission/Attribute&lt;/em&gt; classes which simplify
the call and automate the creation from configuration:
&lt;/p&gt;
&lt;p class="MsoNormal"&gt;
&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;new&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt; &lt;span style="color: #2b91af"&gt;ClaimsPrincipalPermission&lt;/span&gt;(&lt;span style="color: #a31515"&gt;"Directory"&lt;/span&gt;, &lt;span style="color: #a31515"&gt;"Browse"&lt;/span&gt;).Demand();&lt;/span&gt;&lt;span style="mso-ansi-language: en-us" lang="EN-US"&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
or
&lt;/p&gt;
&lt;p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;
&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;[&lt;span style="color: #2b91af"&gt;ClaimsPrincipalPermission&lt;/span&gt;(&lt;span style="color: #2b91af"&gt;SecurityAction&lt;/span&gt;.Demand, 
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;Resource = &lt;span style="color: #a31515"&gt;"Directory"&lt;/span&gt;,
Operation = &lt;span style="color: #a31515"&gt;"Browse"&lt;/span&gt;)]&lt;br&gt;
&lt;span style="color: blue"&gt;private&lt;/span&gt; &lt;span style="color: blue"&gt;static&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; BrowseDirectory()&lt;br&gt;
{ }&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
As with the normal &lt;em&gt;PrincipalPermission&lt;/em&gt; – these classes throw a &lt;em&gt;SecurityException &lt;/em&gt;and
assume that you have populated &lt;em&gt;Thread.CurrentPrincipal&lt;/em&gt;.
&lt;/p&gt;
&lt;p&gt;
The configuration for the claims authorization manager has an interesting extensibility
point. You can attach arbitrary XML to the configuration element. This allows to create
policy statements directly in config or provide enough information for the authorization
manager to load the policy from somewhere else. Whenever such an attached XML fragment
exists, the configuration loader calls a special constructor of &lt;em&gt;ClaimsAuthorizationManager&lt;/em&gt; and
passes over the fragment as an &lt;em&gt;XmlNodeList&lt;/em&gt;.
&lt;/p&gt;
&lt;p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;
&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;public&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt; &lt;span style="color: blue"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af"&gt;PolicyAuthorizationManager&lt;/span&gt; : &lt;span style="color: #2b91af"&gt;ClaimsAuthorizationManager&lt;br&gt;
&lt;/span&gt;{&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: green"&gt;//
this ctor gets called when there is a child element in app.config&lt;/span&gt;&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;public&lt;/span&gt; PolicyAuthorizationManager( &lt;span style="color: blue"&gt;object&lt;/span&gt; objXmlElement
)&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;XmlNodeList&lt;/span&gt; nodes
= objXmlElement &lt;span style="color: blue"&gt;as&lt;/span&gt; &lt;span style="color: #2b91af"&gt;XmlNodeList&lt;/span&gt;;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Process(nodes);&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br&gt;
}&lt;span style="color: #2b91af"&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
The same mechanism is also used for &lt;em&gt;SecurityTokenHandlers&lt;/em&gt; btw.
&lt;/p&gt;
&lt;p&gt;
The Geneva SDK includes a sample that shows how to use this extensibility point to
parse authorization policy (in the Extensibility folder). With this sample you could
write something like this for the above authorization statements:
&lt;/p&gt;
&lt;p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;
&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-family: consolas; color: #a31515; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;claimsAuthorizationManager&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt; &lt;/span&gt;&lt;span style="font-family: consolas; color: red; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;type&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;=&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;"&lt;span style="color: blue"&gt;type&lt;/span&gt;"&lt;span style="color: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;
&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-family: consolas; color: #a31515; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;policy&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt; &lt;/span&gt;&lt;span style="font-family: consolas; color: red; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;resource&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;=&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"&gt;"&lt;span style="color: blue"&gt;Directory&lt;/span&gt;"&lt;br&gt;
&lt;span style="color: blue"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: red"&gt;action&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;Browse&lt;/span&gt;"&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;claim&lt;/span&gt;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;claimType&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;http://schemas.microsoft.com/ws/2008/06/identity/claims/role&lt;/span&gt;"&lt;span style="color: blue"&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: red"&gt;claimValue&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;Users&lt;/span&gt;"&lt;span style="color: blue"&gt; /&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;policy&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;policy&lt;/span&gt;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;resource&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;Printer_61&lt;/span&gt;"&lt;span style="color: blue"&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: red"&gt;action&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;PurgeQueue&lt;/span&gt;"&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;br&gt;
&lt;span style="color: blue"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;or&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;br&gt;
&lt;span style="color: blue"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;claim&lt;/span&gt;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;claimType&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;http://schemas.microsoft.com/ws/2008/06/identity/claims/role&lt;/span&gt;"&lt;br&gt;
&lt;span style="color: blue"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: red"&gt;claimValue&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;Enterprise
Administrators&lt;/span&gt;"&lt;span style="color: blue"&gt; /&amp;gt;&lt;/span&gt;
&lt;br&gt;
&lt;span style="color: blue"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;
&lt;br&gt;
&lt;span style="color: blue"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;and&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;br&gt;
&lt;span style="color: blue"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;claim&lt;/span&gt;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;claimType&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;http://schemas.microsoft.com/ws/2008/06/identity/claims/role&lt;/span&gt;"&lt;br&gt;
&lt;span style="color: blue"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: red"&gt;claimValue&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;Administrators&lt;/span&gt;"&lt;span style="color: blue"&gt; /&amp;gt;&lt;/span&gt;
&lt;br&gt;
&lt;span style="color: blue"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;claim&lt;/span&gt;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;claimType&lt;/span&gt;&lt;span style="color: blue"&gt;=http://claims/building&lt;/span&gt;
&lt;br&gt;
&lt;span style="color: blue"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: red"&gt;claimValue&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;61&lt;/span&gt;"&lt;span style="color: blue"&gt; /&amp;gt;&lt;/span&gt;
&lt;br&gt;
&lt;span style="color: blue"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;and&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;br&gt;
&lt;span style="color: blue"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;or&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;br&gt;
&lt;span style="color: blue"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;policy&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;br&gt;
&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;claimsAuthorizationManager&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
Everything you’ve seen here can be used in arbitrary application types. In the next
post I show how this is integrated with WCF and ASP.NET.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=68c5b4e8-34fb-41ad-8c1f-4a5dc268187a" /&gt;</description>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=a10c2122-c13e-4863-abe0-0a70554aa5aa</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=a10c2122-c13e-4863-abe0-0a70554aa5aa</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Not a really new <a href="http://www.blackhat.com/presentations/bh-dc-09/Marlinspike/BlackHat-DC-09-Marlinspike-Defeating-SSL.pdf">paper</a> –
but definitely recommended reading.
</p>
        <p>
Some lessons learned:
</p>
        <ul>
          <li>
Moxie is not really attacking SSL – but uses HTTP to bypass HTTPS.</li>
          <li>
Switch to SSL as early as possible – but that might be too late already.</li>
          <li>
Users never type https:// (nor http://) – they start with plain text and hope the
application is doing the right thing.</li>
          <li>
Fortunately (web) services are not affected. There is no human doing the http vs https
decision. WCF e.g. also doesn’t like to be downgraded to plain text whenever credentials
are involved. That’s a good thing in the face of such attacks.</li>
          <li>
Endpoint Identities (an addition to WS-Addressing) are a good thing.</li>
        </ul>
        <p>
I see interesting times for passive profile SSO scenarios like WS-Federation. This
doesn’t mean that these technologies open new holes – it is just that the (username/password)
credentials we send around are much more powerful because they can be used in multiple
applications.
</p>
        <p>
This also means – if you are building a passive STS – you should not solely rely on
SSL to secure your tokens. Encrypt them!
</p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=a10c2122-c13e-4863-abe0-0a70554aa5aa" />
      </body>
      <title>Defeating SSL</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=a10c2122-c13e-4863-abe0-0a70554aa5aa</guid>
      <link>http://www.leastprivilege.com/DefeatingSSL.aspx</link>
      <pubDate>Fri, 10 Jul 2009 10:09:50 GMT</pubDate>
      <description>&lt;p&gt;
Not a really new &lt;a href="http://www.blackhat.com/presentations/bh-dc-09/Marlinspike/BlackHat-DC-09-Marlinspike-Defeating-SSL.pdf"&gt;paper&lt;/a&gt; –
but definitely recommended reading.
&lt;/p&gt;
&lt;p&gt;
Some lessons learned:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Moxie is not really attacking SSL – but uses HTTP to bypass HTTPS.&lt;/li&gt;
&lt;li&gt;
Switch to SSL as early as possible – but that might be too late already.&lt;/li&gt;
&lt;li&gt;
Users never type https:// (nor http://) – they start with plain text and hope the
application is doing the right thing.&lt;/li&gt;
&lt;li&gt;
Fortunately (web) services are not affected. There is no human doing the http vs https
decision. WCF e.g. also doesn’t like to be downgraded to plain text whenever credentials
are involved. That’s a good thing in the face of such attacks.&lt;/li&gt;
&lt;li&gt;
Endpoint Identities (an addition to WS-Addressing) are a good thing.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
I see interesting times for passive profile SSO scenarios like WS-Federation. This
doesn’t mean that these technologies open new holes – it is just that the (username/password)
credentials we send around are much more powerful because they can be used in multiple
applications.
&lt;/p&gt;
&lt;p&gt;
This also means – if you are building a passive STS – you should not solely rely on
SSL to secure your tokens. Encrypt them!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=a10c2122-c13e-4863-abe0-0a70554aa5aa" /&gt;</description>
      <category>IdentityModel</category>
      <category>ASP.NET</category>
      <category>WCF</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=4ed1668f-d12c-4ca0-b3fc-5640a0db9f49</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=4ed1668f-d12c-4ca0-b3fc-5640a0db9f49</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
In the last <a href="http://www.leastprivilege.com/PartialTrustASPNETIn40.aspx">two</a><a href="http://www.leastprivilege.com/PartialTrustASPNETIn40AdvancedScenarios.aspx">posts</a> I
described how ASP.NET uses the homogenous <em>AppDomain</em> model to implement partially
trusted apps.
</p>
        <p>
In ASP.NET you use the combination of a trust level (aka grant set) and a list of
full trust assemblies to setup the homogenous <em>AppDomain</em>. This maps directly
to the <em>AppDomain.Create()</em> call that allows the corresponding parameters to
be passed in.
</p>
        <p>
Another option is to determine the trust level of application assemblies using a policy
resolver. The resolver gets called when an assembly gets loaded into the <em>AppDomain</em> and
you can dynamically specify if the assembly should run in full trust or the <em>AppDomain </em>grant
set.
</p>
        <p>
The second option is implemented using the new features around <em>AppDomain</em> managers
in .NET 4.0 (read more <a href="http://blogs.msdn.com/shawnfa/archive/2004/11/12/256550.aspx">here</a>, <a href="http://blogs.msdn.com/shawnfa/archive/2004/11/17/259105.aspx">here</a>, <a href="http://blogs.msdn.com/shawnfa/archive/2004/11/29/271948.aspx">here</a>).
These new features basically boil down to two new ways to specify an <em>AppDomainManager</em> for
the default or newly created <em>AppDomains</em>. You can now either use configuration
(in the runtime section) or specify the <em>AppDomainManager</em> type on the <em>AppDomainSetup </em>object
when manually creating <em>AppDomains</em>.
</p>
        <p>
This is exactly what ASP.NET is doing. The <em>AppDomainManager</em> implemented in <em>System.Web.Hosting.ApplicationManager+AspNetAppDomainManager</em> is
used for ASP.NET created <em>AppDomains</em>. This manager in turn uses a custom <em>HostSecurityManager</em> (implemented
in <em>System.Web.Hosting.ApplicationManager+AspNetHostSecurityManager</em>). This
host security manager in in turn expresses his interest to resolve policy when assemblies
get loaded (using the <em>Flags</em> property).
</p>
        <p>
In the <em>ResolvePolicy</em> method, the host security manager calls out to the policy
resolver (if specified). The return is then parsed and turned into either full trust/appdomain
trust/nothing permission sets. Nice.
</p>
        <p>
This mechanism is not special to ASP.NET – and can be used in arbitrary applications.
Useful for writing hosts with more advanced requirements.
</p>
        <p>
(thanks to <a href="http://blogs.msdn.com/shawnfa">shawnfa</a>/stefsch)
</p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=4ed1668f-d12c-4ca0-b3fc-5640a0db9f49" />
      </body>
      <title>A closer look at Sandboxing in (ASP.NET) V4</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=4ed1668f-d12c-4ca0-b3fc-5640a0db9f49</guid>
      <link>http://www.leastprivilege.com/ACloserLookAtSandboxingInASPNETV4.aspx</link>
      <pubDate>Fri, 03 Jul 2009 09:37:41 GMT</pubDate>
      <description>&lt;p&gt;
In the last &lt;a href="http://www.leastprivilege.com/PartialTrustASPNETIn40.aspx"&gt;two&lt;/a&gt; &lt;a href="http://www.leastprivilege.com/PartialTrustASPNETIn40AdvancedScenarios.aspx"&gt;posts&lt;/a&gt; I
described how ASP.NET uses the homogenous &lt;em&gt;AppDomain&lt;/em&gt; model to implement partially
trusted apps.
&lt;/p&gt;
&lt;p&gt;
In ASP.NET you use the combination of a trust level (aka grant set) and a list of
full trust assemblies to setup the homogenous &lt;em&gt;AppDomain&lt;/em&gt;. This maps directly
to the &lt;em&gt;AppDomain.Create()&lt;/em&gt; call that allows the corresponding parameters to
be passed in.
&lt;/p&gt;
&lt;p&gt;
Another option is to determine the trust level of application assemblies using a policy
resolver. The resolver gets called when an assembly gets loaded into the &lt;em&gt;AppDomain&lt;/em&gt; and
you can dynamically specify if the assembly should run in full trust or the &lt;em&gt;AppDomain &lt;/em&gt;grant
set.
&lt;/p&gt;
&lt;p&gt;
The second option is implemented using the new features around &lt;em&gt;AppDomain&lt;/em&gt; managers
in .NET 4.0 (read more &lt;a href="http://blogs.msdn.com/shawnfa/archive/2004/11/12/256550.aspx"&gt;here&lt;/a&gt;, &lt;a href="http://blogs.msdn.com/shawnfa/archive/2004/11/17/259105.aspx"&gt;here&lt;/a&gt;, &lt;a href="http://blogs.msdn.com/shawnfa/archive/2004/11/29/271948.aspx"&gt;here&lt;/a&gt;).
These new features basically boil down to two new ways to specify an &lt;em&gt;AppDomainManager&lt;/em&gt; for
the default or newly created &lt;em&gt;AppDomains&lt;/em&gt;. You can now either use configuration
(in the runtime section) or specify the &lt;em&gt;AppDomainManager&lt;/em&gt; type on the &lt;em&gt;AppDomainSetup &lt;/em&gt;object
when manually creating &lt;em&gt;AppDomains&lt;/em&gt;.
&lt;/p&gt;
&lt;p&gt;
This is exactly what ASP.NET is doing. The &lt;em&gt;AppDomainManager&lt;/em&gt; implemented in &lt;em&gt;System.Web.Hosting.ApplicationManager+AspNetAppDomainManager&lt;/em&gt; is
used for ASP.NET created &lt;em&gt;AppDomains&lt;/em&gt;. This manager in turn uses a custom &lt;em&gt;HostSecurityManager&lt;/em&gt; (implemented
in &lt;em&gt;System.Web.Hosting.ApplicationManager+AspNetHostSecurityManager&lt;/em&gt;). This
host security manager in in turn expresses his interest to resolve policy when assemblies
get loaded (using the &lt;em&gt;Flags&lt;/em&gt; property).
&lt;/p&gt;
&lt;p&gt;
In the &lt;em&gt;ResolvePolicy&lt;/em&gt; method, the host security manager calls out to the policy
resolver (if specified). The return is then parsed and turned into either full trust/appdomain
trust/nothing permission sets. Nice.
&lt;/p&gt;
&lt;p&gt;
This mechanism is not special to ASP.NET – and can be used in arbitrary applications.
Useful for writing hosts with more advanced requirements.
&lt;/p&gt;
&lt;p&gt;
(thanks to &lt;a href="http://blogs.msdn.com/shawnfa"&gt;shawnfa&lt;/a&gt;/stefsch)
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=4ed1668f-d12c-4ca0-b3fc-5640a0db9f49" /&gt;</description>
      <category>FX Security</category>
      <category>ASP.NET</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=1998967c-3da8-413e-b51f-6256a5cb2b0d</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=1998967c-3da8-413e-b51f-6256a5cb2b0d</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
The IMI spec is now approved. Grats!
</p>
        <p>
Read more <a href="http://self-issued.info/?p=163">here</a> and get the spec <a href="http://docs.oasis-open.org/imi/identity/v1.0/identity.html">here</a>.
</p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=1998967c-3da8-413e-b51f-6256a5cb2b0d" />
      </body>
      <title>Identity Metasystem Interoperability Version 1.0</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=1998967c-3da8-413e-b51f-6256a5cb2b0d</guid>
      <link>http://www.leastprivilege.com/IdentityMetasystemInteroperabilityVersion10.aspx</link>
      <pubDate>Thu, 02 Jul 2009 07:25:29 GMT</pubDate>
      <description>&lt;p&gt;
The IMI spec is now approved. Grats!
&lt;/p&gt;
&lt;p&gt;
Read more &lt;a href="http://self-issued.info/?p=163"&gt;here&lt;/a&gt; and get the spec &lt;a href="http://docs.oasis-open.org/imi/identity/v1.0/identity.html"&gt;here&lt;/a&gt;.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=1998967c-3da8-413e-b51f-6256a5cb2b0d" /&gt;</description>
      <category>IdentityModel</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=25f9f09f-a6ac-4025-af8d-80cc20415ba2</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=25f9f09f-a6ac-4025-af8d-80cc20415ba2</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <title>Partial Trust ASP.NET in 4.0 (Advanced Scenarios)</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=25f9f09f-a6ac-4025-af8d-80cc20415ba2</guid>
      <link>http://www.leastprivilege.com/PartialTrustASPNETIn40AdvancedScenarios.aspx</link>
      <pubDate>Wed, 01 Jul 2009 06:40:07 GMT</pubDate>
      <description>&lt;p&gt;
In the last post I showed you how to use the new CLR security model to do sandboxing
in ASP.NET.
&lt;/p&gt;
&lt;p&gt;
One new hook into this system is a custom host security policy resolver. A policy
resolver is a class that derives from &lt;em&gt;System.Web.Hosting.HostSecurityPolicyResolver&lt;/em&gt;.
The idea behind this extensibility point is, that a resolver can decide at runtime
(as opposed to the static &lt;em&gt;fullTrustAssemblies&lt;/em&gt; configuration element) in which
“permission bucket” the assembly should get loaded – AppDomain grant set, full trust
or nothing.
&lt;/p&gt;
&lt;p&gt;
A resolver has a single method called &lt;em&gt;ResolvePolicy&lt;/em&gt;. ASP.NET hands in the
evidence of every application assembly that gets loaded into the resolver, and it
is the implementer’s job to decide the “trust level”.
&lt;/p&gt;
&lt;p&gt;
&lt;em&gt;ResolvePolicy&lt;/em&gt; returns a &lt;em&gt;HostSecurityPolicyResults&lt;/em&gt; enum which can
have one of these values: DefaultPolicy, FullTrust, AppDomainTrust or Nothing.
&lt;/p&gt;
&lt;p&gt;
You register the resolver using the following config element:
&lt;/p&gt;
&lt;p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;
&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us" lang="EN-US"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-family: consolas; color: #a31515; mso-ansi-language: en-us" lang="EN-US"&gt;trust&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us" lang="EN-US"&gt; &lt;/span&gt;&lt;span style="font-family: consolas; color: red; mso-ansi-language: en-us" lang="EN-US"&gt;level&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; mso-ansi-language: en-us" lang="EN-US"&gt;=&lt;/span&gt;&lt;span style="font-family: consolas; mso-ansi-language: en-us" lang="EN-US"&gt;"&lt;span style="color: blue"&gt;Medium&lt;/span&gt;"&lt;br&gt;
&lt;span style="color: blue"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: red"&gt;permissionSetName&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;ASP.Net&lt;/span&gt;"&lt;br&gt;
&lt;span style="color: blue"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: red"&gt;hostSecurityPolicyResolverType&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;Policy.PolicyResolver,
…&lt;/span&gt;" &lt;span style="color: blue"&gt;/&amp;gt;&lt;/span&gt;&lt;?xml:namespace prefix = o /&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
A resolver must be in the GAC – otherwise you may receive a strange exception saying
“assembly still being loaded”…
&lt;/p&gt;
&lt;p&gt;
HTH
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=25f9f09f-a6ac-4025-af8d-80cc20415ba2" /&gt;</description>
      <category>FX Security</category>
      <category>ASP.NET</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=c3daa1fc-9b5c-4773-aba2-80275b3c7833</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=c3daa1fc-9b5c-4773-aba2-80275b3c7833</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <title>Partial Trust ASP.NET in 4.0</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=c3daa1fc-9b5c-4773-aba2-80275b3c7833</guid>
      <link>http://www.leastprivilege.com/PartialTrustASPNETIn40.aspx</link>
      <pubDate>Tue, 30 Jun 2009 12:02:08 GMT</pubDate>
      <description>&lt;p&gt;
In .NET v4 there are substantial changes to the CLR security model. Read about all
the details &lt;a href="http://blogs.msdn.com/shawnfa/archive/2009/06/12/clr-v4-security-policy-roundup.aspx"&gt;here&lt;/a&gt;.
With Beta 1 in hand I gave the new model a try in the probably most popular host for
partial trust – ASP.NET.
&lt;/p&gt;
&lt;p&gt;
You start with setting the trust level in &lt;em&gt;web.config&lt;/em&gt;. This works exactly
the same as in pre-V4. Also the same &lt;em&gt;web_xytrust.config&lt;/em&gt; files from the framework
configuration directory are used. Since policy levels and code groups are not in effect
any longer in V4, ASP.NET by default uses the named permission set called&lt;em&gt; ASP.Net&lt;/em&gt; as
the grant set for the AppDomain. 
&lt;br&gt;
You can also specify a different set via the new &lt;em&gt;permissionSetName&lt;/em&gt; attribute.
&lt;/p&gt;
&lt;p class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: consolas; COLOR: blue; mso-ansi-language: en-us" lang=EN-US&gt;&amp;lt;&lt;/span&gt;&lt;span style="FONT-FAMILY: consolas; COLOR: #a31515; mso-ansi-language: en-us" lang=EN-US&gt;trust&lt;/span&gt;&lt;span style="FONT-FAMILY: consolas; COLOR: blue; mso-ansi-language: en-us" lang=EN-US&gt; &lt;/span&gt;&lt;span style="FONT-FAMILY: consolas; COLOR: red; mso-ansi-language: en-us" lang=EN-US&gt;level&lt;/span&gt;&lt;span style="FONT-FAMILY: consolas; COLOR: blue; mso-ansi-language: en-us" lang=EN-US&gt;=&lt;/span&gt;&lt;span style="FONT-FAMILY: consolas; mso-ansi-language: en-us" lang=EN-US&gt;"&lt;span style="COLOR: blue"&gt;Medium&lt;/span&gt;"&lt;span style="COLOR: blue"&gt; &lt;/span&gt;&lt;span style="COLOR: red"&gt;permissionSetName&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;ASP.Net&lt;/span&gt;"&lt;span style="COLOR: blue"&gt; /&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-ansi-language: en-us" lang=EN-US&gt;&lt;?xml:namespace prefix = o /&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
So far everything behaves like in CLR2. Now a typical thing to do would be to factor
out the “dangerous” code into separate assemblies and grant these assemblies full
trust to do their work. In CLR2 you either GACed such an assembly or modified the
security policy to grant whatever permissions were needed.
&lt;/p&gt;
&lt;p&gt;
Since there is no security policy anymore in V4 and ASP.NET has moved to the homogenous
AppDomain model – things work differently (and easier) now. In a homogenous AppDomain
there are permission-wise two types of assemblies – ones constrained by the AppDomain
grant set and full trust assemblies. With the new &lt;em&gt;fullTrustAssemblies&lt;/em&gt; configuration
element, you can specify which assemblies should be loaded in full trust, e.g.:
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: consolas; COLOR: blue; mso-ansi-language: en-us" lang=EN-US&gt;&amp;lt;&lt;/span&gt;&lt;span style="FONT-FAMILY: consolas; COLOR: #a31515; mso-ansi-language: en-us" lang=EN-US&gt;fullTrustAssemblies&lt;/span&gt;&lt;span style="FONT-FAMILY: consolas; COLOR: blue; mso-ansi-language: en-us" lang=EN-US&gt;&amp;gt;&lt;/span&gt;&lt;span style="FONT-FAMILY: consolas; mso-ansi-language: en-us" lang=EN-US&gt;
&lt;br&gt;
&lt;span style="COLOR: blue"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;add&lt;/span&gt;&lt;span style="COLOR: blue"&gt; &lt;/span&gt;&lt;span style="COLOR: red"&gt;assemblyName&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;HelperLib&lt;/span&gt;"&lt;br&gt;
&lt;span style="COLOR: blue"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="COLOR: red"&gt;version&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;1.0.0.0&lt;/span&gt;"&lt;br&gt;
&lt;span style="COLOR: blue"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="COLOR: red"&gt;publicKey&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;0024…cb0&lt;/span&gt;"&lt;span style="COLOR: blue"&gt; /&amp;gt;&lt;/span&gt;
&lt;br&gt;
&lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;fullTrustAssemblies&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
To make &lt;em&gt;HelperLib&lt;/em&gt; callable from partial trust, you have to add the standard &lt;em&gt;[AllowPartiallyTrustedCallers]&lt;/em&gt; attribute
to the assembly. With the new transparency model in V4, APTCA means that the library
provides services to partially trusted code and can contain critical and safe critical
code. All un-annotated code in an APTCA assembly becomes security transparent by default.
&lt;/p&gt;
&lt;p&gt;
This is a huge improvement over the old model. Since partially trusted code is always
transparent, it can only call transparent or safe critical code. The typical pattern
is that you provide safe critical “gateways” in your library where you do all the
security checks, input validation and asserts (if necessary). From there you then
call into the critical code (e.g. a library function).
&lt;/p&gt;
&lt;p&gt;
The following is a simple example of a library that provides read access to certain
directories to partially trusted ASP.NET applications:
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: consolas; mso-ansi-language: en-us" lang=EN-US&gt;[&lt;span style="COLOR: blue"&gt;assembly&lt;/span&gt;: &lt;span style="COLOR: #2b91af"&gt;AllowPartiallyTrustedCallers&lt;/span&gt;]&lt;br&gt;
&lt;br&gt;
&lt;span style="COLOR: blue"&gt;namespace&lt;/span&gt; HelperLib&lt;br&gt;
{&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;public&lt;/span&gt; &lt;span style="COLOR: blue"&gt;class&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;Helper&lt;/span&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;[&lt;span style="COLOR: #2b91af"&gt;SecuritySafeCritical&lt;/span&gt;]&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;public&lt;/span&gt; &lt;span style="COLOR: blue"&gt;string&lt;/span&gt; ReadFile(&lt;span style="COLOR: blue"&gt;string&lt;/span&gt; filename)&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;var&lt;/span&gt; perm
= &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;FileIOPermission&lt;/span&gt;(&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;FileIOPermissionAccess&lt;/span&gt;.Read,
GetAllowedContentDirs());&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;perm.Assert();&lt;br&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;return&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;File&lt;/span&gt;.ReadAllText(filename);&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;}&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br&gt;
}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
HTH
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=c3daa1fc-9b5c-4773-aba2-80275b3c7833" /&gt;</description>
      <category>ASP.NET</category>
      <category>FX Security</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=3ab0d566-84a6-4eee-bb6b-b32cdced9b52</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=3ab0d566-84a6-4eee-bb6b-b32cdced9b52</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I just uploaded a minor update to the Starter STS sample to codeplex. This release
adds more options for realm checking (see the <em>allowKnownRealmsOnly</em> config
switch) as well as Information Card issuance.
</p>
        <p>
As always – feedback is welcome!
</p>
        <p>
          <a href="http://startersts.codeplex.com">http://startersts.codeplex.com</a>
        </p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=3ab0d566-84a6-4eee-bb6b-b32cdced9b52" />
      </body>
      <title>Updated Starter STS</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=3ab0d566-84a6-4eee-bb6b-b32cdced9b52</guid>
      <link>http://www.leastprivilege.com/UpdatedStarterSTS.aspx</link>
      <pubDate>Wed, 17 Jun 2009 07:21:52 GMT</pubDate>
      <description>&lt;p&gt;
I just uploaded a minor update to the Starter STS sample to codeplex. This release
adds more options for realm checking (see the &lt;em&gt;allowKnownRealmsOnly&lt;/em&gt; config
switch) as well as Information Card issuance.
&lt;/p&gt;
&lt;p&gt;
As always – feedback is welcome!
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://startersts.codeplex.com"&gt;http://startersts.codeplex.com&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=3ab0d566-84a6-4eee-bb6b-b32cdced9b52" /&gt;</description>
      <category>IdentityModel</category>
      <category>ASP.NET</category>
      <category>WCF</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=719c0353-b68f-44d7-a69e-7cb2fe43b121</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=719c0353-b68f-44d7-a69e-7cb2fe43b121</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I did a talk about the ACS in May. It was interesting to present that topic to a non-Developer,
non-Microsoft minded audience. 
</p>
        <p>
Here’s the outcome:<br /><a href="http://www.viddler.com/explore/TROOPERS/videos/1/">http://www.viddler.com/explore/TROOPERS/videos/1/</a></p>
        <p>
_
</p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=719c0353-b68f-44d7-a69e-7cb2fe43b121" />
      </body>
      <title>.NET Access Control Service Talk from Troopers09</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=719c0353-b68f-44d7-a69e-7cb2fe43b121</guid>
      <link>http://www.leastprivilege.com/NETAccessControlServiceTalkFromTroopers09.aspx</link>
      <pubDate>Fri, 05 Jun 2009 03:45:53 GMT</pubDate>
      <description>&lt;p&gt;
I did a talk about the ACS in May. It was interesting to present that topic to a non-Developer,
non-Microsoft minded audience. 
&lt;/p&gt;
&lt;p&gt;
Here’s the outcome:&lt;br&gt;
&lt;a href="http://www.viddler.com/explore/TROOPERS/videos/1/"&gt;http://www.viddler.com/explore/TROOPERS/videos/1/&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
_
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=719c0353-b68f-44d7-a69e-7cb2fe43b121" /&gt;</description>
      <category>IdentityModel</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=90f35935-27d1-4970-aef5-44d18b2b5aa9</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=90f35935-27d1-4970-aef5-44d18b2b5aa9</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <a href="https://connect.microsoft.com/Downloads/DownloadDetails.aspx?SiteID=642&amp;DownloadID=18933">This</a> document
appeard on the connect site. Interesting.
</p>
        <p>
_
</p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=90f35935-27d1-4970-aef5-44d18b2b5aa9" />
      </body>
      <title>Writing Custom Attribute Stores for Geneva Server (B2)</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=90f35935-27d1-4970-aef5-44d18b2b5aa9</guid>
      <link>http://www.leastprivilege.com/WritingCustomAttributeStoresForGenevaServerB2.aspx</link>
      <pubDate>Thu, 04 Jun 2009 06:31:37 GMT</pubDate>
      <description>&lt;p&gt;
&lt;a href="https://connect.microsoft.com/Downloads/DownloadDetails.aspx?SiteID=642&amp;amp;DownloadID=18933"&gt;This&lt;/a&gt; document
appeard on the connect site. Interesting.
&lt;/p&gt;
&lt;p&gt;
_
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=90f35935-27d1-4970-aef5-44d18b2b5aa9" /&gt;</description>
      <category>IdentityModel</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=04c9ec88-03e7-4315-8a9e-e87ce4ed1aa2</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=04c9ec88-03e7-4315-8a9e-e87ce4ed1aa2</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Windows 7 and Windows Server 2008 R2 ship with IIS 7.5. While migrating the <a href="http://startersts.codeplex.com/">StarterSTS</a>,
I made an interesting observation. I remember vaguely I read about that somewhere
– but basically I got this error message:
</p>
        <blockquote>
          <p>
            <font face="Courier">Cannot open database "aspnetdb" requested by the login. The login
failed.Login failed for user '<strong>IIS APPPOOL\DefaultAppPool</strong>'. </font>
          </p>
        </blockquote>
        <p>
That’s an interesting account. 
</p>
        <p>
A closer look reveals, that in IIS manager you now have five accounts to choose from
when setting up an App Pool: System, Network Service, Local Service, Custom… and ApplicationPoolIdentity.
The default value is ApplicationPoolIdentity. 
</p>
        <p>
With this new setting, a new primary SID is injected into the worker process – all
Windows security checks are done against this new SID. Converting that NT Account
to an SID reveals an S-1-5-82 – which was new to me. 
</p>
        <p>
So in the light of the recent problems with system account sharing (<a href="http://www.leastprivilege.com/SystemAccountsAndSQLServer2005.aspx">here</a> and <a href="http://www.leastprivilege.com/FixingTokenKidnapping.aspx">here</a>),
this is a good change and makes it even easier to isolate worker processes. 
</p>
        <p>
HTH <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=04c9ec88-03e7-4315-8a9e-e87ce4ed1aa2" /></p>
      </body>
      <title>Worker Process Accounts in IIS 7.5</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=04c9ec88-03e7-4315-8a9e-e87ce4ed1aa2</guid>
      <link>http://www.leastprivilege.com/WorkerProcessAccountsInIIS75.aspx</link>
      <pubDate>Wed, 03 Jun 2009 18:59:03 GMT</pubDate>
      <description>&lt;p&gt;
Windows 7 and Windows Server 2008 R2 ship with IIS 7.5. While migrating the &lt;a href="http://startersts.codeplex.com/"&gt;StarterSTS&lt;/a&gt;,
I made an interesting observation. I remember vaguely I read about that somewhere
– but basically I got this error message:
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
&lt;font face="Courier"&gt;Cannot open database "aspnetdb" requested by the login. The login
failed.Login failed for user '&lt;strong&gt;IIS APPPOOL\DefaultAppPool&lt;/strong&gt;'. &lt;/font&gt;
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
That’s an interesting account. 
&lt;p&gt;
A closer look reveals, that in IIS manager you now have five accounts to choose from
when setting up an App Pool: System, Network Service, Local Service, Custom… and ApplicationPoolIdentity.
The default value is ApplicationPoolIdentity. 
&lt;p&gt;
With this new setting, a new primary SID is injected into the worker process – all
Windows security checks are done against this new SID. Converting that NT Account
to an SID reveals an S-1-5-82 – which was new to me. 
&lt;p&gt;
So in the light of the recent problems with system account sharing (&lt;a href="http://www.leastprivilege.com/SystemAccountsAndSQLServer2005.aspx"&gt;here&lt;/a&gt; and &lt;a href="http://www.leastprivilege.com/FixingTokenKidnapping.aspx"&gt;here&lt;/a&gt;),
this is a good change and makes it even easier to isolate worker processes. 
&lt;p&gt;
HTH &lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=04c9ec88-03e7-4315-8a9e-e87ce4ed1aa2" /&gt;</description>
      <category>IIS</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=f232f54a-f435-4684-a027-299caf95f1e8</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=f232f54a-f435-4684-a027-299caf95f1e8</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Remember that Geneva framework is a framework – all the nice integration into WCF
and ASP.NET is built on top of a public API. This also means that you can use Geneva
framework for integration in arbitrary hosts and environments.
</p>
        <p>
One thing you most often need is access to the Geneva framework configuration (microsoft.identityModel
section) from code – and again this is very easy:
</p>
        <span style="line-height: 115%; font-family: consolas; color: #2b91af; font-size: 11pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-fareast-language: en-us; mso-bidi-language: ar-sa; mso-no-proof: yes">ServiceConfiguration</span>
        <span style="line-height: 115%; font-family: consolas; font-size: 11pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-fareast-language: en-us; mso-bidi-language: ar-sa; mso-no-proof: yes"> config
= <span style="color: blue">new</span><br /><span style="mso-spacerun: yes">  </span><span style="color: #2b91af">ServiceConfiguration</span>(<span style="color: #2b91af">ServiceConfiguration</span>.DefaultServiceName);</span>
        <p>
HTH
</p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=f232f54a-f435-4684-a027-299caf95f1e8" />
      </body>
      <title>Geneva Framework Quick Tip: How to access Configuration</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=f232f54a-f435-4684-a027-299caf95f1e8</guid>
      <link>http://www.leastprivilege.com/GenevaFrameworkQuickTipHowToAccessConfiguration.aspx</link>
      <pubDate>Thu, 28 May 2009 05:21:31 GMT</pubDate>
      <description>&lt;p&gt;
Remember that Geneva framework is a framework – all the nice integration into WCF
and ASP.NET is built on top of a public API. This also means that you can use Geneva
framework for integration in arbitrary hosts and environments.
&lt;/p&gt;
&lt;p&gt;
One thing you most often need is access to the Geneva framework configuration (microsoft.identityModel
section) from code – and again this is very easy:
&lt;/p&gt;
&lt;span style="line-height: 115%; font-family: consolas; color: #2b91af; font-size: 11pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-fareast-language: en-us; mso-bidi-language: ar-sa; mso-no-proof: yes"&gt;ServiceConfiguration&lt;/span&gt;&lt;span style="line-height: 115%; font-family: consolas; font-size: 11pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-fareast-language: en-us; mso-bidi-language: ar-sa; mso-no-proof: yes"&gt; config
= &lt;span style="color: blue"&gt;new&lt;/span&gt; 
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;ServiceConfiguration&lt;/span&gt;(&lt;span style="color: #2b91af"&gt;ServiceConfiguration&lt;/span&gt;.DefaultServiceName);&lt;/span&gt; 
&lt;p&gt;
HTH
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=f232f54a-f435-4684-a027-299caf95f1e8" /&gt;</description>
      <category>IdentityModel</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=9bc0129c-9979-4b86-8460-4d3cdd73bf9d</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=9bc0129c-9979-4b86-8460-4d3cdd73bf9d</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <title>Geneva Framework Quick Tip: Hosting a Security Token Service</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=9bc0129c-9979-4b86-8460-4d3cdd73bf9d</guid>
      <link>http://www.leastprivilege.com/GenevaFrameworkQuickTipHostingASecurityTokenService.aspx</link>
      <pubDate>Thu, 28 May 2009 04:50:57 GMT</pubDate>
      <description>&lt;p&gt;
The idea of the security token service infrastructure in Geneva is, that it is completely
host agnostic. The STS itself expects a &lt;em&gt;RequestSecurityToken&lt;/em&gt; and returns
a &lt;em&gt;RequestSecurityTokenResponse&lt;/em&gt;. It is the job of the host to translate some
protocol back and forth to this technology independent representation.
&lt;/p&gt;
&lt;p&gt;
The key to STS hosting (and that’s btw what the WCF &lt;em&gt;WSTrustServiceContract&lt;/em&gt; class
or the &lt;em&gt;FederatedPassiveSignin&lt;/em&gt; web control does) is to create a token service
from configuration. And this couldn’t be easier ;)
&lt;/p&gt;
&lt;p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;
&lt;span style="font-family: consolas; color: blue; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;var&lt;/span&gt;&lt;span style="font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt; config
= &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;TokenServiceConfiguration&lt;/span&gt;();&lt;br&gt;
&lt;span style="color: blue"&gt;var&lt;/span&gt; sts = config.CreateSecurityTokenService();&lt;br&gt;
&lt;br&gt;
&lt;span style="color: blue"&gt;var&lt;/span&gt;&lt;?xml:namespace prefix = o /&gt; rstr = sts.Issue(principal,
rst);&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
HTH
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=9bc0129c-9979-4b86-8460-4d3cdd73bf9d" /&gt;</description>
      <category>IdentityModel</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=9f03c141-23f0-4ab7-8cb9-ef442229b21a</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=9f03c141-23f0-4ab7-8cb9-ef442229b21a</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
All two screencasts about the starter STS <a href="http://startersts.codeplex.com/">sample</a> are
online now:
</p>
        <ul>
          <li>
Setup &amp; Overview (<a href="http://www.leastprivilege.com/startersts/StarterSTS_SetupAndOverview.wmv">download</a>)</li>
          <li>
Advanced Topics &amp; Configuration (<a href="http://www.leastprivilege.com/startersts/StarterSTS_Advanced.wmv">download</a>)</li>
        </ul>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=9f03c141-23f0-4ab7-8cb9-ef442229b21a" />
      </body>
      <title>Starter STS Screencasts</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=9f03c141-23f0-4ab7-8cb9-ef442229b21a</guid>
      <link>http://www.leastprivilege.com/StarterSTSScreencasts.aspx</link>
      <pubDate>Wed, 27 May 2009 13:54:12 GMT</pubDate>
      <description>&lt;p&gt;
All two screencasts about the starter STS &lt;a href="http://startersts.codeplex.com/"&gt;sample&lt;/a&gt; are
online now:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Setup &amp;amp; Overview (&lt;a href="http://www.leastprivilege.com/startersts/StarterSTS_SetupAndOverview.wmv"&gt;download&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;
Advanced Topics &amp;amp; Configuration (&lt;a href="http://www.leastprivilege.com/startersts/StarterSTS_Advanced.wmv"&gt;download&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=9f03c141-23f0-4ab7-8cb9-ef442229b21a" /&gt;</description>
      <category>IdentityModel</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=863984d8-afcd-421e-a6e7-5b9cfb132d95</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=863984d8-afcd-421e-a6e7-5b9cfb132d95</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I am happy to announce the “Thinktecture STS Starter Kit” sample. The STS starter
kit is a compact, easy to use identity provider that is completely based on the ASP.NET
provider infrastructure. It is built using the Geneva framework Beta 2 bits and is
a self contained web site with passive and active endpoints (Christian has some <a href="http://blogs.thinktecture.com/cweyer/archive/2009/05/26/415363.aspx">screenshots</a>).
</p>
        <p>
          <img border="0" src="http://www.leastprivilege.com/content/binary/overview1.png" />
        </p>
        <p>
The motivation behind writing this sample is twofold. First, writing a custom STS
from scratch is not terribly hard – but it is also not a trivial task. In addition
the full featured Geneva Server product may not fit your requirements (e.g. because
your users are not stored in Active Directory). So a lot of people I spoke to mentioned
that it would be nice to have a simple STS that uses membership, roles and profile
and that is easy to setup and get going.
</p>
        <p>
The other reason is that starter STS is not terribly complex and could be used as
a learning tool on how to write custom token services. You could e.g. replace the
provider plumbing with your own libraries while you go.
</p>
        <p>
Some features:
</p>
        <ul>
          <li>
active and passive security token service 
</li>
          <li>
supports WS-Federation, WS-Trust 1.3 (message and mixed) and SAML 1.1/2.0 tokens 
</li>
          <li>
based on the standard membership, roles and profile provider infrastructure 
</li>
          <li>
membership provider is used to authenticate users and to provide a name and email
claim 
</li>
          <li>
role provider is used for authorization in the web front-end and to provider role
claims 
</li>
          <li>
profile provider is used to allow users to supply profile information which gets turned
into claims 
</li>
          <li>
easy administration of the provider features using the IIS7 manager 
</li>
          <li>
easy configuration – you don’t have to deal with Geneva or WCF settings directly 
</li>
          <li>
control over security policy (SSL, encryption, SOAP security) 
</li>
          <li>
dynamic web UI to allow users to maintain their profile data 
</li>
          <li>
automatic generation of a WS-Federation metadata document to allow RPs to federate
using e.g. FedUtil</li>
        </ul>
        <p>
To make it even easier for you to setup and start using the STS, I have recorded a
screencast that walks you through the installation and setup process. In the following
posts I will focus more on on some of the feature areas and explain how they are used
and implemented. Have fun!
</p>
        <p>
          <a href="http://startersts.codeplex.com">
            <em>Download</em>
          </a>
          <em> STS Starter Kit
Sample.</em>
          <br />
          <em>
            <a href="http://www.leastprivilege.com/startersts/StarterSTS_SetupAndOverview.wmv">Download</a> Setup&amp;Overview
Screencast</em>
        </p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=863984d8-afcd-421e-a6e7-5b9cfb132d95" />
      </body>
      <title>Thinktecture Security Token Service Starter Kit</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=863984d8-afcd-421e-a6e7-5b9cfb132d95</guid>
      <link>http://www.leastprivilege.com/ThinktectureSecurityTokenServiceStarterKit.aspx</link>
      <pubDate>Tue, 26 May 2009 05:54:25 GMT</pubDate>
      <description>&lt;p&gt;
I am happy to announce the “Thinktecture STS Starter Kit” sample. The STS starter
kit is a compact, easy to use identity provider that is completely based on the ASP.NET
provider infrastructure. It is built using the Geneva framework Beta 2 bits and is
a self contained web site with passive and active endpoints (Christian has some &lt;a href="http://blogs.thinktecture.com/cweyer/archive/2009/05/26/415363.aspx"&gt;screenshots&lt;/a&gt;).
&lt;/p&gt;
&lt;p&gt;
&lt;img border=0 src="http://www.leastprivilege.com/content/binary/overview1.png"&gt;
&lt;/p&gt;
&lt;p&gt;
The motivation behind writing this sample is twofold. First, writing a custom STS
from scratch is not terribly hard – but it is also not a trivial task. In addition
the full featured Geneva Server product may not fit your requirements (e.g. because
your users are not stored in Active Directory). So a lot of people I spoke to mentioned
that it would be nice to have a simple STS that uses membership, roles and profile
and that is easy to setup and get going.
&lt;/p&gt;
&lt;p&gt;
The other reason is that starter STS is not terribly complex and could be used as
a learning tool on how to write custom token services. You could e.g. replace the
provider plumbing with your own libraries while you go.
&lt;/p&gt;
&lt;p&gt;
Some features:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
active and passive security token service 
&lt;li&gt;
supports WS-Federation, WS-Trust 1.3 (message and mixed) and SAML 1.1/2.0 tokens 
&lt;li&gt;
based on the standard membership, roles and profile provider infrastructure 
&lt;li&gt;
membership provider is used to authenticate users and to provide a name and email
claim 
&lt;li&gt;
role provider is used for authorization in the web front-end and to provider role
claims 
&lt;li&gt;
profile provider is used to allow users to supply profile information which gets turned
into claims 
&lt;li&gt;
easy administration of the provider features using the IIS7 manager 
&lt;li&gt;
easy configuration – you don’t have to deal with Geneva or WCF settings directly 
&lt;li&gt;
control over security policy (SSL, encryption, SOAP security) 
&lt;li&gt;
dynamic web UI to allow users to maintain their profile data 
&lt;li&gt;
automatic generation of a WS-Federation metadata document to allow RPs to federate
using e.g. FedUtil&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
To make it even easier for you to setup and start using the STS, I have recorded a
screencast that walks you through the installation and setup process. In the following
posts I will focus more on on some of the feature areas and explain how they are used
and implemented. Have fun!
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://startersts.codeplex.com"&gt;&lt;em&gt;Download&lt;/em&gt;&lt;/a&gt;&lt;em&gt; STS Starter Kit
Sample.&lt;/em&gt;
&lt;br&gt;
&lt;em&gt;&lt;a href="http://www.leastprivilege.com/startersts/StarterSTS_SetupAndOverview.wmv"&gt;Download&lt;/a&gt; Setup&amp;amp;Overview
Screencast&lt;/em&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=863984d8-afcd-421e-a6e7-5b9cfb132d95" /&gt;</description>
      <category>IdentityModel</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=01bcf5e9-af5f-477f-99a8-80f76ce8f266</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=01bcf5e9-af5f-477f-99a8-80f76ce8f266</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <title>Use Geneva Session Management for your own needs</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=01bcf5e9-af5f-477f-99a8-80f76ce8f266</guid>
      <link>http://www.leastprivilege.com/UseGenevaSessionManagementForYourOwnNeeds.aspx</link>
      <pubDate>Sun, 24 May 2009 14:04:32 GMT</pubDate>
      <description>&lt;p&gt;
Geneva Framework is a Framework is a Framework.
&lt;/p&gt;
&lt;p&gt;
One part of that framework is the &lt;em&gt;SessionAuthenticationModule&lt;/em&gt; for ASP.NET.
In all the typical samples this is used to convert an incoming SAML token to a cookie
to establish an authentication session.
&lt;/p&gt;
&lt;p&gt;
A closer look reveals, that the purpose of this module is actually serializing &lt;em&gt;SessionSecurityToken&lt;/em&gt;s
into cookies. A &lt;em&gt;SessionSecurityToken&lt;/em&gt; in turn is a container for an &lt;em&gt;IClaimsPrincipal&lt;/em&gt; and
an additional &lt;em&gt;SecurityToken&lt;/em&gt; (the so called bootstrap token).
&lt;/p&gt;
&lt;p&gt;
This means that the &lt;em&gt;SessionAuthenticationModule&lt;/em&gt; is a general module and API
to serialize claims principals and security tokens into cookies. In addition there
is an extensible architecture around how these cookies are layed out and protected.
You can utilize this infrastructure whenever you need to serialize and round-trip
an &lt;em&gt;IClaimsPrincipal&lt;/em&gt;.
&lt;/p&gt;
&lt;p&gt;
Where can this be useful? Let’s do this little walkthrough…
&lt;/p&gt;
&lt;p&gt;
First use the Visual Studio Geneva templates to create a simple “Claims-aware ASP.Net
WebSite”. This sample uses the &lt;em&gt;ClaimsPrincipalHttpModule&lt;/em&gt; to create an &lt;em&gt;IClaimsPrincipal &lt;/em&gt;from
the standard forms authentication principal.
&lt;/p&gt;
&lt;p&gt;
In the next step add a &lt;em&gt;ClaimsAuthenticationManager&lt;/em&gt; to the web site and register
it, e.g.:
&lt;/p&gt;
&lt;p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;
&lt;span style="font-family: consolas; color: blue; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;public&lt;/span&gt;&lt;span style="font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt; &lt;span style="color: blue"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Transformer&lt;/span&gt; : &lt;span style="color: #2b91af"&gt;ClaimsAuthenticationManager&lt;br&gt;
&lt;/span&gt;{&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;override&lt;/span&gt; &lt;span style="color: #2b91af"&gt;IClaimsPrincipal&lt;/span&gt; Authenticate(&lt;span style="color: blue"&gt;string&lt;/span&gt; endpointUri, &lt;span style="color: #2b91af"&gt;IClaimsPrincipal&lt;/span&gt; incomingPrincipal)&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green"&gt;//
expensive operation&lt;/span&gt;&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;incomingPrincipal.Identities[0].Claims.Add(&lt;span style="color: blue"&gt;new&lt;/span&gt;
&lt;br&gt;
&lt;span style="color: #2b91af"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Claim&lt;/span&gt;(&lt;span style="color: #a31515"&gt;"http://claims/expensive"&lt;/span&gt;, &lt;span style="color: #a31515"&gt;"expensive
value"&lt;/span&gt;));&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;return&lt;/span&gt; incomingPrincipal;&lt;span style="color: #2b91af"&gt;&lt;?xml:namespace prefix = o /&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;
&lt;span style="font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;}&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
The custom claims you are adding in the authentication manager might come from some
remote data store and you probably want to avoid such a round-trip on every request.
To optimize this, you could come up with some server-local caching strategy – or use
the &lt;em&gt;SessionAuthenticationModule&lt;/em&gt; to serialize the &lt;em&gt;IClaimsPrincipal&lt;/em&gt; after
transformation to a cookie. The module will then reconstruct the &lt;em&gt;IClaimsPrincipal&lt;/em&gt; on
subsequest requests and set it as the current principal for the ASP.NET application.
&lt;/p&gt;
&lt;p&gt;
First add the session authentication module to the modules section in web.config –
then add this code to the authentication manager:
&lt;/p&gt;
&lt;p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;
&lt;span style="font-family: consolas; color: blue; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;private&lt;/span&gt;&lt;span style="font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; SetSessionCookie(&lt;span style="color: #2b91af"&gt;IClaimsPrincipal&lt;/span&gt; incomingPrincipal)&lt;br&gt;
{&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;SessionSecurityToken&lt;/span&gt; token
= &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;SessionSecurityToken&lt;/span&gt;(incomingPrincipal);&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;FederatedAuthentication&lt;/span&gt;.SessionAuthenticationModule.WriteSessionTokenToCookie(token);&lt;br&gt;
}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
Call this method before you return the transformed principal back to Geneva.
&lt;/p&gt;
&lt;p&gt;
Note: When your app is not running over SSL – you need to set the &lt;em&gt;requireSsl&lt;/em&gt; setting
for the cookie handler in web.config to &lt;em&gt;false&lt;/em&gt;.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=01bcf5e9-af5f-477f-99a8-80f76ce8f266" /&gt;</description>
      <category>IdentityModel</category>
      <category>ASP.NET</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=12685563-062d-4492-8b8f-2599cafe89df</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=12685563-062d-4492-8b8f-2599cafe89df</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <a href="http://blogs.thinktecture.com/cweyer">Mr. Metadata</a> strikes back! This
time with a generator/wizard for WS-Federation Metadata language. This makes it very
easy to create documents that can be consumed by Geneva Server or FedUtil.
</p>
        <p>
More info <a href="http://blogs.thinktecture.com/cweyer/archive/2009/05/22/415362.aspx">here</a>.
</p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=12685563-062d-4492-8b8f-2599cafe89df" />
      </body>
      <title>Thinktecture WS-Federation Metadata Generator</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=12685563-062d-4492-8b8f-2599cafe89df</guid>
      <link>http://www.leastprivilege.com/ThinktectureWSFederationMetadataGenerator.aspx</link>
      <pubDate>Fri, 22 May 2009 11:43:30 GMT</pubDate>
      <description>&lt;p&gt;
&lt;a href="http://blogs.thinktecture.com/cweyer"&gt;Mr. Metadata&lt;/a&gt; strikes back! This
time with a generator/wizard for WS-Federation Metadata language. This makes it very
easy to create documents that can be consumed by Geneva Server or FedUtil.
&lt;/p&gt;
&lt;p&gt;
More info &lt;a href="http://blogs.thinktecture.com/cweyer/archive/2009/05/22/415362.aspx"&gt;here&lt;/a&gt;.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=12685563-062d-4492-8b8f-2599cafe89df" /&gt;</description>
      <category>ASP.NET</category>
      <category>WCF</category>
      <category>IdentityModel</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=b2811990-e91a-4c87-bdff-5b0e5841207d</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=b2811990-e91a-4c87-bdff-5b0e5841207d</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Now that Beta 1 has shipped I am finally allowed to talk about the new/changed security
features in 4.0 – but there is no one who can explain these things more elaborate
and insightful than <a href="http://blogs.msdn.com/shawnfa">Shawn</a>. I just saw
that he is about to start a <a href="http://blogs.msdn.com/shawnfa/archive/2009/05/20/net-4-0-security.aspx">series</a> of
posts on the new feature areas. So watch his space closely!
</p>
        <p>
(ah – and btw – leave a comment on his blog that he should write a book about security
in .NET 4.0 – maybe we can convince him ;)
</p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=b2811990-e91a-4c87-bdff-5b0e5841207d" />
      </body>
      <title>.NET 4.0 Security</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=b2811990-e91a-4c87-bdff-5b0e5841207d</guid>
      <link>http://www.leastprivilege.com/NET40Security.aspx</link>
      <pubDate>Thu, 21 May 2009 04:35:31 GMT</pubDate>
      <description>&lt;p&gt;
Now that Beta 1 has shipped I am finally allowed to talk about the new/changed security
features in 4.0 – but there is no one who can explain these things more elaborate
and insightful than &lt;a href="http://blogs.msdn.com/shawnfa"&gt;Shawn&lt;/a&gt;. I just saw
that he is about to start a &lt;a href="http://blogs.msdn.com/shawnfa/archive/2009/05/20/net-4-0-security.aspx"&gt;series&lt;/a&gt; of
posts on the new feature areas. So watch his space closely!
&lt;/p&gt;
&lt;p&gt;
(ah – and btw – leave a comment on his blog that he should write a book about security
in .NET 4.0 – maybe we can convince him ;)
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=b2811990-e91a-4c87-bdff-5b0e5841207d" /&gt;</description>
      <category>FX Security</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=5a928c11-27b6-4d2e-87b7-471647eee9a5</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=5a928c11-27b6-4d2e-87b7-471647eee9a5</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Just came across <a href="https://connect.microsoft.com/Downloads/DownloadDetails.aspx?SiteID=642&amp;DownloadID=18672">this</a> document.
Interesting read.
</p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=5a928c11-27b6-4d2e-87b7-471647eee9a5" />
      </body>
      <title>More Geneva Beta 2 Changes</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=5a928c11-27b6-4d2e-87b7-471647eee9a5</guid>
      <link>http://www.leastprivilege.com/MoreGenevaBeta2Changes.aspx</link>
      <pubDate>Mon, 18 May 2009 13:45:21 GMT</pubDate>
      <description>&lt;p&gt;
Just came across &lt;a href="https://connect.microsoft.com/Downloads/DownloadDetails.aspx?SiteID=642&amp;amp;DownloadID=18672"&gt;this&lt;/a&gt; document.
Interesting read.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=5a928c11-27b6-4d2e-87b7-471647eee9a5" /&gt;</description>
      <category>IdentityModel</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=089d0149-1bae-4bd9-9438-dbbced7c6415</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=089d0149-1bae-4bd9-9438-dbbced7c6415</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I am currently in the process of updating my Geneva code to Beta 2. There are some
pretty substantial changes/additions in the new Beta – so I thought I’ll detail some
of them while moving along. Today: <em>ClaimsPrincipalHttpModule</em>.
</p>
        <p>
For a basic understanding what the module does, I recommend reading my initial post <a href="http://www.leastprivilege.com/GenevaHTTPModulesClaimsPrincipalHttpModule.aspx">here</a>.
</p>
        <p>
Starting with Beta 2, <em>ClaimsPrincipalHttpModule</em> supports converting X509
client certificates to an <em>IClaimsPrincipal</em>. This is done by using the ctor
of <em>IClaimsIdentity</em> that takes an X509Certificate2 which results in an authenticated
identity with an authentication type set to “SSL/PCT”.
</p>
        <p>
Now as always, certificate based authentication is a little different to e.g. username/password.
In the strict sense a user is authenticated when you know “who he is”. For usernames/passwords
authentication this means as soon as you have successfully validated the password
against your data store (or put differently – as soon as the user provides a proof
for his identity). Proofing identity in the certificate case basically means that
the certificate is trusted and the client “knows” the corresponding private key. That’s
why the <em>ClaimsPrincipalHttpModule</em> sets <em>IsAuthenticated=true</em> when
the client certificate is valid.
</p>
        <p>
Now Windows/IIS supports a number of certificate issuers and a user can potentially
present a client cert to IIS which is “valid” but the client may still not be a valid/registered
user in your system. This results (depending on your design) in different semantics
for “IsAuthenticated” checks like <em>Request.IsAuthenticated</em> or <em>&lt;deny
users=”?” /&gt;</em>.
</p>
        <p>
A better way would be to replace blanket authentication checks with checks for specific
claims (like a “User” role or some permission).
</p>
        <p>
HTH
</p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=089d0149-1bae-4bd9-9438-dbbced7c6415" />
      </body>
      <title>Geneva Beta 2 Update: ClaimsPrincipalHttpModule</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=089d0149-1bae-4bd9-9438-dbbced7c6415</guid>
      <link>http://www.leastprivilege.com/GenevaBeta2UpdateClaimsPrincipalHttpModule.aspx</link>
      <pubDate>Mon, 18 May 2009 06:23:27 GMT</pubDate>
      <description>&lt;p&gt;
I am currently in the process of updating my Geneva code to Beta 2. There are some
pretty substantial changes/additions in the new Beta – so I thought I’ll detail some
of them while moving along. Today: &lt;em&gt;ClaimsPrincipalHttpModule&lt;/em&gt;.
&lt;/p&gt;
&lt;p&gt;
For a basic understanding what the module does, I recommend reading my initial post &lt;a href="http://www.leastprivilege.com/GenevaHTTPModulesClaimsPrincipalHttpModule.aspx"&gt;here&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
Starting with Beta 2, &lt;em&gt;ClaimsPrincipalHttpModule&lt;/em&gt; supports converting X509
client certificates to an &lt;em&gt;IClaimsPrincipal&lt;/em&gt;. This is done by using the ctor
of &lt;em&gt;IClaimsIdentity&lt;/em&gt; that takes an X509Certificate2 which results in an authenticated
identity with an authentication type set to “SSL/PCT”.
&lt;/p&gt;
&lt;p&gt;
Now as always, certificate based authentication is a little different to e.g. username/password.
In the strict sense a user is authenticated when you know “who he is”. For usernames/passwords
authentication this means as soon as you have successfully validated the password
against your data store (or put differently – as soon as the user provides a proof
for his identity). Proofing identity in the certificate case basically means that
the certificate is trusted and the client “knows” the corresponding private key. That’s
why the &lt;em&gt;ClaimsPrincipalHttpModule&lt;/em&gt; sets &lt;em&gt;IsAuthenticated=true&lt;/em&gt; when
the client certificate is valid.
&lt;/p&gt;
&lt;p&gt;
Now Windows/IIS supports a number of certificate issuers and a user can potentially
present a client cert to IIS which is “valid” but the client may still not be a valid/registered
user in your system. This results (depending on your design) in different semantics
for “IsAuthenticated” checks like &lt;em&gt;Request.IsAuthenticated&lt;/em&gt; or &lt;em&gt;&amp;lt;deny
users=”?” /&amp;gt;&lt;/em&gt;.
&lt;/p&gt;
&lt;p&gt;
A better way would be to replace blanket authentication checks with checks for specific
claims (like a “User” role or some permission).
&lt;/p&gt;
&lt;p&gt;
HTH
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=089d0149-1bae-4bd9-9438-dbbced7c6415" /&gt;</description>
      <category>IdentityModel</category>
      <category>ASP.NET</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=1b0bbbaf-a8b7-4dd0-a6d0-d9c5788f94b9</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=1b0bbbaf-a8b7-4dd0-a6d0-d9c5788f94b9</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <title>Establishing Trust with the .NET Access Control Service (Geneva Beta 2)</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=1b0bbbaf-a8b7-4dd0-a6d0-d9c5788f94b9</guid>
      <link>http://www.leastprivilege.com/EstablishingTrustWithTheNETAccessControlServiceGenevaBeta2.aspx</link>
      <pubDate>Fri, 15 May 2009 05:59:42 GMT</pubDate>
      <description>&lt;p&gt;
In Geneva you use a &lt;em&gt;IssuerNameRegistry&lt;/em&gt; to establish trust with token issuers.
The job of the registry is to parse the issuer details and return a well-known string
identifying that issuer. If the registry cannot determine that well known string,
the issuer is considered non-trusted and request processing is stopped.
&lt;/p&gt;
&lt;p&gt;
Typically it is enough to inspect the X509 certificate that was used to issue the
SAML token, but with the Access Control Service the situation is a little different.
The ACS uses a multi-tenant model and signs all outgoing tokens with the same certificate.
This means it is not sufficient to check the signature only to determine that the
token was issued by a specific instance of the ACS.
&lt;/p&gt;
&lt;p&gt;
In addition you also have to check the value of the SAML issuer URI which contains
the logical issuer name which in turn contains the ACS solution name. Prior to Geneva
Beta 2 you had to use two different extensibility points to do both checks. I wrote
about that &lt;a href="http://www.leastprivilege.com/UsingTheNETAccessControlServiceWithGeneva.aspx"&gt;here&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
Starting with Beta 2, the issuer name registry now has the capability to parse both
the physical and logical issuer. Great!
&lt;/p&gt;
&lt;p&gt;
Find a sample implementation below:
&lt;/p&gt;
&lt;p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;
&lt;span style="font-family: consolas; color: blue; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;class&lt;/span&gt;&lt;span style="font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt; &lt;span style="color: #2b91af"&gt;AccessControlServiceIssuerNameRegistry&lt;/span&gt; : &lt;span style="color: #2b91af"&gt;IssuerNameRegistry&lt;br&gt;
&lt;/span&gt;{&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;string&lt;/span&gt; _solutionName
= &lt;span style="color: #a31515"&gt;"leastprivilege"&lt;/span&gt;;&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;string&lt;/span&gt; _acsThumbprint
= &lt;span style="color: #a31515"&gt;"6de1689a739d548a5690dbc3894b953ef6123d93"&lt;/span&gt;;&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;string&lt;/span&gt; _samlIssuer;&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;public&lt;/span&gt; AccessControlServiceIssuerNameRegistry()&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;_samlIssuer
= &lt;span style="color: #2b91af"&gt;String&lt;/span&gt;.Format(&lt;span style="color: #a31515"&gt;"http://{0}.accesscontrol.windows.net/"&lt;/span&gt;, 
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;_solutionName);&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;override&lt;/span&gt; &lt;span style="color: blue"&gt;string&lt;/span&gt; GetIssuerName(&lt;span style="color: #2b91af"&gt;SecurityToken&lt;/span&gt; securityToken)&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green"&gt;//
should never get called&lt;/span&gt;&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;throw&lt;/span&gt; &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;NotImplementedException&lt;/span&gt;();&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;override&lt;/span&gt; &lt;span style="color: blue"&gt;string&lt;/span&gt; GetIssuerName(&lt;span style="color: #2b91af"&gt;SecurityToken&lt;/span&gt; securityToken, &lt;span style="color: blue"&gt;string&lt;/span&gt; requestedIssuerName)&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;var&lt;/span&gt; issuerToken
= securityToken &lt;span style="color: blue"&gt;as&lt;/span&gt; &lt;span style="color: #2b91af"&gt;X509SecurityToken&lt;/span&gt;;&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;if&lt;/span&gt; (issuerToken
== &lt;span style="color: blue"&gt;null&lt;/span&gt;)&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;throw&lt;/span&gt; &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;ArgumentException&lt;/span&gt;(&lt;span style="color: #a31515"&gt;"securityToken"&lt;/span&gt;);&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;if&lt;/span&gt; (&lt;span style="color: blue"&gt;string&lt;/span&gt;.IsNullOrEmpty(requestedIssuerName))&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;throw&lt;/span&gt; &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;ArgumentNullException&lt;/span&gt;(&lt;span style="color: #a31515"&gt;"requestedIssuerName"&lt;/span&gt;);&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;if&lt;/span&gt; (!&lt;span style="color: blue"&gt;string&lt;/span&gt;.Equals(_acsThumbprint,
issuerToken.Certificate.Thumbprint, &lt;span style="color: #2b91af"&gt;StringComparison&lt;/span&gt;.OrdinalIgnoreCase))&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;throw&lt;/span&gt; &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;SecurityTokenException&lt;/span&gt;(&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #a31515"&gt;"Token
not issued by the Access Control Service"&lt;/span&gt;);&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;if&lt;/span&gt; (!&lt;span style="color: blue"&gt;string&lt;/span&gt;.Equals(_samlIssuer,
requestedIssuerName, &lt;span style="color: #2b91af"&gt;StringComparison&lt;/span&gt;.OrdinalIgnoreCase))&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;throw&lt;/span&gt; &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;SecurityTokenException&lt;/span&gt;(&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #a31515"&gt;"Token
not issued by the requested instance of the Access Control Service"&lt;/span&gt;);&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;return&lt;/span&gt; _samlIssuer;&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;}&lt;span style="color: #2b91af"&gt;&lt;?xml:namespace prefix = o /&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=1b0bbbaf-a8b7-4dd0-a6d0-d9c5788f94b9" /&gt;</description>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=a4780d0d-5176-4639-b222-e1711008fcdd</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=a4780d0d-5176-4639-b222-e1711008fcdd</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Mehr Infos <a href="http://www.informationcard.de/"><font color="#669966">hier</font></a>…
</p>
        <p>
 
</p>
        <p>
          <img border="0" src="http://www.leastprivilege.com/content/binary/BannerLogos5.jpg" />
        </p>
        <p>
 
</p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=a4780d0d-5176-4639-b222-e1711008fcdd" />
      </body>
      <title>Die Information Card Foundation DACH-Initiative</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=a4780d0d-5176-4639-b222-e1711008fcdd</guid>
      <link>http://www.leastprivilege.com/DieInformationCardFoundationDACHInitiative.aspx</link>
      <pubDate>Mon, 11 May 2009 14:21:01 GMT</pubDate>
      <description>&lt;p&gt;
Mehr Infos &lt;a href="http://www.informationcard.de/"&gt;&lt;font color=#669966&gt;hier&lt;/font&gt;&lt;/a&gt;…
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&lt;img border=0 src="http://www.leastprivilege.com/content/binary/BannerLogos5.jpg"&gt;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=a4780d0d-5176-4639-b222-e1711008fcdd" /&gt;</description>
      <category>IdentityModel</category>
      <category>Misc</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=978433fa-94a5-4e60-b162-6bd3e0d894c9</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=978433fa-94a5-4e60-b162-6bd3e0d894c9</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I usually don’t listen to podcasts. But I must admit that <a href="http://www.sodthis.com/podcast/">Sod
This!</a> is quite entertaining. Oliver along with his buddy Gary do a nice mixture
of geek-ish talk, interviews and just plain nonsense. Very recommended!
</p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=978433fa-94a5-4e60-b162-6bd3e0d894c9" />
      </body>
      <title>Sod This!</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=978433fa-94a5-4e60-b162-6bd3e0d894c9</guid>
      <link>http://www.leastprivilege.com/SodThis.aspx</link>
      <pubDate>Thu, 16 Apr 2009 20:10:05 GMT</pubDate>
      <description>&lt;p&gt;
I usually don’t listen to podcasts. But I must admit that &lt;a href="http://www.sodthis.com/podcast/"&gt;Sod
This!&lt;/a&gt; is quite entertaining. Oliver along with his buddy Gary do a nice mixture
of geek-ish talk, interviews and just plain nonsense. Very recommended!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=978433fa-94a5-4e60-b162-6bd3e0d894c9" /&gt;</description>
      <category>Misc</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=0282efdc-2872-43ef-9e87-ffe78e5dec21</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=0282efdc-2872-43ef-9e87-ffe78e5dec21</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I while ago I <a href="http://www.leastprivilege.com/TokenKidnappingRevisited.aspx">wrote</a> about
the “Token Kidnapping” vulnerability in Windows. By looking at the slides and POC
it becomes clear that there is no easy fix for that. 
</p>
        <p>
According to Microsoft, the problem is fixed now – and indeed – it seemed to be a
huge effort:
</p>
        <blockquote>
          <p>
“Addressing this issue required one of the most epic engineering efforts we have ever
expended for a Microsoft security update. This security update changed parts of the
Windows kernel; the COM, DCOM, and LSASS subsystems; the WMI and MSDTC built-in services;
and the service control manager (SCM).”
</p>
        </blockquote>
        <p>
The details are described <a href="http://blogs.technet.com/srd/archive/2009/04/14/ms09-012-fixing-token-kidnapping.aspx">here</a>.
Thanks for the information, MSRC!
</p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=0282efdc-2872-43ef-9e87-ffe78e5dec21" />
      </body>
      <title>Fixing Token Kidnapping</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=0282efdc-2872-43ef-9e87-ffe78e5dec21</guid>
      <link>http://www.leastprivilege.com/FixingTokenKidnapping.aspx</link>
      <pubDate>Wed, 15 Apr 2009 08:13:37 GMT</pubDate>
      <description>&lt;p&gt;
I while ago I &lt;a href="http://www.leastprivilege.com/TokenKidnappingRevisited.aspx"&gt;wrote&lt;/a&gt; about
the “Token Kidnapping” vulnerability in Windows. By looking at the slides and POC
it becomes clear that there is no easy fix for that. 
&lt;/p&gt;
&lt;p&gt;
According to Microsoft, the problem is fixed now – and indeed – it seemed to be a
huge effort:
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
“Addressing this issue required one of the most epic engineering efforts we have ever
expended for a Microsoft security update. This security update changed parts of the
Windows kernel; the COM, DCOM, and LSASS subsystems; the WMI and MSDTC built-in services;
and the service control manager (SCM).”
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
The details are described &lt;a href="http://blogs.technet.com/srd/archive/2009/04/14/ms09-012-fixing-token-kidnapping.aspx"&gt;here&lt;/a&gt;.
Thanks for the information, MSRC!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=0282efdc-2872-43ef-9e87-ffe78e5dec21" /&gt;</description>
      <category>Misc</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=f530fa7d-9f26-4402-97c9-b61d9858a944</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=f530fa7d-9f26-4402-97c9-b61d9858a944</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Sind Sie auch müde, ständig von „Krise“ und „Einschränkungen“ zu lesen? Sind Sie nicht
jemand, der sich immer weiter entwickeln möchte und fit für die heutigen Problemstellungen
aber auch vorbereitet für zukünftige Herausforderungen sein möchte? Wir haben da was
für Sie… 
</p>
        <p>
          <br />
Gemeinsam mit Referenten und Experten <a href="http://www.thinktecture.com">thinktecture</a> präsentiert <a href="http://www.develop.com/uk">DevelopMentor</a> fünf
Tage voller Power, geballtem Wissen und praktischer Umsetzung mit dem „<strong>Service-Orientierung
heute und morgen“</strong>-Kurs.
</p>
        <p>
          <br />
          <a href="http://www.thinktecture.com/staff/dominick">Dominick Baier</a> und <a href="http://www.thinktecture.com/staff/christian">Christian
Weyer</a> zeigen Ihnen in gewohnt praxisorientierter Art und Weise sowohl Grundlagen
und Konzepte als auch deren konkrete und pragmatische Umsetzung, alles basierend auf
jahrelanger Projekterfahrung.<br />
Erleben Sie wie Sie Service-Orientierung heute und morgen - gemischt mit dem zukunftsweisenden
Themenkomplex Cloud Computing - auf Basis der Windows- und .NET –Plattform lokal und
in der Cloud realisieren können. In Hands-on-Labs können Sie selbst die Ärmel hochkrempeln
und gleich das Gelernte in Form von Code in Tatsachen umsetzen.
</p>
        <p>
          <br />
        </p>
        <p>
Nach diesen fünf Tagen werden Sie basierend auf diesen Themenbereichen die ersten
Schritte in der Welt von Service-Orientierung alleine gehen können und vor allem vorbereitet
sein für kommende Projektaufgaben:
</p>
        <ul>
          <li>
Service-Orientierung 
</li>
          <li>
Cloud &amp; Cloud Computing 
</li>
          <li>
Identitäts-Management &amp; Claims-basierte Identität 
</li>
          <li>
Windows Communication Foundation (WCF) 
</li>
          <li>
Windows Workflow Foundation (WF) 
</li>
          <li>
Azure Services Plattform (mit Windows Azure und .NET Services)</li>
        </ul>
        <p>
Die folgende Auflistung gibt Ihnen einen detaillierteren Überblick über die behandelten
Themen:
</p>
        <h4>
          <strong>Tag 1</strong>
        </h4>
        <ul>
          <li>
Service-Orientierung 
</li>
          <li>
WCF-Architektur 
</li>
          <li>
Design-by-Contract</li>
        </ul>
        <h4>
          <strong>Tag 2</strong>
        </h4>
        <ul>
          <li>
WCF Instances, Concurrency &amp; Session Management 
</li>
          <li>
WCF Security 
</li>
          <li>
WCF Hosting</li>
        </ul>
        <h4>
          <strong>Tag 3</strong>
        </h4>
        <ul>
          <li>
WF Workflow Services 
</li>
          <li>
WCF REST 
</li>
          <li>
Azure-Services-Architektur</li>
        </ul>
        <h4>
          <strong>Tag 4</strong>
        </h4>
        <ul>
          <li>
Windows Azure Development &amp; Deployment 
</li>
          <li>
Windows Azure Storage 
</li>
          <li>
Identitäts-Management</li>
        </ul>
        <h4>
          <strong>Tag 5</strong>
        </h4>
        <ul>
          <li>
.NET Services Access Control Service 
</li>
          <li>
.NET Services Service Bus 
</li>
          <li>
NET Services Workflow Service</li>
        </ul>
        <p>
Und hier noch die notwendigen Informationen für Ihre Planung: 
</p>
        <p>
          <b>Wann?</b> 6.-10. Juli 2009<br /><b>Wo?</b><a href="http://www.haeckers-kurhotel.com/bad-ems/de/index.htm">Häckers
Kurhotel</a>, Bad Ems 
<br /><b>Wieviel?</b> 3200,- € (inkl. Übernachtungen, Frühstück, Mittagessen und Abendessen) 
</p>
        <p>
          <em>
            <font size="1">Durchführender Veranstalter ist DevelopMentor.</font>
          </em>
        </p>
        <p>
  
</p>
        <p>
Für Fragen, Wünsche oder Buchungsanfragen kontaktieren Sie bitte <a href="mailto:office@thinktecture.com?subject=Anfrage:%20Service-Orientierung%20heute%20und%20morgen">thinktecture</a> oder <a href="mailto:salesuk@develop.com?subject=Anfrage:%20Service-Orientierung%20heute%20und%20morgen">DevelopMentor</a>. 
</p>
        <p>
Vielen Dank. <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=f530fa7d-9f26-4402-97c9-b61d9858a944" /></p>
      </body>
      <title>Krise? Nein! &amp;bdquo;Service-Orientierung heute und morgen&amp;ldquo;: 5 Tage volle Power und praktisches Wissen</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=f530fa7d-9f26-4402-97c9-b61d9858a944</guid>
      <link>http://www.leastprivilege.com/KriseNeinBdquoServiceOrientierungHeuteUndMorgenldquo5TageVollePowerUndPraktischesWissen.aspx</link>
      <pubDate>Tue, 07 Apr 2009 12:02:31 GMT</pubDate>
      <description>&lt;p&gt;
Sind Sie auch müde, ständig von „Krise“ und „Einschränkungen“ zu lesen? Sind Sie nicht
jemand, der sich immer weiter entwickeln möchte und fit für die heutigen Problemstellungen
aber auch vorbereitet für zukünftige Herausforderungen sein möchte? Wir haben da was
für Sie… 
&lt;p&gt;
&lt;br&gt;
Gemeinsam mit Referenten und Experten &lt;a href="http://www.thinktecture.com"&gt;thinktecture&lt;/a&gt; präsentiert &lt;a href="http://www.develop.com/uk"&gt;DevelopMentor&lt;/a&gt; fünf
Tage voller Power, geballtem Wissen und praktischer Umsetzung mit dem „&lt;strong&gt;Service-Orientierung
heute und morgen“&lt;/strong&gt;-Kurs.
&lt;/p&gt;
&lt;p&gt;
&lt;br&gt;
&lt;a href="http://www.thinktecture.com/staff/dominick"&gt;Dominick Baier&lt;/a&gt; und &lt;a href="http://www.thinktecture.com/staff/christian"&gt;Christian
Weyer&lt;/a&gt; zeigen Ihnen in gewohnt praxisorientierter Art und Weise sowohl Grundlagen
und Konzepte als auch deren konkrete und pragmatische Umsetzung, alles basierend auf
jahrelanger Projekterfahrung.&lt;br&gt;
Erleben Sie wie Sie Service-Orientierung heute und morgen - gemischt mit dem zukunftsweisenden
Themenkomplex Cloud Computing - auf Basis der Windows- und .NET –Plattform lokal und
in der Cloud realisieren können. In Hands-on-Labs können Sie selbst die Ärmel hochkrempeln
und gleich das Gelernte in Form von Code in Tatsachen umsetzen.
&lt;/p&gt;
&lt;p&gt;
&lt;br&gt;
&lt;/p&gt;
&lt;p&gt;
Nach diesen fünf Tagen werden Sie basierend auf diesen Themenbereichen die ersten
Schritte in der Welt von Service-Orientierung alleine gehen können und vor allem vorbereitet
sein für kommende Projektaufgaben:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Service-Orientierung 
&lt;li&gt;
Cloud &amp;amp; Cloud Computing 
&lt;li&gt;
Identitäts-Management &amp;amp; Claims-basierte Identität 
&lt;li&gt;
Windows Communication Foundation (WCF) 
&lt;li&gt;
Windows Workflow Foundation (WF) 
&lt;li&gt;
Azure Services Plattform (mit Windows Azure und .NET Services)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Die folgende Auflistung gibt Ihnen einen detaillierteren Überblick über die behandelten
Themen:
&lt;/p&gt;
&lt;h4&gt;&lt;strong&gt;Tag 1&lt;/strong&gt;
&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;
Service-Orientierung 
&lt;li&gt;
WCF-Architektur 
&lt;li&gt;
Design-by-Contract&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;&lt;strong&gt;Tag 2&lt;/strong&gt;
&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;
WCF Instances, Concurrency &amp;amp; Session Management 
&lt;li&gt;
WCF Security 
&lt;li&gt;
WCF Hosting&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;&lt;strong&gt;Tag 3&lt;/strong&gt;
&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;
WF Workflow Services 
&lt;li&gt;
WCF REST 
&lt;li&gt;
Azure-Services-Architektur&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;&lt;strong&gt;Tag 4&lt;/strong&gt;
&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;
Windows Azure Development &amp;amp; Deployment 
&lt;li&gt;
Windows Azure Storage 
&lt;li&gt;
Identitäts-Management&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;&lt;strong&gt;Tag 5&lt;/strong&gt;
&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;
.NET Services Access Control Service 
&lt;li&gt;
.NET Services Service Bus 
&lt;li&gt;
NET Services Workflow Service&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Und hier noch die notwendigen Informationen für Ihre Planung: 
&lt;p&gt;
&lt;b&gt;Wann?&lt;/b&gt; 6.-10. Juli 2009&lt;br&gt;
&lt;b&gt;Wo?&lt;/b&gt; &lt;a href="http://www.haeckers-kurhotel.com/bad-ems/de/index.htm"&gt;Häckers
Kurhotel&lt;/a&gt;, Bad Ems 
&lt;br&gt;
&lt;b&gt;Wieviel?&lt;/b&gt; 3200,- € (inkl. Übernachtungen, Frühstück, Mittagessen und Abendessen) 
&lt;p&gt;
&lt;em&gt;&lt;font size="1"&gt;Durchführender Veranstalter ist DevelopMentor.&lt;/font&gt;&lt;/em&gt; 
&lt;p&gt;
&amp;nbsp; 
&lt;p&gt;
Für Fragen, Wünsche oder Buchungsanfragen kontaktieren Sie bitte &lt;a href="mailto:office@thinktecture.com?subject=Anfrage:%20Service-Orientierung%20heute%20und%20morgen"&gt;thinktecture&lt;/a&gt; oder &lt;a href="mailto:salesuk@develop.com?subject=Anfrage:%20Service-Orientierung%20heute%20und%20morgen"&gt;DevelopMentor&lt;/a&gt;. 
&lt;p&gt;
Vielen Dank. &lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=f530fa7d-9f26-4402-97c9-b61d9858a944" /&gt;</description>
      <category>ASP.NET</category>
      <category>WCF</category>
      <category>Work in Progress</category>
      <category>IdentityModel</category>
      <category>Conferences</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=861f1c92-d413-4347-836d-d60c6d9583fc</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=861f1c92-d413-4347-836d-d60c6d9583fc</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <a href="http://support.microsoft.com/?scid=kb;en-us;969419&amp;x=15&amp;y=7">This</a> article
provides useful information on generating interoperable PPIDs.
</p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=861f1c92-d413-4347-836d-d60c6d9583fc" />
      </body>
      <title>PPID Information and Generation Examples</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=861f1c92-d413-4347-836d-d60c6d9583fc</guid>
      <link>http://www.leastprivilege.com/PPIDInformationAndGenerationExamples.aspx</link>
      <pubDate>Fri, 03 Apr 2009 06:52:54 GMT</pubDate>
      <description>&lt;p&gt;
&lt;a href="http://support.microsoft.com/?scid=kb;en-us;969419&amp;amp;x=15&amp;amp;y=7"&gt;This&lt;/a&gt; article
provides useful information on generating interoperable PPIDs.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=861f1c92-d413-4347-836d-d60c6d9583fc" /&gt;</description>
      <category>IdentityModel</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=edad167e-712b-4752-9043-e808948ffb4b</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=edad167e-712b-4752-9043-e808948ffb4b</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <title>Custom Principals in WCF with Geneva</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=edad167e-712b-4752-9043-e808948ffb4b</guid>
      <link>http://www.leastprivilege.com/CustomPrincipalsInWCFWithGeneva.aspx</link>
      <pubDate>Thu, 02 Apr 2009 09:01:34 GMT</pubDate>
      <description>&lt;p&gt;
WCF has an extensibility point to set your own IPrincipal implementation on Thread.CurrentPrincipal
(I wrote about that &lt;a href="http://www.leastprivilege.com/CustomPrincipalsAndWCF.aspx"&gt;here&lt;/a&gt;).
Geneva uses this mechanism to set its IClaimsPrincipal (wrote about that &lt;a href="http://www.leastprivilege.com/GenevaIntegrationIntoWCF.aspx"&gt;here&lt;/a&gt;).
&lt;/p&gt;
&lt;p&gt;
Since the standard “slot” for custom principals is already used by Geneva, it was
unclear to me how to set your own IPrincipal &lt;em&gt;after&lt;/em&gt; Geneva has done its work.
With a little help from the Geneva team (thanks Jan) – I found a way that works.
&lt;/p&gt;
&lt;p&gt;
You can replace the principal in a service authorization manager via the &lt;em&gt;Properties&lt;/em&gt; collection
on the authorization context. Voodoo.
&lt;/p&gt;
&lt;p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;
&lt;span style="font-family: consolas; color: blue; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;class&lt;/span&gt;&lt;span style="font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt; &lt;span style="color: #2b91af"&gt;AuthorizationManager&lt;/span&gt; : &lt;span style="color: #2b91af"&gt;IdentityModelServiceAuthorizationManager&lt;br&gt;
&lt;/span&gt;{&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;override&lt;/span&gt; &lt;span style="color: blue"&gt;bool&lt;/span&gt; CheckAccess(&lt;span style="color: #2b91af"&gt;OperationContext&lt;/span&gt; operationContext, &lt;span style="color: blue"&gt;ref&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Message&lt;/span&gt; message)&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;base&lt;/span&gt;.CheckAccess(operationContext, &lt;span style="color: blue"&gt;ref&lt;/span&gt; message);&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green"&gt;//
action header to get to the request operation&lt;/span&gt;&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;string&lt;/span&gt; action
= operationContext.IncomingMessageHeaders.Action;&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green"&gt;//
properties collection holds the principal that goes on Thread.CurrentPrincipal&lt;/span&gt;&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;var&lt;/span&gt; properties
= operationContext&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;.ServiceSecurityContext&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;.AuthorizationContext&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;.Properties;&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green"&gt;//
retrieve current principal&lt;/span&gt;&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;IClaimsPrincipal&lt;/span&gt; principal
= properties[&lt;span style="color: #a31515"&gt;"Principal"&lt;/span&gt;] &lt;span style="color: blue"&gt;as&lt;/span&gt; &lt;span style="color: #2b91af"&gt;IClaimsPrincipal&lt;/span&gt;;&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green"&gt;//
create custom principal&lt;/span&gt;&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;var&lt;/span&gt; customPrincipal
= &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;CustomClaimsPrincipal&lt;/span&gt;(principal, &lt;span style="color: #a31515"&gt;"some
value"&lt;/span&gt;);&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green"&gt;//
set the custom principal&lt;/span&gt;&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;properties[&lt;span style="color: #a31515"&gt;"Principal"&lt;/span&gt;]
= customPrincipal;&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;return&lt;/span&gt; Authorize(action,
customPrincipal);&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;private&lt;/span&gt; &lt;span style="color: blue"&gt;bool&lt;/span&gt; Authorize(&lt;span style="color: blue"&gt;string&lt;/span&gt; action, &lt;span style="color: #2b91af"&gt;CustomClaimsPrincipal&lt;/span&gt; principal)&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green"&gt;//
do whatever authZ logic you have&lt;/span&gt;&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;return&lt;/span&gt; &lt;span style="color: blue"&gt;true&lt;/span&gt;;&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;}&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af"&gt;CustomClaimsPrincipal&lt;/span&gt; : &lt;span style="color: #2b91af"&gt;ClaimsPrincipal&lt;br&gt;
&lt;/span&gt;{&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;public&lt;/span&gt; CustomClaimsPrincipal(&lt;span style="color: #2b91af"&gt;IClaimsPrincipal&lt;/span&gt; principal, &lt;span style="color: blue"&gt;string&lt;/span&gt; customValue) 
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;: &lt;span style="color: blue"&gt;base&lt;/span&gt;(principal)&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;CustomPropery
= customValue;&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;string&lt;/span&gt; CustomPropery
{ &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;; }&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;}&lt;span style="color: #2b91af"&gt;&lt;?xml:namespace prefix = o /&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
Afterwards register this class in the &lt;em&gt;ServiceAuthorizationBehavior&lt;/em&gt;.
&lt;/p&gt;
&lt;p&gt;
Be aware that this gets called on every request – so don’t put expensive operations
in the custom principal creation code.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=edad167e-712b-4752-9043-e808948ffb4b" /&gt;</description>
      <category>IdentityModel</category>
      <category>WCF</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=3f10e7af-5187-41d9-b92b-d752ee49f09b</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=3f10e7af-5187-41d9-b92b-d752ee49f09b</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I recently <a href="http://www.leastprivilege.com/UsingSAMLAsAClientCredentialTypeInWCFWithGeneva.aspx">wrote</a> about
generating SAML tokens at the client. Justin showed a similar approach at Mix to interact
with the Access Control Service.
</p>
        <ul>
          <li>
Mix <a href="http://videos.visitmix.com/MIX09/T02F">recording</a></li>
          <li>
Blog <a href="http://blogs.msdn.com/justinjsmith/archive/2009/03/24/tokenclient-mix-introduction.aspx">post</a></li>
        </ul>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=3f10e7af-5187-41d9-b92b-d752ee49f09b" />
      </body>
      <title>Client Generated SAML Tokens to Interact with the Access Control Service</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=3f10e7af-5187-41d9-b92b-d752ee49f09b</guid>
      <link>http://www.leastprivilege.com/ClientGeneratedSAMLTokensToInteractWithTheAccessControlService.aspx</link>
      <pubDate>Sun, 29 Mar 2009 05:34:35 GMT</pubDate>
      <description>&lt;p&gt;
I recently &lt;a href="http://www.leastprivilege.com/UsingSAMLAsAClientCredentialTypeInWCFWithGeneva.aspx"&gt;wrote&lt;/a&gt; about
generating SAML tokens at the client. Justin showed a similar approach at Mix to interact
with the Access Control Service.
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Mix &lt;a href="http://videos.visitmix.com/MIX09/T02F"&gt;recording&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
Blog &lt;a href="http://blogs.msdn.com/justinjsmith/archive/2009/03/24/tokenclient-mix-introduction.aspx"&gt;post&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=3f10e7af-5187-41d9-b92b-d752ee49f09b" /&gt;</description>
      <category>IdentityModel</category>
      <category>WCF</category>
      <category>ASP.NET</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=81e908dd-fb5e-4b0b-bb38-d2bab3a1e989</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=81e908dd-fb5e-4b0b-bb38-d2bab3a1e989</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Nice claim for a conference ;)
</p>
        <p>
I am happy to join my former colleagues from <a href="http://www.ernw.de">ERNW</a> for
their yearly Troopers conference in Munich.
</p>
        <p>
Two days full of top notch security talks – should be big fun. I’ll add my 2c about
the .NET Access Control Service (Microsoft’s R-STS in the cloud) to the mix.
</p>
        <p>
          <a title="http://www.troopers09.org" href="http://www.troopers09.org">http://www.troopers09.org</a>
        </p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=81e908dd-fb5e-4b0b-bb38-d2bab3a1e989" />
      </body>
      <title>Get Skilled or get 0wned</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=81e908dd-fb5e-4b0b-bb38-d2bab3a1e989</guid>
      <link>http://www.leastprivilege.com/GetSkilledOrGet0wned.aspx</link>
      <pubDate>Tue, 17 Mar 2009 08:01:56 GMT</pubDate>
      <description>&lt;p&gt;
Nice claim for a conference ;)
&lt;/p&gt;
&lt;p&gt;
I am happy to join my former colleagues from &lt;a href="http://www.ernw.de"&gt;ERNW&lt;/a&gt; for
their yearly Troopers conference in Munich.
&lt;/p&gt;
&lt;p&gt;
Two days full of top notch security talks – should be big fun. I’ll add my 2c about
the .NET Access Control Service (Microsoft’s R-STS in the cloud) to the mix.
&lt;/p&gt;
&lt;p&gt;
&lt;a title="http://www.troopers09.org" href="http://www.troopers09.org"&gt;http://www.troopers09.org&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=81e908dd-fb5e-4b0b-bb38-d2bab3a1e989" /&gt;</description>
      <category>Conferences</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=60a62077-dcd4-4e22-b8a2-4a2f53a9bd85</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=60a62077-dcd4-4e22-b8a2-4a2f53a9bd85</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Geneva is integrated in ASP.NET/IIS using the standard <em>IHttpModule</em> extensibility
mechanism. Geneva ships with three HTTP modules:
</p>
        <ul>
          <li>
            <em>ClaimsPrincipalHttpModule </em>(already wrote about it <a href="http://www.leastprivilege.com/GenevaHTTPModulesClaimsPrincipalHttpModule.aspx">here</a>). 
</li>
          <li>
            <em>WSFederationAuthenticationModule </em>(implements WS-Federation authentication) 
</li>
          <li>
            <em>SessionAuthenticationModule </em>(implements session authentication)</li>
        </ul>
        <p>
          <em>ClaimsPrincipalHttpModule</em> is special – but the other two are built upon a
framework for handling token based authentication in ASP.NET. To integrate into this
framework, one has to derive from a base class called <em>FederatedAuthenticationModuleBase</em>.
This implements the <em>IHttpModule </em>interface, subscribes to the <em>AuthenticateRequest</em> and <em>EndRequest </em>pipeline
events and provides some helper methods. This base class drives the core logic of
how a typical redirection and token based authentication works. For the protocol specific
details, the derived class has to implement a bunch of abstract methods. This is how
WS-Federation is implemented – other protocols could be realized in a similar fashion.
</p>
        <p>
The core logic is as follows:
</p>
        <p>
          <strong>AuthenticateRequest</strong>
        </p>
        <ul>
          <li>
check if federated authentication is enabled 
</li>
          <li>
check if current request is a sign in request (abstract <em>CanReadSignInRequest</em>) 
</li>
          <li>
extract security token from request (abstract <em>GetSecurityToken</em>) 
<ul><li>
raise <em>SecurityTokenReceived </em>event</li></ul></li>
          <li>
create <em>IClaimsPrincipal </em>from security token 
<ul><li>
raise <em><u>SecurityTokenValidated</u></em> event</li></ul></li>
          <li>
set principal 
</li>
          <li>
create session security token 
</li>
          <li>
set session security token using the configured cookie handler 
<ul><li>
raise <em>SessionSecurityTokenCreated</em> event</li></ul></li>
          <li>
raise <em>SignedIn </em>event 
</li>
          <li>
check for a return URL (abstract <em>GetReturnUrlFromResponse</em>) 
<ul><li>
do the redirect</li></ul></li>
        </ul>
        <p>
          <strong>EndRequest</strong>
        </p>
        <ul>
          <li>
check if federated authentication is enabled 
</li>
          <li>
if a 401 response is found, redirect to identity provider (abstract <em>RedirectToIdentityProvider</em>)</li>
        </ul>
        <p>
Now let’s have a close look what the two derived module do.
</p>
        <p>
          <strong>WSFederationAuthenticationModule<br /></strong>As stated earlier, this module deals with WS-Federation redirects and token
parsing.
</p>
        <ul>
          <li>
            <strong>CanReadSigninRequest</strong>
            <br />
checks for the WS-Federation messages (wsignin1.0 / wsignoutcleanup1.0) 
</li>
          <li>
            <strong>GetSecurityToken</strong>
            <br />
extracts the token from the STS response and uses the security token handler infrastructure
to create a <em>SecurityToken</em></li>
          <li>
            <strong>GetReturnUrlFromResponse</strong>
            <br />
parses the WS-Fed context field for a return URL- 
</li>
          <li>
            <strong>RedirectToIdentityProvider</strong>
            <br />
creates a <em>SignInRequest</em> message and redirects to the configured identity
provider.</li>
        </ul>
        <p>
 
</p>
        <p>
          <strong>SessionAuthenticationModule</strong>
          <br />
After the module implementing the authentication protocol has done its job, the base
class creates a session token. This session token contains the original token issued
from the STS (the bootstrap token) as well as a serialized version of the <em>IClaimsPrincipal </em>(after
transformation via the <em>ClaimsAuthenticationManager</em>). This session token gets
persisted by a cookie handler (typically into a HTTP cookie). The session authentication
module uses this cookie to re-create the <em>IClaimsPrincipal</em> on each request.
</p>
        <p>
Since the session token characteristics are a bit specific, the module builds upon
the base framework and helper methods, but short-circuits the logic by overriding <em>AuthenticateCore</em> directly.
This is what happens:
</p>
        <ul>
          <li>
check if cookie is present (using the configured cookie handler) 
</li>
          <li>
recreate the <em>SessionSecurityToken</em> from the cookie (using the session security
token handler) 
</li>
          <li>
raise <em>SessionSecurityTokenReceived</em> event 
</li>
          <li>
based on the outcome of the event either renew the cookie and/or set the principal 
</li>
          <li>
raise <em>SignedIn </em>event</li>
        </ul>
        <p>
HTH
</p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=60a62077-dcd4-4e22-b8a2-4a2f53a9bd85" />
      </body>
      <title>Geneva integration into ASP.NET</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=60a62077-dcd4-4e22-b8a2-4a2f53a9bd85</guid>
      <link>http://www.leastprivilege.com/GenevaIntegrationIntoASPNET.aspx</link>
      <pubDate>Thu, 12 Mar 2009 21:21:38 GMT</pubDate>
      <description>&lt;p&gt;
Geneva is integrated in ASP.NET/IIS using the standard &lt;em&gt;IHttpModule&lt;/em&gt; extensibility
mechanism. Geneva ships with three HTTP modules:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;ClaimsPrincipalHttpModule &lt;/em&gt;(already wrote about it &lt;a href="http://www.leastprivilege.com/GenevaHTTPModulesClaimsPrincipalHttpModule.aspx"&gt;here&lt;/a&gt;). 
&lt;li&gt;
&lt;em&gt;WSFederationAuthenticationModule &lt;/em&gt;(implements WS-Federation authentication) 
&lt;li&gt;
&lt;em&gt;SessionAuthenticationModule &lt;/em&gt;(implements session authentication)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;em&gt;ClaimsPrincipalHttpModule&lt;/em&gt; is special – but the other two are built upon a
framework for handling token based authentication in ASP.NET. To integrate into this
framework, one has to derive from a base class called &lt;em&gt;FederatedAuthenticationModuleBase&lt;/em&gt;.
This implements the &lt;em&gt;IHttpModule &lt;/em&gt;interface, subscribes to the &lt;em&gt;AuthenticateRequest&lt;/em&gt; and &lt;em&gt;EndRequest &lt;/em&gt;pipeline
events and provides some helper methods. This base class drives the core logic of
how a typical redirection and token based authentication works. For the protocol specific
details, the derived class has to implement a bunch of abstract methods. This is how
WS-Federation is implemented – other protocols could be realized in a similar fashion.
&lt;/p&gt;
&lt;p&gt;
The core logic is as follows:
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;AuthenticateRequest&lt;/strong&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
check if federated authentication is enabled 
&lt;li&gt;
check if current request is a sign in request (abstract &lt;em&gt;CanReadSignInRequest&lt;/em&gt;) 
&lt;li&gt;
extract security token from request (abstract &lt;em&gt;GetSecurityToken&lt;/em&gt;) 
&lt;ul&gt;
&lt;li&gt;
raise &lt;em&gt;SecurityTokenReceived &lt;/em&gt;event&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
create &lt;em&gt;IClaimsPrincipal &lt;/em&gt;from security token 
&lt;ul&gt;
&lt;li&gt;
raise &lt;em&gt;&lt;u&gt;SecurityTokenValidated&lt;/u&gt;&lt;/em&gt; event&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
set principal 
&lt;li&gt;
create session security token 
&lt;li&gt;
set session security token using the configured cookie handler 
&lt;ul&gt;
&lt;li&gt;
raise &lt;em&gt;SessionSecurityTokenCreated&lt;/em&gt; event&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
raise &lt;em&gt;SignedIn &lt;/em&gt;event 
&lt;li&gt;
check for a return URL (abstract &lt;em&gt;GetReturnUrlFromResponse&lt;/em&gt;) 
&lt;ul&gt;
&lt;li&gt;
do the redirect&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;strong&gt;EndRequest&lt;/strong&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
check if federated authentication is enabled 
&lt;li&gt;
if a 401 response is found, redirect to identity provider (abstract &lt;em&gt;RedirectToIdentityProvider&lt;/em&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Now let’s have a close look what the two derived module do.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;WSFederationAuthenticationModule&lt;br&gt;
&lt;/strong&gt;As stated earlier, this module deals with WS-Federation redirects and token
parsing.
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;CanReadSigninRequest&lt;/strong&gt;
&lt;br&gt;
checks for the WS-Federation messages (wsignin1.0 / wsignoutcleanup1.0) 
&lt;li&gt;
&lt;strong&gt;GetSecurityToken&lt;/strong&gt;
&lt;br&gt;
extracts the token from the STS response and uses the security token handler infrastructure
to create a &lt;em&gt;SecurityToken&lt;/em&gt; 
&lt;li&gt;
&lt;strong&gt;GetReturnUrlFromResponse&lt;/strong&gt;
&lt;br&gt;
parses the WS-Fed context field for a return URL- 
&lt;li&gt;
&lt;strong&gt;RedirectToIdentityProvider&lt;/strong&gt;
&lt;br&gt;
creates a &lt;em&gt;SignInRequest&lt;/em&gt; message and redirects to the configured identity
provider.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;SessionAuthenticationModule&lt;/strong&gt;
&lt;br&gt;
After the module implementing the authentication protocol has done its job, the base
class creates a session token. This session token contains the original token issued
from the STS (the bootstrap token) as well as a serialized version of the &lt;em&gt;IClaimsPrincipal &lt;/em&gt;(after
transformation via the &lt;em&gt;ClaimsAuthenticationManager&lt;/em&gt;). This session token gets
persisted by a cookie handler (typically into a HTTP cookie). The session authentication
module uses this cookie to re-create the &lt;em&gt;IClaimsPrincipal&lt;/em&gt; on each request.
&lt;/p&gt;
&lt;p&gt;
Since the session token characteristics are a bit specific, the module builds upon
the base framework and helper methods, but short-circuits the logic by overriding &lt;em&gt;AuthenticateCore&lt;/em&gt; directly.
This is what happens:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
check if cookie is present (using the configured cookie handler) 
&lt;li&gt;
recreate the &lt;em&gt;SessionSecurityToken&lt;/em&gt; from the cookie (using the session security
token handler) 
&lt;li&gt;
raise &lt;em&gt;SessionSecurityTokenReceived&lt;/em&gt; event 
&lt;li&gt;
based on the outcome of the event either renew the cookie and/or set the principal 
&lt;li&gt;
raise &lt;em&gt;SignedIn &lt;/em&gt;event&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
HTH
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=60a62077-dcd4-4e22-b8a2-4a2f53a9bd85" /&gt;</description>
      <category>ASP.NET</category>
      <category>IdentityModel</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=61de281b-d8ca-45f6-9807-eeb45f0bca90</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=61de281b-d8ca-45f6-9807-eeb45f0bca90</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Having done quite a bit of WCF customization myself, it is fun to see how Geneva framework
wires itself up into the WCF runtime.
</p>
        <p>
The high-level goals are as follows:
</p>
        <ul>
          <li>
route the token provisioning, serialization and authentication through the Geneva
pipeline</li>
          <li>
make an <em>IClaimsPrincipal</em> available on the service side</li>
          <li>
allow setting issued tokens directly on a <em>ChannelFactory</em></li>
        </ul>
        <p>
On the service side this is achieved by passing in a <em>ServiceHost</em> instance
into <em>FederatedServiceCredentials.ConfigureHost()</em>. What does exactly happen
inside that call?
</p>
        <ul>
          <li>
replace the standard WCF <em>ServiceCredential</em> with a <em>FederatedServiceCredential</em></li>
          <ul>
            <li>
the service credential drives the creation of a <em>SecurityTokenManager</em> (in
this case the <em>FederatedSecurityTokenManager</em>)</li>
            <li>
this in turn creates the token provider, serializer and authenticator. In Geneva all
three functionalities are inside a <em>SecurityTokenHandler</em>.</li>
            <li>
Geneva’s token manager dispatches the incoming requests to the corresponding methods
of the token handler depending on the incoming token type</li>
          </ul>
          <li>
set the service certificate</li>
          <ul>
            <li>
either by copying the standard service certificate specified in the <em>ServiceCredential</em>.</li>
            <li>
or by replacing the existing one with the certificate specified in the &lt;microsoft.IdentityModel
/&gt; configuration section</li>
          </ul>
          <li>
create token resolvers for</li>
          <ul>
            <li>
the service certificate</li>
            <li>
issuer certificates (if the WCF <em>knownIssuers</em> configuration element is set)</li>
          </ul>
          <li>
set a <em>ClaimsAuthenticationManager</em> (either a pass-through one, or the one
specified in code/config)</li>
          <li>
set the <em>PrincipalPermissionMode</em> to <em>Custom</em>. This is necessary to
populate <em>Thread.CurrentPrincipal</em> with an <em>IClaimsPrincipal</em>.</li>
          <li>
set the service authorization manager. 
</li>
          <ul>
            <li>
service authorization managers drive the creation of authorization policies. 
</li>
            <li>
an authorization policy in turn can parse the WCF internal claims and set <em>Thread.CurrentPrincipal</em>.
Persisting the bootstrap token also happens here. 
</li>
            <li>
to make this all work, Geneva has its own service authorization manager (<em>IdentityModelServiceAuthorizationManager</em>)
and its own authorization policy (<em>Microsoft.IdentityModel.Tokens.AuthorizationPolicy</em>).</li>
          </ul>
        </ul>
        <p>
 
</p>
        <p>
On the client side things are much simpler. The main purpose of the Geneva client
side plumbing is to allow more direct interaction with tokens. The standard WCF issued
token client credential assumes you want to implicitly acquire a token from a WS-Trust
token service.
</p>
        <p>
Token provisioning is driven by so called <em>SecurityTokenParameters</em>. Whereas
the WCF built-in <em>IssuedSecurityTokenParameters</em> only allow specifying the
details of the token issuer, the Geneva <em>FederatedClientCredentialsParameters</em> instead
allows setting a pre-acquired token directly. 
</p>
        <p>
So when you call <em>FederatedClientCredentials.ConfigureChannelFactory&lt;T&gt;</em> all
that is happening is, that the standard WCF <em>ClientCredentials</em> get replaced
by the <em>FederatedClientCredentials</em> class. This creates a <em>FederatedClientCredentialsSecurityTokenManager </em>which
in turn instantiates the token serializer (via the security token handlers) and a
token provider that is aware of <em>FederatedClientCredentialsParameters</em>.
</p>
        <p>
To actually set the token on a channel, you call one of the extension methods for <em>ChannelFactory&lt;T&gt;</em>.
They can be found in <em>Microsoft.IdentityModel.Protocols.WSTrust.ChannelFactoryOperations</em>.
These extension methods take the token you pass in, create the token parameters and
add them to the token parameters collection of the channel.
</p>
        <p>
HTH
</p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=61de281b-d8ca-45f6-9807-eeb45f0bca90" />
      </body>
      <title>Geneva integration into WCF</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=61de281b-d8ca-45f6-9807-eeb45f0bca90</guid>
      <link>http://www.leastprivilege.com/GenevaIntegrationIntoWCF.aspx</link>
      <pubDate>Thu, 12 Mar 2009 09:56:01 GMT</pubDate>
      <description>&lt;p&gt;
Having done quite a bit of WCF customization myself, it is fun to see how Geneva framework
wires itself up into the WCF runtime.
&lt;/p&gt;
&lt;p&gt;
The high-level goals are as follows:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
route the token provisioning, serialization and authentication through the Geneva
pipeline&lt;/li&gt;
&lt;li&gt;
make an &lt;em&gt;IClaimsPrincipal&lt;/em&gt; available on the service side&lt;/li&gt;
&lt;li&gt;
allow setting issued tokens directly on a &lt;em&gt;ChannelFactory&lt;/em&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
On the service side this is achieved by passing in a &lt;em&gt;ServiceHost&lt;/em&gt; instance
into &lt;em&gt;FederatedServiceCredentials.ConfigureHost()&lt;/em&gt;. What does exactly happen
inside that call?
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
replace the standard WCF &lt;em&gt;ServiceCredential&lt;/em&gt; with a &lt;em&gt;FederatedServiceCredential&lt;/em&gt;
&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;
the service credential drives the creation of a &lt;em&gt;SecurityTokenManager&lt;/em&gt; (in
this case the &lt;em&gt;FederatedSecurityTokenManager&lt;/em&gt;)&lt;/li&gt;
&lt;li&gt;
this in turn creates the token provider, serializer and authenticator. In Geneva all
three functionalities are inside a &lt;em&gt;SecurityTokenHandler&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;
Geneva’s token manager dispatches the incoming requests to the corresponding methods
of the token handler depending on the incoming token type&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
set the service certificate&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;
either by copying the standard service certificate specified in the &lt;em&gt;ServiceCredential&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;
or by replacing the existing one with the certificate specified in the &amp;lt;microsoft.IdentityModel
/&amp;gt; configuration section&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
create token resolvers for&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;
the service certificate&lt;/li&gt;
&lt;li&gt;
issuer certificates (if the WCF &lt;em&gt;knownIssuers&lt;/em&gt; configuration element is set)&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
set a &lt;em&gt;ClaimsAuthenticationManager&lt;/em&gt; (either a pass-through one, or the one
specified in code/config)&lt;/li&gt;
&lt;li&gt;
set the &lt;em&gt;PrincipalPermissionMode&lt;/em&gt; to &lt;em&gt;Custom&lt;/em&gt;. This is necessary to
populate &lt;em&gt;Thread.CurrentPrincipal&lt;/em&gt; with an &lt;em&gt;IClaimsPrincipal&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;
set the service authorization manager. 
&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;
service authorization managers drive the creation of authorization policies. 
&lt;/li&gt;
&lt;li&gt;
an authorization policy in turn can parse the WCF internal claims and set &lt;em&gt;Thread.CurrentPrincipal&lt;/em&gt;.
Persisting the bootstrap token also happens here. 
&lt;/li&gt;
&lt;li&gt;
to make this all work, Geneva has its own service authorization manager (&lt;em&gt;IdentityModelServiceAuthorizationManager&lt;/em&gt;)
and its own authorization policy (&lt;em&gt;Microsoft.IdentityModel.Tokens.AuthorizationPolicy&lt;/em&gt;).&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
On the client side things are much simpler. The main purpose of the Geneva client
side plumbing is to allow more direct interaction with tokens. The standard WCF issued
token client credential assumes you want to implicitly acquire a token from a WS-Trust
token service.
&lt;/p&gt;
&lt;p&gt;
Token provisioning is driven by so called &lt;em&gt;SecurityTokenParameters&lt;/em&gt;. Whereas
the WCF built-in &lt;em&gt;IssuedSecurityTokenParameters&lt;/em&gt; only allow specifying the
details of the token issuer, the Geneva &lt;em&gt;FederatedClientCredentialsParameters&lt;/em&gt; instead
allows setting a pre-acquired token directly. 
&lt;/p&gt;
&lt;p&gt;
So when you call &lt;em&gt;FederatedClientCredentials.ConfigureChannelFactory&amp;lt;T&amp;gt;&lt;/em&gt; all
that is happening is, that the standard WCF &lt;em&gt;ClientCredentials&lt;/em&gt; get replaced
by the &lt;em&gt;FederatedClientCredentials&lt;/em&gt; class. This creates a &lt;em&gt;FederatedClientCredentialsSecurityTokenManager &lt;/em&gt;which
in turn instantiates the token serializer (via the security token handlers) and a
token provider that is aware of &lt;em&gt;FederatedClientCredentialsParameters&lt;/em&gt;.
&lt;/p&gt;
&lt;p&gt;
To actually set the token on a channel, you call one of the extension methods for &lt;em&gt;ChannelFactory&amp;lt;T&amp;gt;&lt;/em&gt;.
They can be found in &lt;em&gt;Microsoft.IdentityModel.Protocols.WSTrust.ChannelFactoryOperations&lt;/em&gt;.
These extension methods take the token you pass in, create the token parameters and
add them to the token parameters collection of the channel.
&lt;/p&gt;
&lt;p&gt;
HTH
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=61de281b-d8ca-45f6-9807-eeb45f0bca90" /&gt;</description>
      <category>WCF</category>
      <category>IdentityModel</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=b3dcbcb5-29a2-4e4b-a5f3-38b09e126a0a</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=b3dcbcb5-29a2-4e4b-a5f3-38b09e126a0a</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <title>Using SAML as a Client Credential Type in WCF (with Geneva)</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=b3dcbcb5-29a2-4e4b-a5f3-38b09e126a0a</guid>
      <link>http://www.leastprivilege.com/UsingSAMLAsAClientCredentialTypeInWCFWithGeneva.aspx</link>
      <pubDate>Tue, 10 Mar 2009 06:24:52 GMT</pubDate>
      <description>&lt;p&gt;
&lt;strong&gt;Disclaimer&lt;/strong&gt;
&lt;br&gt;
For the motivation for this article please read &lt;a href="http://www.leastprivilege.com/CustomWCFCredentialTypes.aspx"&gt;this&lt;/a&gt; here
first. I am not advocating the use of client generated SAML tokens in general, and
I also know that there is not much point in the client generating claims for a service.
This whole article is about replacing the UserName token with a SAML token in situations
where you need extensibility points that a UserName tokens cannot give you.
&lt;/p&gt;
&lt;p&gt;
As I said in my previous post, SAML is an extensible and flexible token type - but
not very accessible in plain WCF. Geneva abstracts the creation and consumption of
tokens in so called token handlers. All you need is a description of the token that
you want to generate and then you feed this description into the appropriate token
handler. I wrote an article about the token generation pipeline in Geneva &lt;a href="http://www.leastprivilege.com/SAMLTokenCreationInAGenevaSTS.aspx"&gt;here&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
Even better, Geneva has some client side plumbing for WCF that lets you use the generated
token for service calls in a quite straightforward fashion.
&lt;/p&gt;
&lt;p&gt;
So the simple scenario is this: the client credential consists of three pieces: username,
password and a customer ID (think e.g. of multi-tenant apps). The service receiving
this credential could be a normal WCF service or a STS that issues tokens based on
the client credential. For future extensibility a general version of this would be
a credential with a user name and an unlimited number of properties (e.g. password,
customer ID etc.). In a SAML token this would map to the name identifier and a number
of attributes.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Client&lt;/strong&gt;
&lt;br&gt;
Using Geneva you can generate a SAML token like this:
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: consolas; COLOR: blue; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;public&lt;/span&gt;&lt;span style="FONT-FAMILY: consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt; &lt;span style="COLOR: blue"&gt;static&lt;/span&gt; &lt;span style="COLOR: blue"&gt;class&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;ClientToken&lt;br&gt;
&lt;/span&gt;{&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;private&lt;/span&gt; &lt;span style="COLOR: blue"&gt;const&lt;/span&gt; &lt;span style="COLOR: blue"&gt;string&lt;/span&gt; _claimsUri
= &lt;span style="COLOR: #a31515"&gt;&lt;a href="http://www.leastprivilege.com/claims/"&gt;http://www.leastprivilege.com/claims/&lt;/a&gt;&lt;/span&gt;;&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;public&lt;/span&gt; &lt;span style="COLOR: blue"&gt;static&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;SamlSecurityToken&lt;/span&gt; Create(&lt;span style="COLOR: blue"&gt;string&lt;/span&gt; subjectName, &lt;span style="COLOR: #2b91af"&gt;Dictionary&lt;/span&gt;&amp;lt;&lt;span style="COLOR: blue"&gt;string&lt;/span&gt;, &lt;span style="COLOR: blue"&gt;string&lt;/span&gt;&amp;gt;
properties)&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;{&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;ClaimsIdentity&lt;/span&gt; id
= &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;ClaimsIdentity&lt;/span&gt;(&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;from&lt;/span&gt; item &lt;span style="COLOR: blue"&gt;in&lt;/span&gt; properties&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;select&lt;/span&gt; &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;Claim&lt;/span&gt;(_claimsUri
+ item.Key, item.Value));&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;id.Claims.Add(&lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;Claim&lt;/span&gt;(&lt;span style="COLOR: #2b91af"&gt;WSIdentityConstants&lt;/span&gt;.&lt;span style="COLOR: #2b91af"&gt;ClaimTypes&lt;/span&gt;.NameIdentifier,
subjectName));&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;var&lt;/span&gt; description
= &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;SecurityTokenDescriptor&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Subject
= id,&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;TokenIssuerName
= &lt;span style="COLOR: #a31515"&gt;"http://self"&lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;};&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;var&lt;/span&gt; handler
= &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;Saml11SecurityTokenHandler&lt;/span&gt;(&lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;SamlSecurityTokenRequirement&lt;/span&gt;());&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;return&lt;/span&gt; (&lt;span style="COLOR: #2b91af"&gt;SamlSecurityToken&lt;/span&gt;)handler.CreateToken(description);&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;}&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;}&lt;span style="COLOR: #2b91af"&gt;&lt;?xml:namespace prefix = o /&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
After creating the token you can use the Geneva extension methods for &lt;em&gt;ChannelFactory&amp;lt;T&amp;gt;&lt;/em&gt; to
set the token as a client credential:
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: consolas; COLOR: blue; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;static&lt;/span&gt;&lt;span style="FONT-FAMILY: consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt; &lt;span style="COLOR: blue"&gt;void&lt;/span&gt; Main(&lt;span style="COLOR: blue"&gt;string&lt;/span&gt;[]
args)&lt;br&gt;
{&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;var&lt;/span&gt; props
= &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;Dictionary&lt;/span&gt;&amp;lt;&lt;span style="COLOR: blue"&gt;string&lt;/span&gt;, &lt;span style="COLOR: blue"&gt;string&lt;/span&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;{&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{ &lt;span style="COLOR: #a31515"&gt;"password"&lt;/span&gt;, &lt;span style="COLOR: #a31515"&gt;"secret"&lt;/span&gt; },&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{ &lt;span style="COLOR: #a31515"&gt;"customerId"&lt;/span&gt;, &lt;span style="COLOR: #a31515"&gt;"42"&lt;/span&gt; }&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;};&lt;br&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;var&lt;/span&gt; token
= &lt;span style="COLOR: #2b91af"&gt;ClientToken&lt;/span&gt;.Create(&lt;span style="COLOR: #a31515"&gt;"dominick"&lt;/span&gt;,
props);&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;var&lt;/span&gt; factory
= &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;ChannelFactory&lt;/span&gt;&amp;lt;&lt;span style="COLOR: #2b91af"&gt;IServiceClientChannel&lt;/span&gt;&amp;gt;(&lt;span style="COLOR: #a31515"&gt;"*"&lt;/span&gt;);&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;
&lt;br&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp; FederatedClientCredentials&lt;/span&gt;.ConfigureChannelFactory&amp;lt;&lt;span style="COLOR: #2b91af"&gt;IServiceClientChannel&lt;/span&gt;&amp;gt;(factory);&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;var&lt;/span&gt; proxy
= factory.CreateChannelWithIssuedToken&amp;lt;&lt;span style="COLOR: #2b91af"&gt;IServiceClientChannel&lt;/span&gt;&amp;gt;(token);&lt;br&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;proxy.Operation(&lt;span style="COLOR: #a31515"&gt;"foo"&lt;/span&gt;);&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;proxy.Close();&lt;br&gt;
}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Service&lt;/strong&gt;
&lt;br&gt;
On the service side you need a corresponding token handler that “understands” the
semantics of the SAML token. Geneva has a built-in handler for SAML tokens but it
does not know how to authenticate the client based on the values of certain SAML attributes.
Furthermore you need to make a decision which of the incoming attributes should become
part of the claims identity in the service. Maybe you don’t want sensitive information
like the password to flow to the service operations (maybe you want exactly that).
Other customizations to the standard behavior would be to ignore audience URIs as
well as signatures (since our client tokens won’t have them).
&lt;/p&gt;
&lt;p&gt;
By deriving from the built-in token handler you can drive this logic while letting
the base class do all the heavy lifting of token serialization and parsing:
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: consolas; COLOR: blue; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;public&lt;/span&gt;&lt;span style="FONT-FAMILY: consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt; &lt;span style="COLOR: blue"&gt;abstract&lt;/span&gt; &lt;span style="COLOR: blue"&gt;class&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;ClientSaml11SecurityTokenHandlerBase&lt;/span&gt; : &lt;span style="COLOR: #2b91af"&gt;Saml11SecurityTokenHandler&lt;br&gt;
&lt;/span&gt;{&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: green"&gt;//
disable audience URI checking&lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;public&lt;/span&gt; ClientSaml11SecurityTokenHandlerBase()&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;: &lt;span style="COLOR: blue"&gt;base&lt;/span&gt;(&lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;SamlSecurityTokenRequirement&lt;/span&gt; {
AudienceUriMode = &lt;span style="COLOR: #2b91af"&gt;AudienceUriMode&lt;/span&gt;.Never })&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;{ }&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: green"&gt;//
extensibility point for authentication and claims filtering&lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;protected&lt;/span&gt; &lt;span style="COLOR: blue"&gt;abstract&lt;/span&gt; &lt;span style="COLOR: blue"&gt;bool&lt;/span&gt; ValidateUser(&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;string&lt;/span&gt; subjectName, &lt;span style="COLOR: #2b91af"&gt;Dictionary&lt;/span&gt;&amp;lt;&lt;span style="COLOR: blue"&gt;string&lt;/span&gt;, &lt;span style="COLOR: blue"&gt;string&lt;/span&gt;&amp;gt;
properties, &lt;span style="COLOR: blue"&gt;ref&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="COLOR: blue"&gt;string&lt;/span&gt;&amp;gt;
claimsList);&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: green"&gt;//
override signature handling&lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;public&lt;/span&gt; &lt;span style="COLOR: blue"&gt;override&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;SecurityToken&lt;/span&gt; ReadToken(&lt;span style="COLOR: #2b91af"&gt;XmlReader&lt;/span&gt; reader)&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;{&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;Saml11Assertion&lt;/span&gt; assertion
= &lt;span style="COLOR: blue"&gt;this&lt;/span&gt;.ReadAssertion(reader);&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;return&lt;/span&gt; &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;SamlSecurityToken&lt;/span&gt;(assertion);&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;}&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;public&lt;/span&gt; &lt;span style="COLOR: blue"&gt;override&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;ClaimsIdentityCollection&lt;/span&gt; ValidateToken(&lt;span style="COLOR: #2b91af"&gt;SecurityToken&lt;/span&gt; token)&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;{&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: green"&gt;//
call base class for token validation and serialization&lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;var&lt;/span&gt; ids
= &lt;span style="COLOR: blue"&gt;base&lt;/span&gt;.ValidateToken(token);&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;var&lt;/span&gt; id
= ids[0];&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: green"&gt;//
retrieve client name&lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;string&lt;/span&gt; subjectName
= id.Claims.Where(&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;claim
=&amp;gt; claim.ClaimType == &lt;span style="COLOR: #2b91af"&gt;WSIdentityConstants&lt;/span&gt;.&lt;span style="COLOR: #2b91af"&gt;ClaimTypes&lt;/span&gt;.NameIdentifier).First().Value;&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: green"&gt;//
copy attributes to dictionary&lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;var&lt;/span&gt; properties
= &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;Dictionary&lt;/span&gt;&amp;lt;&lt;span style="COLOR: blue"&gt;string&lt;/span&gt;, &lt;span style="COLOR: blue"&gt;string&lt;/span&gt;&amp;gt;();&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;id.Claims.ToList().ForEach(&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;claim
=&amp;gt; properties.Add(claim.ClaimType, claim.Value));&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: green"&gt;//
call authentication and filtering logic&lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;var&lt;/span&gt; claimsToKeep
= &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="COLOR: blue"&gt;string&lt;/span&gt;&amp;gt;();&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;if&lt;/span&gt; (ValidateUser(subjectName,
properties, &lt;span style="COLOR: blue"&gt;ref&lt;/span&gt; claimsToKeep))&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;ClaimsIdentity&lt;/span&gt; identity
= &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;ClaimsIdentity&lt;/span&gt;(&lt;span style="COLOR: #a31515"&gt;"ClientSAML"&lt;/span&gt;);&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: green"&gt;//
add client name&lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;identity.Claims.Add(&lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;Claim&lt;/span&gt;(&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: #2b91af"&gt;WSIdentityConstants&lt;/span&gt;.&lt;span style="COLOR: #2b91af"&gt;ClaimTypes&lt;/span&gt;.Name,
subjectName, &lt;span style="COLOR: #2b91af"&gt;ClaimValueTypes&lt;/span&gt;.String, &lt;span style="COLOR: #a31515"&gt;"LOCAL"&lt;/span&gt;));&lt;span style="COLOR: #2b91af"&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: green"&gt;//
copy "allowed" attributes&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;claimsToKeep.ForEach(claimType
=&amp;gt;&lt;span style="COLOR: green"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;span style="COLOR: green"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;string&lt;/span&gt; value
= id.Claims.Where(claim =&amp;gt; claim.ClaimType == claimType).FirstOrDefault().Value;&lt;span style="COLOR: green"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;if&lt;/span&gt; (!&lt;span style="COLOR: blue"&gt;string&lt;/span&gt;.IsNullOrEmpty(value))&lt;span style="COLOR: green"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;span style="COLOR: green"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;identity.Claims.Add(&lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;Claim&lt;/span&gt;(claimType,
value, &lt;span style="COLOR: #2b91af"&gt;ClaimValueTypes&lt;/span&gt;.String, &lt;span style="COLOR: #a31515"&gt;"LOCAL"&lt;/span&gt;));&lt;span style="COLOR: green"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;span style="COLOR: green"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;});&lt;span style="COLOR: green"&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;return&lt;/span&gt; &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;ClaimsIdentityCollection&lt;/span&gt;(identity);&lt;span style="COLOR: green"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;span style="COLOR: green"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;else&lt;/span&gt;&lt;span style="COLOR: green"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;span style="COLOR: green"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;throw&lt;/span&gt; &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;SecurityTokenValidationException&lt;/span&gt;();&lt;span style="COLOR: green"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;span style="COLOR: green"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;span style="COLOR: green"&gt;
&lt;br&gt;
&lt;/span&gt;}&lt;span style="COLOR: green"&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
The authentication logic and filtering could be implemented like this:
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: consolas; COLOR: blue; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;class&lt;/span&gt;&lt;span style="FONT-FAMILY: consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt; &lt;span style="COLOR: #2b91af"&gt;ClientSaml11SecurityTokenHandler&lt;/span&gt; : &lt;span style="COLOR: #2b91af"&gt;ClientSaml11SecurityTokenHandlerBase&lt;br&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-FAMILY: consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;{&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;protected&lt;/span&gt; &lt;span style="COLOR: blue"&gt;override&lt;/span&gt; &lt;span style="COLOR: blue"&gt;bool&lt;/span&gt; ValidateUser(&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;string&lt;/span&gt; subjectName, &lt;span style="COLOR: #2b91af"&gt;Dictionary&lt;/span&gt;&amp;lt;&lt;span style="COLOR: blue"&gt;string&lt;/span&gt;, &lt;span style="COLOR: blue"&gt;string&lt;/span&gt;&amp;gt;
properties, &lt;span style="COLOR: blue"&gt;ref&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="COLOR: blue"&gt;string&lt;/span&gt;&amp;gt;
claimsList)&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;string&lt;/span&gt; password
= properties[_passwordClaimType];&lt;br&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: green"&gt;//
sample password check – don’t just copy&amp;amp;paste this code ;)&lt;/span&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;if&lt;/span&gt; (subjectName
!= password)&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;return&lt;/span&gt; &lt;span style="COLOR: blue"&gt;false&lt;/span&gt;;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;claimsList.Add(_customerIdClaimType);&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;return&lt;/span&gt; &lt;span style="COLOR: blue"&gt;true&lt;/span&gt;;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br&gt;
}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
After wiring up the new token handler in the WCF service you get access to the claims
in the operation via IClaimsPrincipal as usual.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Configuration&lt;br&gt;
&lt;/strong&gt;The last step deals with setting up the security parameters on the binding.
Since the client SAML token is much like a UserName token on steroids, we choose similar
security configurations (and make the same security guarantees). You can either use
message security where the client token gets encrypted with the service certificate
– or mixed mode security where the transport is secured using SSL.
&lt;/p&gt;
&lt;p&gt;
For mixed mode security you can use the &lt;em&gt;IssuedTokenOverTransport&lt;/em&gt; authentication
mode. The custom binding looks like this:
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: consolas; COLOR: blue; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&amp;lt;&lt;/span&gt;&lt;span style="FONT-FAMILY: consolas; COLOR: #a31515; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;customBinding&lt;/span&gt;&lt;span style="FONT-FAMILY: consolas; COLOR: blue; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="FONT-FAMILY: consolas; COLOR: #a31515; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;binding&lt;/span&gt;&lt;span style="FONT-FAMILY: consolas; COLOR: blue; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt; &lt;/span&gt;&lt;span style="FONT-FAMILY: consolas; COLOR: red; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;name&lt;/span&gt;&lt;span style="FONT-FAMILY: consolas; COLOR: blue; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;=&lt;/span&gt;&lt;span style="FONT-FAMILY: consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;"&lt;span style="COLOR: blue"&gt;BearerTokenOverTransport&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;security&lt;/span&gt;&lt;span style="COLOR: blue"&gt; &lt;/span&gt;&lt;span style="COLOR: red"&gt;authenticationMode&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;IssuedTokenOverTransport&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;issuedTokenParameters&lt;/span&gt;&lt;span style="COLOR: blue"&gt; 
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: red"&gt;tokenType&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1"&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="COLOR: red"&gt;keyType&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;BearerKey&lt;/span&gt;"&lt;span style="COLOR: blue"&gt; /&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;security&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;textMessageEncoding&lt;/span&gt;&lt;span style="COLOR: blue"&gt; /&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;httpsTransport&lt;/span&gt;&lt;span style="COLOR: blue"&gt; /&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;binding&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;br&gt;
&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;customBinding&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
For message security, there is no built-in binding element helper – you have to construct
it via code:
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: consolas; COLOR: blue; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;public&lt;/span&gt;&lt;span style="FONT-FAMILY: consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt; &lt;span style="COLOR: blue"&gt;static&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;SecurityBindingElement&lt;/span&gt; CreateClientTokenForCertificateBindingElement()&lt;br&gt;
{&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: green"&gt;// protection
token&lt;/span&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;var&lt;/span&gt; element
= &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;SymmetricSecurityBindingElement&lt;/span&gt;(&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;X509SecurityTokenParameters&lt;/span&gt;(&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;X509KeyIdentifierClauseType&lt;/span&gt;.Thumbprint,&amp;nbsp;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;SecurityTokenInclusionMode&lt;/span&gt;.Never));&lt;br&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: green"&gt;// client
token&lt;/span&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;var&lt;/span&gt; parameters
= &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;IssuedSecurityTokenParameters&lt;/span&gt;(&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;Saml11SecurityTokenHandler&lt;/span&gt;.OasisWssSamlTokenProfile11,&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;EndpointAddress&lt;/span&gt;(&lt;span style="COLOR: #a31515"&gt;&lt;a href="http://self"&gt;http://self&lt;/a&gt;&lt;/span&gt;),&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;BasicHttpBinding&lt;/span&gt;());&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;parameters.KeyType = &lt;span style="COLOR: #2b91af"&gt;SecurityKeyType&lt;/span&gt;.BearerKey;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;parameters.InclusionMode = &lt;span style="COLOR: #2b91af"&gt;SecurityTokenInclusionMode&lt;/span&gt;.AlwaysToRecipient;&lt;br style="mso-special-character: line-break"&gt;
&lt;br style="mso-special-character: line-break"&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p style="LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;span style="FONT-FAMILY: consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;element.EndpointSupportingTokenParameters.SignedEncrypted.Add(parameters);&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;element.MessageSecurityVersion = 
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: #2b91af"&gt;MessageSecurityVersion&lt;/span&gt;.WSSecurity11WSTrust13&lt;br&gt;
&lt;/span&gt;&lt;span style="FONT-FAMILY: consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
WSSecureConversation13&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;WSSecurityPolicy12BasicSecurityProfile10;&lt;br&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;return&lt;/span&gt; element;&lt;br&gt;
}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
You can then use this helper to construct a custom binding (see the download for the
complete code).
&lt;/p&gt;
&lt;p&gt;
That’s it. HTH
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.leastprivilege.com/content/binary/ClientSamlCredential.zip"&gt;ClientSamlCredential.zip
(450.94 KB)&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=b3dcbcb5-29a2-4e4b-a5f3-38b09e126a0a" /&gt;</description>
      <category>IdentityModel</category>
      <category>WCF</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=54c376a1-4c63-4d51-a2e3-dcd7302695a2</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=54c376a1-4c63-4d51-a2e3-dcd7302695a2</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Every once in a while the question comes up how to extend WCF with custom credential
types. It turns out that most of the time people don’t really want to invent custom
tokens or credential types, but rather want to extend username/password style of credentials
(e.g. username/password/customer ID). Unfortunately the UserName token does not support
this type of extensibility but there are several options to accomplish this:
</p>
        <ul>
          <li>
If your extensibility requirements are very simple you could try to encode all the
information into the username and password fields of a UserName credential. You’d
need some extra plumbing on the service side (<em>UserNamePasswordValidator</em>,
custom <em>IPrincipal</em>) to decode the information again and provide normalized
user information. 
</li>
          <li>
You could use SOAP headers to transmit the additional information. This has the potential
to pollute your business logic with security plumbing and needs some wrapping. There
are also some gotchas around <a href="http://blogs.msdn.com/drnick/archive/2008/08/22/autoheader-extension.aspx">adding</a> headers
on the fly, as well as <a href="http://blogs.msdn.com/drnick/archive/2007/01/18/securing-custom-headers-version-1.aspx">protecting</a> them. 
</li>
          <li>
You could write a full fledged custom credential that supports the extensibility you
need. Unfortunately this is not the best documented area of WCF and you are mostly
on your own. The WCF credential infrastructure is extremely flexible – but I wouldn’t
call it an extensibility point – but rather a replacement point. You end up replacing
a number of classes on the service and client side to make this happen (see <a href="http://www.pluralsight.com/community/blogs/tjanczuk/archive/2006/06/16/28046.aspx">here</a> for
an overview). I did that for a username/password/namevalue credential and it wasn’t
a pleasant experience. 
</li>
          <li>
You could use a standard token type in WCF that already supports all the extensibility
needs you might have – e.g. SAML. The problem here is that SAML and issued tokens
are not very accessible through plain WCF – but Geneva makes it much easier to use
them - even without a security token service. That’s the option I am going to look
at in the next post.</li>
        </ul>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=54c376a1-4c63-4d51-a2e3-dcd7302695a2" />
      </body>
      <title>Custom WCF Credential Types</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=54c376a1-4c63-4d51-a2e3-dcd7302695a2</guid>
      <link>http://www.leastprivilege.com/CustomWCFCredentialTypes.aspx</link>
      <pubDate>Mon, 09 Mar 2009 09:30:20 GMT</pubDate>
      <description>&lt;p&gt;
Every once in a while the question comes up how to extend WCF with custom credential
types. It turns out that most of the time people don’t really want to invent custom
tokens or credential types, but rather want to extend username/password style of credentials
(e.g. username/password/customer ID). Unfortunately the UserName token does not support
this type of extensibility but there are several options to accomplish this:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
If your extensibility requirements are very simple you could try to encode all the
information into the username and password fields of a UserName credential. You’d
need some extra plumbing on the service side (&lt;em&gt;UserNamePasswordValidator&lt;/em&gt;,
custom &lt;em&gt;IPrincipal&lt;/em&gt;) to decode the information again and provide normalized
user information. 
&lt;li&gt;
You could use SOAP headers to transmit the additional information. This has the potential
to pollute your business logic with security plumbing and needs some wrapping. There
are also some gotchas around &lt;a href="http://blogs.msdn.com/drnick/archive/2008/08/22/autoheader-extension.aspx"&gt;adding&lt;/a&gt; headers
on the fly, as well as &lt;a href="http://blogs.msdn.com/drnick/archive/2007/01/18/securing-custom-headers-version-1.aspx"&gt;protecting&lt;/a&gt; them. 
&lt;li&gt;
You could write a full fledged custom credential that supports the extensibility you
need. Unfortunately this is not the best documented area of WCF and you are mostly
on your own. The WCF credential infrastructure is extremely flexible – but I wouldn’t
call it an extensibility point – but rather a replacement point. You end up replacing
a number of classes on the service and client side to make this happen (see &lt;a href="http://www.pluralsight.com/community/blogs/tjanczuk/archive/2006/06/16/28046.aspx"&gt;here&lt;/a&gt; for
an overview). I did that for a username/password/namevalue credential and it wasn’t
a pleasant experience. 
&lt;li&gt;
You could use a standard token type in WCF that already supports all the extensibility
needs you might have – e.g. SAML. The problem here is that SAML and issued tokens
are not very accessible through plain WCF – but Geneva makes it much easier to use
them - even without a security token service. That’s the option I am going to look
at in the next post.&lt;/li&gt;
&lt;/ul&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=54c376a1-4c63-4d51-a2e3-dcd7302695a2" /&gt;</description>
      <category>WCF</category>
      <category>IdentityModel</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=0ea99b6f-30e7-4244-8524-1fc9820040be</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=0ea99b6f-30e7-4244-8524-1fc9820040be</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Keys used in tokens or RSTRs need to be identified somehow – common ways to do this
is to use a thumbprint, a serial number or the subject key identifier.
</p>
        <p>
A “Geneva” based token service will use the combination of issuer name and certificate
serial number by default. This is usually fine, but you may need to change that because
of interop scenarios. Metro based web services e.g. prefer the subject key identifier
method.
</p>
        <p>
Took me some time to figure it out – so maybe this info is useful to someone.
</p>
        <p>
There are two key identifiers you may want to modify – the signing and the encrypting
key. These are represented in “Geneva” using the <em>SigningCredentials</em> and <em>EncryptingCredentials</em> classes
respectively. The signing credentials are supplied in the <em>SecurityTokenServiceConfiguration</em> whereas
the encrypting credentials are specified in the <em>GetScope</em> method. On these
classes you can set the key identifier method using the <em>SecurityKeyIdentifier</em> property
or the constructor. You can use the following code to create a subject key identifier
clause for X509 certificates:
</p>
        <p>
          <font face="Consolas">var ski = new SecurityKeyIdentifier(<br />
            new SecurityKeyIdentifierClause[] 
<br />
            { 
<br />
               
new X509SecurityToken(cert).CreateKeyIdentifierClause&lt;<font color="#0080c0">X509SubjectKeyIdentifierClause</font>&gt;()<br />
            });</font>
        </p>
        <p>
To see what other key identifier types are available, have a look at the inheritance
hierarchy of the base class <em>System.IdentityModel.Tokens.SecurityKeyIdentifierClause</em>.
</p>
        <p>
HTH
</p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=0ea99b6f-30e7-4244-8524-1fc9820040be" />
      </body>
      <title>Setting Key Identifiers in Geneva</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=0ea99b6f-30e7-4244-8524-1fc9820040be</guid>
      <link>http://www.leastprivilege.com/SettingKeyIdentifiersInGeneva.aspx</link>
      <pubDate>Fri, 27 Feb 2009 09:33:49 GMT</pubDate>
      <description>&lt;p&gt;
Keys used in tokens or RSTRs need to be identified somehow – common ways to do this
is to use a thumbprint, a serial number or the subject key identifier.
&lt;/p&gt;
&lt;p&gt;
A “Geneva” based token service will use the combination of issuer name and certificate
serial number by default. This is usually fine, but you may need to change that because
of interop scenarios. Metro based web services e.g. prefer the subject key identifier
method.
&lt;/p&gt;
&lt;p&gt;
Took me some time to figure it out – so maybe this info is useful to someone.
&lt;/p&gt;
&lt;p&gt;
There are two key identifiers you may want to modify – the signing and the encrypting
key. These are represented in “Geneva” using the &lt;em&gt;SigningCredentials&lt;/em&gt; and &lt;em&gt;EncryptingCredentials&lt;/em&gt; classes
respectively. The signing credentials are supplied in the &lt;em&gt;SecurityTokenServiceConfiguration&lt;/em&gt; whereas
the encrypting credentials are specified in the &lt;em&gt;GetScope&lt;/em&gt; method. On these
classes you can set the key identifier method using the &lt;em&gt;SecurityKeyIdentifier&lt;/em&gt; property
or the constructor. You can use the following code to create a subject key identifier
clause for X509 certificates:
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Consolas"&gt;var ski = new SecurityKeyIdentifier(&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new SecurityKeyIdentifierClause[] 
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { 
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
new X509SecurityToken(cert).CreateKeyIdentifierClause&amp;lt;&lt;font color="#0080c0"&gt;X509SubjectKeyIdentifierClause&lt;/font&gt;&amp;gt;()&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;/font&gt; 
&lt;p&gt;
To see what other key identifier types are available, have a look at the inheritance
hierarchy of the base class &lt;em&gt;System.IdentityModel.Tokens.SecurityKeyIdentifierClause&lt;/em&gt;.
&lt;/p&gt;
&lt;p&gt;
HTH
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=0ea99b6f-30e7-4244-8524-1fc9820040be" /&gt;</description>
      <category>IdentityModel</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=67a856e5-a198-4df0-8335-e8dfe00b3040</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=67a856e5-a198-4df0-8335-e8dfe00b3040</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
One of my web servers here has a pretty common setup – a Windows machine name and
a (different) DNS name (in this case dynamic DNS – but doesn’t matter). IIS has a
single web site with bindings for HTTP and HTTPS. The common name of the SSL certificate
matches the public DNS name. Everything looks good.
</p>
        <p>
The server also hosts some WCF services and I noticed that the imports and endpoint
addresses in the WSDL point to the machine name and not to the DNS name. No big deal
– simply set the host header for the site via the IIS GUI and I am done. That’s what
I thought at least.
</p>
        <p>
And sure enough, after the configuration change my WSDL was correct and used the name
configured in the host header.
</p>
        <p>
Some weeks later I added some more WCF endpoints to the machine, this time I was using
SSL – including an SSL WSDL/MEX endpoint. After some weird error messages I re-inspected
the WSDL and everything looked fine - until I hit the WSDL document in the browser
using SSL. Again imports and endpoint addresses were pointing to the machine name.
What’s going on here?
</p>
        <p>
After some googling I found articles about something I totally forgot about: SSL host
headers. Since IIS 6 you can also set host headers for SSL site bindings. Since this
option is not available via the GUI I kind of “missed” it. These two articles show
the necessary steps for <a href="http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/596b9108-b1a7-494d-885d-f8941b07554c.mspx?mfr=true">IIS6</a> and <a href="http://blogs.iis.net/thomad/archive/2008/01/25/ssl-certificates-on-sites-with-host-headers.aspx">IIS7</a>.
</p>
        <p>
My applicationHost.config now looks like this for my site:
</p>
        <span style="line-height: 115%; font-family: consolas; color: blue; font-size: 11pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: de; mso-fareast-language: en-us; mso-bidi-language: ar-sa; mso-no-proof: yes">&lt;</span>
        <span style="line-height: 115%; font-family: consolas; color: #a31515; font-size: 11pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: de; mso-fareast-language: en-us; mso-bidi-language: ar-sa; mso-no-proof: yes">bindings</span>
        <span style="line-height: 115%; font-family: consolas; color: blue; font-size: 11pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: de; mso-fareast-language: en-us; mso-bidi-language: ar-sa; mso-no-proof: yes">&gt;<br /><span style="mso-spacerun: yes">  </span>&lt;</span>
        <span style="line-height: 115%; font-family: consolas; color: #a31515; font-size: 11pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: de; mso-fareast-language: en-us; mso-bidi-language: ar-sa; mso-no-proof: yes">binding</span>
        <span style="line-height: 115%; font-family: consolas; color: blue; font-size: 11pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: de; mso-fareast-language: en-us; mso-bidi-language: ar-sa; mso-no-proof: yes">
        </span>
        <span style="line-height: 115%; font-family: consolas; color: red; font-size: 11pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: de; mso-fareast-language: en-us; mso-bidi-language: ar-sa; mso-no-proof: yes">protocol</span>
        <span style="line-height: 115%; font-family: consolas; color: blue; font-size: 11pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: de; mso-fareast-language: en-us; mso-bidi-language: ar-sa; mso-no-proof: yes">=</span>
        <span style="line-height: 115%; font-family: consolas; font-size: 11pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: de; mso-fareast-language: en-us; mso-bidi-language: ar-sa; mso-no-proof: yes">"<span style="color: blue">http</span>"<span style="color: blue"><br /><span style="mso-spacerun: yes">           </span></span><span style="color: red">bindingInformation</span><span style="color: blue">=</span>"<span style="color: blue">*:80:www.mypublicname.com</span>"<span style="color: blue"> /&gt;<br /><span style="mso-spacerun: yes">  </span>&lt;</span><span style="color: #a31515">binding</span><span style="color: blue"></span><span style="color: red">protocol</span><span style="color: blue">=</span>"<span style="color: blue">https</span>"<span style="color: blue"><br /><span style="mso-spacerun: yes">           </span></span><span style="color: red">bindingInformation</span><span style="color: blue">=</span>"<span style="color: blue">*:443:www.mypublicname.com</span>"<span style="color: blue"> /&gt;<br />
&lt;/</span><span style="color: #a31515">bindings</span><span style="color: blue">&gt;</span></span>
        <p>
HTH
</p>
        <p>
(Rich: marked as answer)
</p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=67a856e5-a198-4df0-8335-e8dfe00b3040" />
      </body>
      <title>Host Headers, SSL and WCF Metadata</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=67a856e5-a198-4df0-8335-e8dfe00b3040</guid>
      <link>http://www.leastprivilege.com/HostHeadersSSLAndWCFMetadata.aspx</link>
      <pubDate>Tue, 10 Feb 2009 09:34:56 GMT</pubDate>
      <description>&lt;p&gt;
One of my web servers here has a pretty common setup – a Windows machine name and
a (different) DNS name (in this case dynamic DNS – but doesn’t matter). IIS has a
single web site with bindings for HTTP and HTTPS. The common name of the SSL certificate
matches the public DNS name. Everything looks good.
&lt;/p&gt;
&lt;p&gt;
The server also hosts some WCF services and I noticed that the imports and endpoint
addresses in the WSDL point to the machine name and not to the DNS name. No big deal
– simply set the host header for the site via the IIS GUI and I am done. That’s what
I thought at least.
&lt;/p&gt;
&lt;p&gt;
And sure enough, after the configuration change my WSDL was correct and used the name
configured in the host header.
&lt;/p&gt;
&lt;p&gt;
Some weeks later I added some more WCF endpoints to the machine, this time I was using
SSL – including an SSL WSDL/MEX endpoint. After some weird error messages I re-inspected
the WSDL and everything looked fine - until I hit the WSDL document in the browser
using SSL. Again imports and endpoint addresses were pointing to the machine name.
What’s going on here?
&lt;/p&gt;
&lt;p&gt;
After some googling I found articles about something I totally forgot about: SSL host
headers. Since IIS 6 you can also set host headers for SSL site bindings. Since this
option is not available via the GUI I kind of “missed” it. These two articles show
the necessary steps for &lt;a href="http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/596b9108-b1a7-494d-885d-f8941b07554c.mspx?mfr=true"&gt;IIS6&lt;/a&gt; and &lt;a href="http://blogs.iis.net/thomad/archive/2008/01/25/ssl-certificates-on-sites-with-host-headers.aspx"&gt;IIS7&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
My applicationHost.config now looks like this for my site:
&lt;/p&gt;
&lt;span style="line-height: 115%; font-family: consolas; color: blue; font-size: 11pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: de; mso-fareast-language: en-us; mso-bidi-language: ar-sa; mso-no-proof: yes"&gt;&amp;lt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: consolas; color: #a31515; font-size: 11pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: de; mso-fareast-language: en-us; mso-bidi-language: ar-sa; mso-no-proof: yes"&gt;bindings&lt;/span&gt;&lt;span style="line-height: 115%; font-family: consolas; color: blue; font-size: 11pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: de; mso-fareast-language: en-us; mso-bidi-language: ar-sa; mso-no-proof: yes"&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: consolas; color: #a31515; font-size: 11pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: de; mso-fareast-language: en-us; mso-bidi-language: ar-sa; mso-no-proof: yes"&gt;binding&lt;/span&gt;&lt;span style="line-height: 115%; font-family: consolas; color: blue; font-size: 11pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: de; mso-fareast-language: en-us; mso-bidi-language: ar-sa; mso-no-proof: yes"&gt; &lt;/span&gt;&lt;span style="line-height: 115%; font-family: consolas; color: red; font-size: 11pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: de; mso-fareast-language: en-us; mso-bidi-language: ar-sa; mso-no-proof: yes"&gt;protocol&lt;/span&gt;&lt;span style="line-height: 115%; font-family: consolas; color: blue; font-size: 11pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: de; mso-fareast-language: en-us; mso-bidi-language: ar-sa; mso-no-proof: yes"&gt;=&lt;/span&gt;&lt;span style="line-height: 115%; font-family: consolas; font-size: 11pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: de; mso-fareast-language: en-us; mso-bidi-language: ar-sa; mso-no-proof: yes"&gt;"&lt;span style="color: blue"&gt;http&lt;/span&gt;"&lt;span style="color: blue"&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: red"&gt;bindingInformation&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;*:80:www.mypublicname.com&lt;/span&gt;"&lt;span style="color: blue"&gt; /&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;binding&lt;/span&gt;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;protocol&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;https&lt;/span&gt;"&lt;span style="color: blue"&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: red"&gt;bindingInformation&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;*:443:www.mypublicname.com&lt;/span&gt;"&lt;span style="color: blue"&gt; /&amp;gt;&lt;br&gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;bindings&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt; 
&lt;p&gt;
HTH
&lt;/p&gt;
&lt;p&gt;
(Rich: marked as answer)
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=67a856e5-a198-4df0-8335-e8dfe00b3040" /&gt;</description>
      <category>WCF</category>
      <category>IdentityModel</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=b0a8a298-7a33-4b89-af02-df722a0dddea</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=b0a8a298-7a33-4b89-af02-df722a0dddea</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I really, really hope this is a beta only issue…
</p>
        <p>
          <a href="http://www.istartedsomething.com/20090204/second-windows-7-uac-flaw-malware-self-elevate/">http://www.istartedsomething.com/20090204/second-windows-7-uac-flaw-malware-self-elevate/</a>
        </p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=b0a8a298-7a33-4b89-af02-df722a0dddea" />
      </body>
      <title>UAC flawed in Win7?</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=b0a8a298-7a33-4b89-af02-df722a0dddea</guid>
      <link>http://www.leastprivilege.com/UACFlawedInWin7.aspx</link>
      <pubDate>Wed, 04 Feb 2009 19:53:17 GMT</pubDate>
      <description>&lt;p&gt;
I really, really hope this is a beta only issue…
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.istartedsomething.com/20090204/second-windows-7-uac-flaw-malware-self-elevate/"&gt;http://www.istartedsomething.com/20090204/second-windows-7-uac-flaw-malware-self-elevate/&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=b0a8a298-7a33-4b89-af02-df722a0dddea" /&gt;</description>
      <category>Misc</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=81c0a3db-372b-4055-9bc0-668431211386</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=81c0a3db-372b-4055-9bc0-668431211386</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
The “query language” of SQL Data Services is basically a LINQ statement as a string,
e.g.:
</p>
        <blockquote>
          <p>
            <font face="Courier">from e in entities where e["username"] == "{0}" &amp;&amp; e["password"]
== "{1}" select e</font>
          </p>
        </blockquote>
        <p>
Do you see a problem here?
</p>
        <p>
Of course string concatenation combined with "no-schema” flex entities allows all
kinds of injections. <a href="http://www.heege.net/blog/default.aspx">Marcus</a> and
I did some tests, e.g. try entering the following username for the above statement:
</p>
        <blockquote>
          <p>
            <font face="Courier New">foo" || "" == "</font>
          </p>
        </blockquote>
        <p>
This will select all users. I am sure there are other tricks, too.
</p>
        <p>
So again – be aware that you have to validate all of your input! Some things you can
do here include:
</p>
        <ol>
          <li>
run a regular expression over your inputs to make sure it only contains legal characters</li>
          <li>
escape character like quotation marks and back slashes</li>
          <li>
use e.g. the Single() LINQ operator on the returned entity list when you know that
only one entity should be returned (otherwise something must be wrong).</li>
        </ol>
        <p>
HTH
</p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=81c0a3db-372b-4055-9bc0-668431211386" />
      </body>
      <title>SQL Data Services Query Injection</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=81c0a3db-372b-4055-9bc0-668431211386</guid>
      <link>http://www.leastprivilege.com/SQLDataServicesQueryInjection.aspx</link>
      <pubDate>Tue, 20 Jan 2009 11:34:31 GMT</pubDate>
      <description>&lt;p&gt;
The “query language” of SQL Data Services is basically a LINQ statement as a string,
e.g.:
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
&lt;font face="Courier"&gt;from e in entities where e["username"] == "{0}" &amp;amp;&amp;amp; e["password"]
== "{1}" select e&lt;/font&gt;
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
Do you see a problem here?
&lt;/p&gt;
&lt;p&gt;
Of course string concatenation combined with "no-schema” flex entities allows all
kinds of injections. &lt;a href="http://www.heege.net/blog/default.aspx"&gt;Marcus&lt;/a&gt; and
I did some tests, e.g. try entering the following username for the above statement:
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
&lt;font face="Courier New"&gt;foo" || "" == "&lt;/font&gt;
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
This will select all users. I am sure there are other tricks, too.
&lt;/p&gt;
&lt;p&gt;
So again – be aware that you have to validate all of your input! Some things you can
do here include:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
run a regular expression over your inputs to make sure it only contains legal characters&lt;/li&gt;
&lt;li&gt;
escape character like quotation marks and back slashes&lt;/li&gt;
&lt;li&gt;
use e.g. the Single() LINQ operator on the returned entity list when you know that
only one entity should be returned (otherwise something must be wrong).&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
HTH
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=81c0a3db-372b-4055-9bc0-668431211386" /&gt;</description>
      <category>Misc</category>
      <category>Work in Progress</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=04d0bf7f-48af-4fc1-98d5-8f93597cddaf</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=04d0bf7f-48af-4fc1-98d5-8f93597cddaf</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
A while ago I wrote <a href="http://www.leastprivilege.com/PartiallySSLSecuredWebAppsWithASPNET.aspx">this</a> article
about some of the things to watch out for when securing parts of an application with
SSL. Keith used the attached code as part of his work and extended it. Even better
he made his extensions available for download – I recommend to have a look. Thanks
for sharing, Keith!
</p>
        <p>
Read his post <a href="http://www.pluralsight.com/community/blogs/keith/archive/2009/01/17/sslhelper-get-help-running-a-partial-ssl-website-in-asp-net.aspx">here</a>.
</p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=04d0bf7f-48af-4fc1-98d5-8f93597cddaf" />
      </body>
      <title>Get help running a partial SSL website in ASP.NET</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=04d0bf7f-48af-4fc1-98d5-8f93597cddaf</guid>
      <link>http://www.leastprivilege.com/GetHelpRunningAPartialSSLWebsiteInASPNET.aspx</link>
      <pubDate>Mon, 19 Jan 2009 06:55:56 GMT</pubDate>
      <description>&lt;p&gt;
A while ago I wrote &lt;a href="http://www.leastprivilege.com/PartiallySSLSecuredWebAppsWithASPNET.aspx"&gt;this&lt;/a&gt; article
about some of the things to watch out for when securing parts of an application with
SSL. Keith used the attached code as part of his work and extended it. Even better
he made his extensions available for download – I recommend to have a look. Thanks
for sharing, Keith!
&lt;/p&gt;
&lt;p&gt;
Read his post &lt;a href="http://www.pluralsight.com/community/blogs/keith/archive/2009/01/17/sslhelper-get-help-running-a-partial-ssl-website-in-asp-net.aspx"&gt;here&lt;/a&gt;.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=04d0bf7f-48af-4fc1-98d5-8f93597cddaf" /&gt;</description>
      <category>ASP.NET</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=0e8a2f7c-543b-457a-90cd-cc9726b8ca33</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=0e8a2f7c-543b-457a-90cd-cc9726b8ca33</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I am thrilled to announce that <a href="http://www.dotnetconsult.co.uk/weblog2/">Rich</a> has
joined <a href="http://www.thinktecture.com">thinktecture</a> this week. That’s great
news.
</p>
        <p>
I’ve been working with Rich since 2004 (in fact – he was part of that scary initiation
ritual at DevelopMentor called “Test Teach”). He’s a great guy and knows hell of a
lot about .NET and distributed systems (and I am not going into some of his other
skills which usually end in a terrible headache next day – and I am not talking about
World of Warcraft ;). <strong>Welcome Rich!</strong></p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=0e8a2f7c-543b-457a-90cd-cc9726b8ca33" />
      </body>
      <title>Welcome Richard Blewett</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=0e8a2f7c-543b-457a-90cd-cc9726b8ca33</guid>
      <link>http://www.leastprivilege.com/WelcomeRichardBlewett.aspx</link>
      <pubDate>Sat, 10 Jan 2009 19:33:41 GMT</pubDate>
      <description>&lt;p&gt;
I am thrilled to announce that &lt;a href="http://www.dotnetconsult.co.uk/weblog2/"&gt;Rich&lt;/a&gt; has
joined &lt;a href="http://www.thinktecture.com"&gt;thinktecture&lt;/a&gt; this week. That’s great
news.
&lt;/p&gt;
&lt;p&gt;
I’ve been working with Rich since 2004 (in fact – he was part of that scary initiation
ritual at DevelopMentor called “Test Teach”). He’s a great guy and knows hell of a
lot about .NET and distributed systems (and I am not going into some of his other
skills which usually end in a terrible headache next day – and I am not talking about
World of Warcraft ;). &lt;strong&gt;Welcome Rich!&lt;/strong&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=0e8a2f7c-543b-457a-90cd-cc9726b8ca33" /&gt;</description>
      <category>Misc</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=1439d65e-9e90-4d3b-93c9-9b3eabba177e</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=1439d65e-9e90-4d3b-93c9-9b3eabba177e</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I while ago I <a href="http://www.leastprivilege.com/LiveIDAndInformationCardsJustGoodFriends.aspx">wrote</a> that
there is an experimental version of the Live ID login page that makes use of Information
Cards linked to your Live ID account. Unfortunately this login form was only used
for very specific services (hotmail only at that time IIRC).
</p>
        <p>
I am happy to see that more and more sites these days use the InfoCard enabled sign
in page – and more importantly - sites I actually use (e.g. MSDN, Live Mesh, Connect…).
Way to go!
</p>
        <img src="http://www.leastprivilege.com/content/binary/Capture1.PNG" border="0" />
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=1439d65e-9e90-4d3b-93c9-9b3eabba177e" />
      </body>
      <title>Live ID and Information Cards</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=1439d65e-9e90-4d3b-93c9-9b3eabba177e</guid>
      <link>http://www.leastprivilege.com/LiveIDAndInformationCards.aspx</link>
      <pubDate>Wed, 07 Jan 2009 05:30:19 GMT</pubDate>
      <description>&lt;p&gt;
I while ago I &lt;a href="http://www.leastprivilege.com/LiveIDAndInformationCardsJustGoodFriends.aspx"&gt;wrote&lt;/a&gt; that
there is an experimental version of the Live ID login page that makes use of Information
Cards linked to your Live ID account. Unfortunately this login form was only used
for very specific services (hotmail only at that time IIRC).
&lt;/p&gt;
&lt;p&gt;
I am happy to see that more and more sites these days use the InfoCard enabled sign
in page – and more importantly - sites I actually use (e.g. MSDN, Live Mesh, Connect…).
Way to go!
&lt;/p&gt;
&lt;img src="http://www.leastprivilege.com/content/binary/Capture1.PNG" border=0&gt;&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=1439d65e-9e90-4d3b-93c9-9b3eabba177e" /&gt;</description>
      <category>IdentityModel</category>
      <category>Misc</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=0fc01cc6-c15a-4b82-af84-82e3021f2555</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=0fc01cc6-c15a-4b82-af84-82e3021f2555</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <title>Federating with Live ID (using the Access Control Service)</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=0fc01cc6-c15a-4b82-af84-82e3021f2555</guid>
      <link>http://www.leastprivilege.com/FederatingWithLiveIDUsingTheAccessControlService.aspx</link>
      <pubDate>Sun, 28 Dec 2008 16:25:49 GMT</pubDate>
      <description>&lt;p&gt;
There are already a number of ways today how you can federate with the Live ID service
(e.g. using the &lt;a href="http://msdn.microsoft.com/en-us/library/bb404787.aspx"&gt;Live
ID SDK&lt;/a&gt;, &lt;a href="http://dev.live.com/blogs/devlive/archive/2008/10/27/421.aspx"&gt;OpenID&lt;/a&gt; or &lt;a href="https://msm.live.com"&gt;WS-Federation&lt;/a&gt;).
Another option would be to use the Access Control Service. I can see a bunch of reasons
why this may be compelling:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Live ID is pre-configured in the ACS. You don’t need any extra configuration steps
to register your site with Live ID. It just works. 
&lt;li&gt;
You can use the ACS rules engine to transform the Live ID claims to your application
claims. 
&lt;li&gt;
A Live ID is a low barrier entry for customers and partners to the ACS. In case they
can’t federate “properly” (e.g. using Geneva or the &lt;a href="http://dev.live.com/blogs/devlive/archive/2008/10/27/420.aspx"&gt;Services
Connector&lt;/a&gt;).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Generally, this is a good example of how the ACS can simplify security management
and configuration in your application endpoints. You can simply add another authentication
method to your application without needing to change anything substantial. All the
heavy lifting like crypto, trust and claims configuration is done in the ACS.
&lt;/p&gt;
&lt;p&gt;
This walkthrough uses the PDC bits of the ACS and Geneva framework to access Live
ID logins in an ASP.NET app. This is all beta software and details are subject to
change!
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Step 1: Setting up ASP.NET to use the ACS&lt;br&gt;
&lt;/strong&gt;First you have to enable Geneva in ASP.NET. This involves adding the WS-Federation
authentication module as well as the session authentication module. You also have
to setup the service certificate and allowed audience URI. Nothing special here.
&lt;/p&gt;
&lt;p&gt;
Very similar to the WCF scenario I described &lt;a href="http://www.leastprivilege.com/UsingTheNETAccessControlServiceWithGeneva.aspx"&gt;here&lt;/a&gt;,
you also have to check the token and SAML issuer. For the issuer check you use the
regular issuer name registry as described in my post. For the SAML issuer check you
can use an extensibility point in the FAM – simply add this code to global.asax:
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span lang=EN-US style="COLOR: blue; FONT-FAMILY: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;void&lt;/span&gt;&lt;span lang=EN-US style="FONT-FAMILY: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt; WSFederationAuthenticationModule_SecurityTokenValidated(&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;object&lt;/span&gt; sender, &lt;span style="COLOR: #2b91af"&gt;SecurityTokenValidatedEventArgs&lt;/span&gt; e)&lt;br&gt;
{&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;e.ClaimsPrincipal.DemandClaim(&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Microsoft.IdentityModel.Claims.&lt;span style="COLOR: #2b91af"&gt;ClaimTypes&lt;/span&gt;.SamlIssuerName,&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;"http://accesscontrol.windows.net/solutionName"&lt;/span&gt;);&lt;br&gt;&lt;?xml:namespace prefix = o /&gt;
}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
These two customizations establish a trust relationship with your ACS. You can now
start receiving tokens.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Step 2: Registering the application with the ACS&lt;br&gt;
&lt;/strong&gt;Again nothing special here. You have to create a scope for the application
in your ACS as well as configure the the encrypting certificate to match the certificate
you configured in step 1.
&lt;/p&gt;
&lt;p&gt;
The interesting part is the rule definition. When you add a new rule, you can now
select the Live ID as an input claim and map it to whatever output claim you want.
Examples would be to map it to a group (which in turn can map to permissions) or to
tunnel the ID to the relying party (either as-is or as a different claim). The following
screenshot shows a rule that transforms the Live ID to a standard name claim:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://www.leastprivilege.com/content/binary/rule_550.png" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Step 3: Triggering Live ID login&lt;br&gt;
&lt;/strong&gt;The last step is to trigger the Live ID handshake in your app. The ACS’ endpoint
for federation with Live ID is
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
&lt;em&gt;https://accesscontrol.windows.net/passivests/{solutionName}/LiveFederation.aspx&lt;/em&gt;
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
In the query string for this endpoint you have to provide the scope and the identity
provider name (plus an optional reply-to address), like this:
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
&lt;em&gt;wa=wsignin1.0&amp;amp;wtrealm={scope}&amp;amp;wreply={replyTo}&amp;amp;whr={identityProvider}&lt;/em&gt;
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
Unfortunately Geneva framework currently does not support the &lt;em&gt;whr&lt;/em&gt; parameter
directly, which means you have to construct the URL manually. Geneva’s &lt;em&gt;SignInRequest&lt;/em&gt; class
can help here. The following code does the redirect to the ACS and Live ID:
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span lang=EN-US style="COLOR: blue; FONT-FAMILY: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;protected&lt;/span&gt;&lt;span lang=EN-US style="FONT-FAMILY: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt; &lt;span style="COLOR: blue"&gt;void&lt;/span&gt; _lnkLiveLogin_Click(&lt;span style="COLOR: blue"&gt;object&lt;/span&gt; sender, &lt;span style="COLOR: #2b91af"&gt;EventArgs&lt;/span&gt; e)&lt;br&gt;
{&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;string&lt;/span&gt; homeRealm
= &lt;span style="COLOR: #a31515"&gt;"http://login.live.com"&lt;/span&gt;;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;string&lt;/span&gt; scope
= &lt;span style="COLOR: #a31515"&gt;"http://myrp/default.aspx"&lt;/span&gt;;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;string&lt;/span&gt; acs
= &lt;span style="COLOR: #a31515"&gt;"https://accesscontrol.windows.net/passivests/{solutionName}/LiveFederation.aspx"&lt;/span&gt;;&lt;br&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;var&lt;/span&gt; request
= &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;SignInRequestMessage&lt;/span&gt;(&lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;Uri&lt;/span&gt;(acs),
scope);&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;request.Parameters.Add(&lt;span style="COLOR: #a31515"&gt;"whr"&lt;/span&gt;,
homeRealm);&lt;br&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Response.Redirect(request.RequestUrl);&lt;br&gt;
}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
After all redirects have occurred you end up back in your application with a populated &lt;em&gt;IClaimsPrincipal&lt;/em&gt; that
contains the claims that you configured in your ACS scope. Adding new identity providers
would be a matter of registering them with your ACS and changing the value of the
home realm parameter.
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=0fc01cc6-c15a-4b82-af84-82e3021f2555" /&gt;</description>
      <category>ASP.NET</category>
      <category>IdentityModel</category>
      <category>WCF</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=172e13c3-8011-48fd-b209-895e2e545247</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=172e13c3-8011-48fd-b209-895e2e545247</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <title>Display Tokens &amp;amp; Geneva</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=172e13c3-8011-48fd-b209-895e2e545247</guid>
      <link>http://www.leastprivilege.com/DisplayTokensAmpGeneva.aspx</link>
      <pubDate>Fri, 26 Dec 2008 10:44:36 GMT</pubDate>
      <description>&lt;p&gt;
What are display tokens? In short: They allow an STS to pass some or all claims back
to the client in a way that the client can read them. This differs from the “real”
claims which are part of the security token and are encrypted for the relying party.
A popular example of an application that consumes display claims is the CardSpace
identity selector that allows you to preview the claims before they get send to the
RP.
&lt;/p&gt;
&lt;p&gt;
Look &lt;a href="http://www.identityblog.com/wp-content/resources/profile/InfoCard-Profile-v1-TechRef.pdf"&gt;here&lt;/a&gt; in
section 4.3.6 for the technical specification and &lt;a href="http://blogs.msdn.com/vbertocci/archive/2007/10/31/on-displaytoken.aspx"&gt;here&lt;/a&gt; for
a good discussion of use and abuse of display tokens.
&lt;/p&gt;
&lt;p&gt;
In Geneva, display tokens are represented by the &lt;em&gt;DisplayToken&lt;/em&gt; class (which
is a container for &lt;em&gt;DisplayClaim&lt;/em&gt;s). The &lt;em&gt;SecurityTokenService&lt;/em&gt; class
has an overridable method called &lt;em&gt;GetDisplayToken&lt;/em&gt; in which the &lt;em&gt;DisplayToken&lt;/em&gt; gets
constructed to be put into the RSTR (see also &lt;a href="http://www.leastprivilege.com/SAMLTokenCreationInAGenevaSTS.aspx"&gt;here&lt;/a&gt;).
This method internally calls &lt;em&gt;GetDisplayClaimsForSubject&lt;/em&gt; on the default &lt;em&gt;ClaimsMapper&lt;/em&gt; that
is configured on the &lt;em&gt;SecurityTokenServiceConfiguration &lt;/em&gt;of your STS&lt;em&gt;. &lt;/em&gt;This
default claims mapper simply takes all claims found in the subject and emits them
as display claims. For some standard claims the mapper already knows the display name
and description – the others are emitted without further descriptions. 
&lt;/p&gt;
&lt;p&gt;
It seems that in the future you want to extend the &lt;em&gt;ClaimsMapper&lt;/em&gt; class for
your own display token work – for now the class does not seem to be ready for that.
Another behavior of the &lt;strong&gt;current&lt;/strong&gt; Geneva bits is, that display claims
are enabled by default – that means if your user requests them (more on that later)
all claims will be emitted in clear to the user. This may or may not be what you want.
In &lt;strong&gt;future&lt;/strong&gt; builds of Geneva, the display token feature will be opt-in.
&lt;/p&gt;
&lt;p&gt;
But if you are building an STS with the current bits – you almost certainly want to
take control over display token generation, because e.g.
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
maybe you emit claims that the user should not be able to see. 
&lt;li&gt;
if you want to emit a display token and you use non-standard claims, you want to provide
display names and descriptions.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Generating a display token&lt;br&gt;
&lt;/strong&gt;Currently the easiest way to do this is to override the above mentioned &lt;em&gt;GetDisplayToken&lt;/em&gt; method
in your STS, e.g.:
&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"&gt;
&lt;span lang="EN-US" style="color: blue; font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;protected&lt;/span&gt;&lt;span lang="EN-US" style="font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt; &lt;span style="color: blue"&gt;override&lt;/span&gt; DisplayToken
GetDisplayToken(&lt;br&gt;
&amp;nbsp; &lt;span style="color: blue"&gt;string&lt;/span&gt; requestedDisplayTokenLanguage, IClaimsIdentity
subject)&lt;br&gt;
{&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;var&lt;/span&gt; displayClaims
= &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;DisplayClaim&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;new&lt;/span&gt; DisplayClaim(WSIdentityConstants.ClaimTypes.GivenName, &lt;span style="color: #a31515"&gt;"FirstName"&lt;/span&gt;, &lt;span style="color: #a31515"&gt;"First
Name"&lt;/span&gt;, 
&lt;br&gt;
&lt;/span&gt;&lt;span lang="EN-US" style="font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;subject.GetClaimValue(WSIdentityConstants.ClaimTypes.GivenName)),&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;new&lt;/span&gt; DisplayClaim(WSIdentityConstants.ClaimTypes.Surname, &lt;span style="color: #a31515"&gt;"LastName"&lt;/span&gt;, &lt;span style="color: #a31515"&gt;"Last
Name"&lt;/span&gt;, 
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;subject.GetClaimValue(WSIdentityConstants.ClaimTypes.Surname)),&lt;br&gt;
&lt;/span&gt;&lt;span lang="EN-US" style="font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;new&lt;/span&gt; DisplayClaim(WSIdentityConstants.ClaimTypes.Name, &lt;span style="color: #a31515"&gt;"Name"&lt;/span&gt;, &lt;span style="color: #a31515"&gt;"Name"&lt;/span&gt;, 
&lt;br&gt;
&lt;/span&gt;&lt;span lang="EN-US" style="font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;subject.GetClaimValue(WSIdentityConstants.ClaimTypes.Email)),&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;?xml:namespace prefix = o /&gt;};&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"&gt;
&lt;span lang="EN-US" style="font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;return&lt;/span&gt; &lt;span style="color: blue"&gt;new&lt;/span&gt; DisplayToken(requestedDisplayTokenLanguage,
displayClaims);&lt;br&gt;
}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
(of course – if you want to localize the claims – you should honor the &lt;em&gt;requestDisplayTokenLanguage&lt;/em&gt; parameter)
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Requesting and consuming a display token&lt;br&gt;
&lt;/strong&gt;The above &lt;em&gt;GetDisplayToken&lt;/em&gt; method gets only called if a display token
is requested. This is done by adding a &lt;em&gt;&amp;lt;RequestDisplayToken /&amp;gt;&lt;/em&gt; element
to the RST – either by adding this element to the additional request parameters collection
on the binding or by explicitly setting the &lt;em&gt;DisplayTokenLanguage&lt;/em&gt; property
on the &lt;em&gt;RequestSecurityToken&lt;/em&gt; class (e.g. when requesting a token using &lt;em&gt;WSTrustClient&lt;/em&gt;).
&lt;/p&gt;
&lt;p&gt;
The returned display token can be found in the RSTR on the &lt;em&gt;RequestedDisplayToken&lt;/em&gt; property.
The following code snippet shows both the request and the consumption (some details
omitted):
&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"&gt;
&lt;span lang="EN-US" style="color: #2b91af; font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;WSTrustClient&lt;/span&gt;&lt;span lang="EN-US" style="font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt; client
= &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;WSTrustClient&lt;/span&gt;(&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;GetStsBinding(),&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;GetStsEndpoint(),&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;TrustVersion&lt;/span&gt;.WSTrust13,&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;GetStsCredentials());&lt;br&gt;
&lt;br&gt;
&lt;span style="color: #2b91af"&gt;RequestSecurityToken&lt;/span&gt; rst = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;RequestSecurityToken&lt;/span&gt;();&lt;br&gt;
rst.RequestType = &lt;span style="color: #2b91af"&gt;WSTrust13Constants&lt;/span&gt;.&lt;span style="color: #2b91af"&gt;RequestTypes&lt;/span&gt;.Issue;&lt;br&gt;
rst.AppliesTo = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;EndpointAddress&lt;/span&gt;(rp);&lt;br&gt;
rst.TokenType = &lt;span style="color: #2b91af"&gt;Saml11SecurityTokenHandler&lt;/span&gt;.OasisWssSamlTokenProfile11;&lt;br&gt;
rst.DisplayTokenLanguage = &lt;span style="color: #a31515"&gt;"en"&lt;/span&gt;;&lt;br&gt;
&lt;br&gt;
&lt;span style="color: #2b91af"&gt;RequestSecurityTokenResponse&lt;/span&gt; rstr;&lt;br&gt;
client.Issue(rst, &lt;span style="color: blue"&gt;out&lt;/span&gt; rstr);&lt;br&gt;
&lt;br&gt;
&lt;span style="color: blue"&gt;foreach&lt;/span&gt; (&lt;span style="color: blue"&gt;var&lt;/span&gt; displayClaim &lt;span style="color: blue"&gt;in&lt;/span&gt; rstr.RequestedDisplayToken.DisplayClaims)&lt;br&gt;
{&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: blue"&gt;string&lt;/span&gt;.Format(&lt;span style="color: #a31515"&gt;"{0}:
{1} ({2})"&lt;/span&gt;,&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;displayClaim.DisplayTag,&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;displayClaim.Description,&lt;/span&gt;&lt;span lang="EN-US" style="font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;displayClaim.DisplayValue));&lt;/span&gt;&lt;span lang="EN-US" style="font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;}&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"&gt;
&lt;span style="font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;/span&gt;&lt;span lang="EN-US" style="font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&amp;nbsp;
&lt;/p&gt;
HTH &lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=172e13c3-8011-48fd-b209-895e2e545247" /&gt;</description>
      <category>ASP.NET</category>
      <category>WCF</category>
      <category>IdentityModel</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=58828c96-5682-4263-88ae-f5a7cc4ce062</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=58828c96-5682-4263-88ae-f5a7cc4ce062</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I thought as a little X-Mas present – I just zip up the current version of my IdentityModel2
solution and make it available for download <a href="http://www.leastprivilege.com/content/binary/LeastPrivilege.IdentityModel2.zip">here</a>.
It is barely tested (besides my own use cases which were the reason why I wrote most
of the code in the first place) so I thought I’d call it CTP1 and would appreciate
your feedback ;)
</p>
        <p>
What’s inside?
</p>
        <ul>
          <li>
a bunch of extension methods (for IPrincipal, IClaimsPrincipal, IClaimsIdentity, RSACryptoServiceProvider…) 
</li>
          <li>
a custom configuration section for easy certificate loading 
</li>
          <li>
a simple claims viewer for console, WinForms and ASP.NET 
</li>
          <li>
helpers for federating with the Access Control Service</li>
        </ul>
        <p>
Merry Xmas!
</p>
        <p>
 
</p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=58828c96-5682-4263-88ae-f5a7cc4ce062" />
      </body>
      <title>LeastPrivilege.IdentityModel2 Preview</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=58828c96-5682-4263-88ae-f5a7cc4ce062</guid>
      <link>http://www.leastprivilege.com/LeastPrivilegeIdentityModel2Preview.aspx</link>
      <pubDate>Thu, 25 Dec 2008 07:34:17 GMT</pubDate>
      <description>&lt;p&gt;
I thought as a little X-Mas present – I just zip up the current version of my IdentityModel2
solution and make it available for download &lt;a href="http://www.leastprivilege.com/content/binary/LeastPrivilege.IdentityModel2.zip"&gt;here&lt;/a&gt;.
It is barely tested (besides my own use cases which were the reason why I wrote most
of the code in the first place) so I thought I’d call it CTP1 and would appreciate
your feedback ;)
&lt;/p&gt;
&lt;p&gt;
What’s inside?
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
a bunch of extension methods (for IPrincipal, IClaimsPrincipal, IClaimsIdentity, RSACryptoServiceProvider…) 
&lt;li&gt;
a custom configuration section for easy certificate loading 
&lt;li&gt;
a simple claims viewer for console, WinForms and ASP.NET 
&lt;li&gt;
helpers for federating with the Access Control Service&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Merry Xmas!
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=58828c96-5682-4263-88ae-f5a7cc4ce062" /&gt;</description>
      <category>ASP.NET</category>
      <category>IdentityModel</category>
      <category>WCF</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=b5ecc9a4-4487-42fa-b7ef-da6f25cd9cbf</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=b5ecc9a4-4487-42fa-b7ef-da6f25cd9cbf</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
For a while I had some updates to the InfoCardSelector ASP.NET control sitting here
– thanks to <a href="http://www.codeplex.com/site/users/view/altair">altair</a> we
made some minor modifications, nothing critical. I finally <a href="http://www.codeplex.com/InfoCardSelector">uploaded</a> them
to Codeplex.
</p>
        <p>
However – this will be the last release of the control. It works as expected and will
be soon superseded by the InfoCard control in <a href="https://connect.microsoft.com/site/sitehome.aspx?SiteID=642">Geneva</a>.
</p>
        <p>
Have fun!
</p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=b5ecc9a4-4487-42fa-b7ef-da6f25cd9cbf" />
      </body>
      <title>Final Release of InfoCardSelector on Codeplex</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=b5ecc9a4-4487-42fa-b7ef-da6f25cd9cbf</guid>
      <link>http://www.leastprivilege.com/FinalReleaseOfInfoCardSelectorOnCodeplex.aspx</link>
      <pubDate>Tue, 16 Dec 2008 07:14:11 GMT</pubDate>
      <description>&lt;p&gt;
For a while I had some updates to the InfoCardSelector ASP.NET control sitting here
– thanks to &lt;a href="http://www.codeplex.com/site/users/view/altair"&gt;altair&lt;/a&gt; we
made some minor modifications, nothing critical. I finally &lt;a href="http://www.codeplex.com/InfoCardSelector"&gt;uploaded&lt;/a&gt; them
to Codeplex.
&lt;/p&gt;
&lt;p&gt;
However – this will be the last release of the control. It works as expected and will
be soon superseded by the InfoCard control in &lt;a href="https://connect.microsoft.com/site/sitehome.aspx?SiteID=642"&gt;Geneva&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
Have fun!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=b5ecc9a4-4487-42fa-b7ef-da6f25cd9cbf" /&gt;</description>
      <category>ASP.NET</category>
      <category>IdentityModel</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=c40dc8ee-d95c-433f-88eb-3aaba8356349</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=c40dc8ee-d95c-433f-88eb-3aaba8356349</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
A bunch of (ASP.NET) security tools got released over the weekend – highly recommended!
</p>
        <p>
Get more info from <a href="http://securitybuddha.com/2008/12/15/catnet-and-anti-xss-30-released-for-free/">Mark</a> and <a href="http://idunno.org/archive/2008/12/14/announcing-anticsrf-for-asp.net.aspx">Barry</a>.
</p>
        <p>
          <strong>CAT.NET V1 CTP</strong>
        </p>
        <blockquote>
          <p>
“CAT.NET is a snap-in to the Visual Studio IDE that helps you identify security flaws
within a managed code (C#, Visual Basic .NET, J#) application you are developing.
It does so by scanning the binary and/or assembly of the application, and tracing
the data flow among its statements, methods, and assemblies. This includes indirect
data types such as property assignments and instance tainting operations. The engine
works by reading the target assembly and all reference assemblies used in the application
-- module-by-module -- and then analyzing all of the methods contained within each.
It finally displays the issues its finds in a list that you can use to jump directly
to the places in your application's source code where those issues were found. The
following rules are currently support by this version of the tool. - Cross Site Scripting
- SQL Injection - Process Command Injection - File Canonicalization - Exception Information
- LDAP Injection - XPATH Injection - Redirection to User Controlled Site.”
</p>
        </blockquote>
        <p>
          <a href="http://www.microsoft.com/downloads/details.aspx?familyid=0178e2ef-9da8-445e-9348-c93f24cc9f9d&amp;displaylang=en&amp;tm">32
Bit</a> / <a href="http://www.microsoft.com/downloads/details.aspx?familyid=e0052bba-2d50-4214-b65b-37e5ef44f146&amp;displaylang=en&amp;tm">64
Bit</a></p>
        <p>
 
</p>
        <p>
          <strong>AntiXSS 3.0 Beta</strong>
        </p>
        <blockquote>
          <p>
“The Microsoft Anti-Cross Site Scripting Library V3.0 (Anti-XSS V3.0) is an encoding
library designed to help developers protect their ASP.NET web-based applications from
XSS attacks. It differs from most encoding libraries in that it uses the white-listing
technique -- sometimes referred to as the principle of inclusions -- to provide protection
against XSS attacks. This approach works by first defining a valid or allowable set
of characters, and encodes anything outside this set (invalid characters or potential
attacks). The white-listing approach provides several advantages over other encoding
schemes. New features in this version of the Microsoft Anti-Cross Site Scripting Library
include: - An expanded white list that supports more languages - Performance improvements
- Performance data sheets (in the online help) - Support for Shift_JIS encoding for
mobile browsers - A sample application - Security Runtime Engine (SRE) HTTP module.”
</p>
        </blockquote>
        <p>
          <a href="http://www.microsoft.com/downloads/details.aspx?familyid=051ee83c-5ccf-48ed-8463-02f56a6bfc09&amp;displaylang=en&amp;tm">download</a>
        </p>
        <p>
 
</p>
        <p>
          <strong>AntiCSRF</strong>
        </p>
        <blockquote>
          <p>
“AntiCSRF makes it easier for ASP.NET developers to guard themselves against Cross
Site Request Forgery. You'll no longer have to manually add and check protection tokens
to protected yourself against CSRF attacks.”
</p>
        </blockquote>
        <p>
          <a href="http://www.codeplex.com/AntiCSRF">Codeplex</a>
        </p>
        <p>
 
</p>
        <p>
Have fun!
</p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=c40dc8ee-d95c-433f-88eb-3aaba8356349" />
      </body>
      <title>ASP.NET Security Goodness</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=c40dc8ee-d95c-433f-88eb-3aaba8356349</guid>
      <link>http://www.leastprivilege.com/ASPNETSecurityGoodness.aspx</link>
      <pubDate>Mon, 15 Dec 2008 09:53:52 GMT</pubDate>
      <description>&lt;p&gt;
A bunch of (ASP.NET) security tools got released over the weekend – highly recommended!
&lt;/p&gt;
&lt;p&gt;
Get more info from &lt;a href="http://securitybuddha.com/2008/12/15/catnet-and-anti-xss-30-released-for-free/"&gt;Mark&lt;/a&gt; and &lt;a href="http://idunno.org/archive/2008/12/14/announcing-anticsrf-for-asp.net.aspx"&gt;Barry&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;CAT.NET V1 CTP&lt;/strong&gt; 
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
“CAT.NET is a snap-in to the Visual Studio IDE that helps you identify security flaws
within a managed code (C#, Visual Basic .NET, J#) application you are developing.
It does so by scanning the binary and/or assembly of the application, and tracing
the data flow among its statements, methods, and assemblies. This includes indirect
data types such as property assignments and instance tainting operations. The engine
works by reading the target assembly and all reference assemblies used in the application
-- module-by-module -- and then analyzing all of the methods contained within each.
It finally displays the issues its finds in a list that you can use to jump directly
to the places in your application's source code where those issues were found. The
following rules are currently support by this version of the tool. - Cross Site Scripting
- SQL Injection - Process Command Injection - File Canonicalization - Exception Information
- LDAP Injection - XPATH Injection - Redirection to User Controlled Site.”
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
&lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=0178e2ef-9da8-445e-9348-c93f24cc9f9d&amp;amp;displaylang=en&amp;amp;tm"&gt;32
Bit&lt;/a&gt; / &lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=e0052bba-2d50-4214-b65b-37e5ef44f146&amp;amp;displaylang=en&amp;amp;tm"&gt;64
Bit&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;AntiXSS 3.0 Beta&lt;/strong&gt;
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
“The Microsoft Anti-Cross Site Scripting Library V3.0 (Anti-XSS V3.0) is an encoding
library designed to help developers protect their ASP.NET web-based applications from
XSS attacks. It differs from most encoding libraries in that it uses the white-listing
technique -- sometimes referred to as the principle of inclusions -- to provide protection
against XSS attacks. This approach works by first defining a valid or allowable set
of characters, and encodes anything outside this set (invalid characters or potential
attacks). The white-listing approach provides several advantages over other encoding
schemes. New features in this version of the Microsoft Anti-Cross Site Scripting Library
include: - An expanded white list that supports more languages - Performance improvements
- Performance data sheets (in the online help) - Support for Shift_JIS encoding for
mobile browsers - A sample application - Security Runtime Engine (SRE) HTTP module.”
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
&lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=051ee83c-5ccf-48ed-8463-02f56a6bfc09&amp;amp;displaylang=en&amp;amp;tm"&gt;download&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;AntiCSRF&lt;/strong&gt;
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
“AntiCSRF makes it easier for ASP.NET developers to guard themselves against Cross
Site Request Forgery. You'll no longer have to manually add and check protection tokens
to protected yourself against CSRF attacks.”
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
&lt;a href="http://www.codeplex.com/AntiCSRF"&gt;Codeplex&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
Have fun!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=c40dc8ee-d95c-433f-88eb-3aaba8356349" /&gt;</description>
      <category>ASP.NET</category>
      <category>FX Security</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=1fc51a8d-447c-4b06-9494-0636954bd4f5</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=1fc51a8d-447c-4b06-9494-0636954bd4f5</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
In my <a href="http://www.leastprivilege.com/UsingTheNETAccessControlServiceWithGeneva.aspx">previous</a> post
I showed how to migrate the .NET Access Control Service SDK “CardSpaceCalculator”
sample to Geneva Framework. The way this sample is structured, it allows to authenticate
with the InfoCard that is associated with your solution account to access the service
via the ACS.
</p>
        <p>
While this is nice for learning purposes – it limits you to this single account. In
reality you want that your customers/partners federate with your ACS so you can give
them access to your services. The ACS will then broker the trust and act as a rules-based
claims generation engine.
</p>
        <p>
It turns out that when you have the sample up and running, you are already very close
to this scenario. How could this work in practice? This walkthrough basically documents
the steps I did to integrate a custom STS written with the Geneva framework. This
assumes you already have a working version of the SDK sample as well as a STS.
</p>
        <p>
          <strong>
          </strong> 
</p>
        <p>
          <strong>Step 1: Registering the partner’s STS at your Access Control Service<br /></strong>First you have to register the STS. This is done via the .NET Services portal.
Go to your scope in advanced mode and click the <em>Identity Issuers</em> link. You
need to specify three things:
</p>
        <ul>
          <li>
A display name for the STS. This name is also used for defining rules later on 
</li>
          <li>
The STS URI 
</li>
          <li>
The STS token signing certificate</li>
        </ul>
        <p>
          <img src="http://www.leastprivilege.com/content/binary/pic11.JPG" border="0" />
        </p>
        <p>
          <strong>Step 2: Adding your Access Control Service to the partner’s STS known list
of relying parties<br /></strong>The partner’s STS now has to be configured to issue tokens for the ACS. For
this purpose the partner needs to know the value of the AppliesTo header field (the
RP identitfier) and the public key of the ACS.
</p>
        <p>
The AppliesTo header will be: “http://accesscontrol.windows.net/sts/&lt;yoursolution&gt;/issued_for_certificate”.
</p>
        <p>
The encrypting certificate is not so obvious. It is basically the certificate that
you can pull from https://accesscontrol.windows.net – but automatic browser redirects
make that kinda hard (I forked mine from the custom IssuerNameRegistry I showed in
my last post). You can also use <a href="http://www.leastprivilege.com/DownloadingTheCertificateFromAnSSLSite.aspx">this</a> code
here to download the cert.
</p>
        <p>
          <strong>Step 3: Updating client configuration</strong>
          <br />
The next step is to update the client’s configuration to request a token from the
STS before requesting the token from the ACS. This is very simple – when you use the
SDK sample you will see a WCF custom binding with the name http://accesscontrol.windows.net/sts/&lt;solutionname&gt;/issued_for_certificate.
Since this binding is configured for issued tokens but no STS is specified the CardSpace
identity selector will pop up. When the partner STS issues cards, the user now only
has to select the right card.
</p>
        <p>
To configure a specific STS you have to add an &lt;issuer&gt; and &lt;issuerMetadata&gt;
element to the binding that points to the partner’s STS WS-Trust endpoint (along with
the right binding to authenticate with the STS). That’s it.
</p>
        <p>
          <strong>Step 4: Defining rules for the partner in the ACS<br /></strong>Now technically everything is set up. The last step would be to define rules
in your ACS for the partner accounts. Let’s say the partner STS includes a “department”
claim in the token. Now everybody in the department “Research” should have access
to the “Add” operation of the calculator. The corresponding rule would look like this
in the portal:
</p>
        <p>
          <img src="http://www.leastprivilege.com/content/binary/pic21.JPG" border="0" />
        </p>
        <p>
Another cool feature of the ACS rules engine is to copy input to output claims. This
allows to tunnel claims from the partner’s STS to your service. You accomplish this
by setting the “copy input value” option in the rules dialog.
</p>
        <p>
          <img src="http://www.leastprivilege.com/content/binary/pic31.JPG" border="0" />
        </p>
        <p>
I’d also recommend checking out Justin’s drill down talk from PDC to learn about the
forward chaining capabilities of the rules engine.
</p>
        <p>
HTH
</p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=1fc51a8d-447c-4b06-9494-0636954bd4f5" />
      </body>
      <title>Federating with the .NET Access Control Service</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=1fc51a8d-447c-4b06-9494-0636954bd4f5</guid>
      <link>http://www.leastprivilege.com/FederatingWithTheNETAccessControlService.aspx</link>
      <pubDate>Thu, 11 Dec 2008 19:46:34 GMT</pubDate>
      <description>&lt;p&gt;
In my &lt;a href="http://www.leastprivilege.com/UsingTheNETAccessControlServiceWithGeneva.aspx"&gt;previous&lt;/a&gt; post
I showed how to migrate the .NET Access Control Service SDK “CardSpaceCalculator”
sample to Geneva Framework. The way this sample is structured, it allows to authenticate
with the InfoCard that is associated with your solution account to access the service
via the ACS.
&lt;/p&gt;
&lt;p&gt;
While this is nice for learning purposes – it limits you to this single account. In
reality you want that your customers/partners federate with your ACS so you can give
them access to your services. The ACS will then broker the trust and act as a rules-based
claims generation engine.
&lt;/p&gt;
&lt;p&gt;
It turns out that when you have the sample up and running, you are already very close
to this scenario. How could this work in practice? This walkthrough basically documents
the steps I did to integrate a custom STS written with the Geneva framework. This
assumes you already have a working version of the SDK sample as well as a STS.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;&lt;/strong&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Step 1: Registering the partner’s STS at your Access Control Service&lt;br&gt;
&lt;/strong&gt;First you have to register the STS. This is done via the .NET Services portal.
Go to your scope in advanced mode and click the &lt;em&gt;Identity Issuers&lt;/em&gt; link. You
need to specify three things:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
A display name for the STS. This name is also used for defining rules later on 
&lt;li&gt;
The STS URI 
&lt;li&gt;
The STS token signing certificate&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;img src="http://www.leastprivilege.com/content/binary/pic11.JPG" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Step 2: Adding your Access Control Service to the partner’s STS known list
of relying parties&lt;br&gt;
&lt;/strong&gt;The partner’s STS now has to be configured to issue tokens for the ACS. For
this purpose the partner needs to know the value of the AppliesTo header field (the
RP identitfier) and the public key of the ACS.
&lt;/p&gt;
&lt;p&gt;
The AppliesTo header will be: “http://accesscontrol.windows.net/sts/&amp;lt;yoursolution&amp;gt;/issued_for_certificate”.
&lt;/p&gt;
&lt;p&gt;
The encrypting certificate is not so obvious. It is basically the certificate that
you can pull from https://accesscontrol.windows.net – but automatic browser redirects
make that kinda hard (I forked mine from the custom IssuerNameRegistry I showed in
my last post). You can also use &lt;a href="http://www.leastprivilege.com/DownloadingTheCertificateFromAnSSLSite.aspx"&gt;this&lt;/a&gt; code
here to download the cert.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Step 3: Updating client configuration&lt;/strong&gt;
&lt;br&gt;
The next step is to update the client’s configuration to request a token from the
STS before requesting the token from the ACS. This is very simple – when you use the
SDK sample you will see a WCF custom binding with the name http://accesscontrol.windows.net/sts/&amp;lt;solutionname&amp;gt;/issued_for_certificate.
Since this binding is configured for issued tokens but no STS is specified the CardSpace
identity selector will pop up. When the partner STS issues cards, the user now only
has to select the right card.
&lt;/p&gt;
&lt;p&gt;
To configure a specific STS you have to add an &amp;lt;issuer&amp;gt; and &amp;lt;issuerMetadata&amp;gt;
element to the binding that points to the partner’s STS WS-Trust endpoint (along with
the right binding to authenticate with the STS). That’s it.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Step 4: Defining rules for the partner in the ACS&lt;br&gt;
&lt;/strong&gt;Now technically everything is set up. The last step would be to define rules
in your ACS for the partner accounts. Let’s say the partner STS includes a “department”
claim in the token. Now everybody in the department “Research” should have access
to the “Add” operation of the calculator. The corresponding rule would look like this
in the portal:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://www.leastprivilege.com/content/binary/pic21.JPG" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
Another cool feature of the ACS rules engine is to copy input to output claims. This
allows to tunnel claims from the partner’s STS to your service. You accomplish this
by setting the “copy input value” option in the rules dialog.
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://www.leastprivilege.com/content/binary/pic31.JPG" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
I’d also recommend checking out Justin’s drill down talk from PDC to learn about the
forward chaining capabilities of the rules engine.
&lt;/p&gt;
&lt;p&gt;
HTH
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=1fc51a8d-447c-4b06-9494-0636954bd4f5" /&gt;</description>
      <category>ASP.NET</category>
      <category>IdentityModel</category>
      <category>WCF</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=889453ef-2c4f-45ac-80bd-c0c593026c54</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=889453ef-2c4f-45ac-80bd-c0c593026c54</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <title>Downloading the Certificate from an SSL Site</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=889453ef-2c4f-45ac-80bd-c0c593026c54</guid>
      <link>http://www.leastprivilege.com/DownloadingTheCertificateFromAnSSLSite.aspx</link>
      <pubDate>Thu, 11 Dec 2008 19:30:47 GMT</pubDate>
      <description>&lt;p&gt;
Sometimes this is very useful– you point the below code to a server and get the configured
SSL certificate in return. After that you could import the cert into the local store
or save it as a file (via the &lt;em&gt;RawData&lt;/em&gt; property).
&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"&gt;
&lt;span lang="EN-US" style="color: blue; font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;public&lt;/span&gt;&lt;span lang="EN-US" style="font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt; &lt;span style="color: blue"&gt;static&lt;/span&gt; &lt;span style="color: #2b91af"&gt;X509Certificate2&lt;/span&gt; DownloadSslCertificate(&lt;span style="color: blue"&gt;string&lt;/span&gt; machinename, &lt;span style="color: blue"&gt;int&lt;/span&gt; port)&lt;br&gt;
{&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;using&lt;/span&gt; (&lt;span style="color: #2b91af"&gt;TcpClient&lt;/span&gt; client
= &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;TcpClient&lt;/span&gt;())&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;client.Connect(machinename,
port);&lt;br&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;SslStream&lt;/span&gt; ssl
= &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;SslStream&lt;/span&gt;(client.GetStream());&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;?xml:namespace prefix = o /&gt;ssl.AuthenticateAsClient(machinename);&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"&gt;
&lt;span lang="EN-US" style="font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;return&lt;/span&gt; &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;X509Certificate2&lt;/span&gt;(ssl.RemoteCertificate);&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br&gt;
}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
HTH
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=889453ef-2c4f-45ac-80bd-c0c593026c54" /&gt;</description>
      <category>Misc</category>
      <category>IdentityModel</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=d0b99d26-1cd5-467c-937c-f765efc3319d</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=d0b99d26-1cd5-467c-937c-f765efc3319d</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <title>Using the .NET Access Control Service with Geneva</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=d0b99d26-1cd5-467c-937c-f765efc3319d</guid>
      <link>http://www.leastprivilege.com/UsingTheNETAccessControlServiceWithGeneva.aspx</link>
      <pubDate>Thu, 11 Dec 2008 09:20:45 GMT</pubDate>
      <description>&lt;p&gt;
If you haven’t checked out the .NET Access Control Service yet – I can highly recommend
it!
&lt;/p&gt;
&lt;p&gt;
Justin did two talks about it at PDC:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="http://mschnlnine.vo.llnwd.net/d1/pdc08/WMV-HQ/BB55.wmv"&gt;Access Control Service
in .NET Services&lt;/a&gt;&amp;nbsp; 
&lt;li&gt;
&lt;a href="http://mschnlnine.vo.llnwd.net/d1/pdc08/WMV-HQ/BB28.wmv"&gt;Access Control Service
Drilldown&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
In the 2nd talk Justin showed how to use and process claims coming from the ACS rules
engine in your own services. You can find this code in the “CardSpace Calculator”
sample in the ACS SDK.
&lt;/p&gt;
&lt;p&gt;
The sample uses the “old” WCF plumbing to process tokens and create claims based on
that. I wanted to find out what has to be done to migrate the sample to use Geneva. 
&lt;/p&gt;
&lt;p&gt;
First let’s have a look at what you want to accomplish with such a scenario:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
your clients live in a different trust domain as your service 
&lt;li&gt;
to federate these two domains, you do the following 
&lt;ul&gt;
&lt;li&gt;
register your client’s identity provider (Live ID, Geneva Server/Framework, other
WS-Trust 1.3 compat STS) at the ACS 
&lt;li&gt;
your client obtains a token from the ACS (by sending their identity token) 
&lt;li&gt;
this token is used to authenticate with your service 
&lt;li&gt;
your service accepts tokens from the ACS and uses their claims for identity related
work&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
For your service this means the following:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
accept tokens that are signed by the ACS 
&lt;li&gt;
make sure the issuer of that token is your personal instance of the ACS (http://accesscontrol.windows.net/yoursolution)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
In Geneva terms this boils down to the following pieces of plumbing:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
issuer name registry that knows about the ACS issuer certificate 
&lt;li&gt;
security token handler that check the SAML issuer name&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;strong&gt;Issuer Registry&lt;br&gt;
&lt;/strong&gt;There are two ways to accomplish this. Either you use the standard ConfigurationBasedIssuerNameRegistry
and add the ACS issuer thumbprint to it:
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span lang=EN-US style="COLOR: blue; FONT-FAMILY: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;&amp;lt;&lt;/span&gt;&lt;span lang=EN-US style="COLOR: #a31515; FONT-FAMILY: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;microsoft.identityModel&lt;/span&gt;&lt;span lang=EN-US style="COLOR: blue; FONT-FAMILY: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span lang=EN-US style="COLOR: #a31515; FONT-FAMILY: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;issuerNameRegistry&lt;/span&gt;&lt;span lang=EN-US style="COLOR: blue; FONT-FAMILY: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt; &lt;/span&gt;&lt;span lang=EN-US style="COLOR: red; FONT-FAMILY: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;type&lt;/span&gt;&lt;span lang=EN-US style="COLOR: blue; FONT-FAMILY: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;=&lt;/span&gt;&lt;span lang=EN-US style="FONT-FAMILY: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;"…&lt;span style="COLOR: blue"&gt;ConfigurationBasedIssuerNameRegistry&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;trustedIssuers&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;add&lt;/span&gt;&lt;span style="COLOR: blue"&gt; &lt;/span&gt;&lt;span style="COLOR: red"&gt;name&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=http://accesscontrol.windows.net&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="COLOR: red"&gt;thumbprint&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;416E6FA5D982B096931FBF42C4A3DCD608856C95&lt;/span&gt;"&lt;span style="COLOR: blue"&gt; /&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;trustedIssuers&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;issuerNameRegistry&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;br&gt;
&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;microsoft.identityModel&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&lt;?xml:namespace prefix = o /&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
Or you write a custom registry that has the ACS issuer baked in:
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span lang=EN-US style="COLOR: blue; FONT-FAMILY: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;class&lt;/span&gt;&lt;span lang=EN-US style="FONT-FAMILY: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt; &lt;span style="COLOR: #2b91af"&gt;AccessControlServiceIssuerRegistry&lt;/span&gt; : &lt;span style="COLOR: #2b91af"&gt;IssuerNameRegistry&lt;br&gt;
&lt;/span&gt;{&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;public&lt;/span&gt; &lt;span style="COLOR: blue"&gt;override&lt;/span&gt; &lt;span style="COLOR: blue"&gt;string&lt;/span&gt; GetIssuerName(&lt;span style="COLOR: #2b91af"&gt;SecurityToken&lt;/span&gt; securityToken)&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;{&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;X509SecurityToken&lt;/span&gt; token
= securityToken &lt;span style="COLOR: blue"&gt;as&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;X509SecurityToken&lt;/span&gt;;&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;if&lt;/span&gt; (token
== &lt;span style="COLOR: blue"&gt;null&lt;/span&gt;)&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;throw&lt;/span&gt; &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;SecurityTokenException&lt;/span&gt;(&lt;span style="COLOR: #a31515"&gt;"Token
is not a X509 Security Token"&lt;/span&gt;);&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;var&lt;/span&gt; cert
= token.Certificate;&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;if&lt;/span&gt; (cert.Thumbprint.Equals(&lt;span style="COLOR: #a31515"&gt;"416E6FA5D982B096931FBF42C4A3DCD608856C95"&lt;/span&gt;, &lt;span style="COLOR: #2b91af"&gt;StringComparison&lt;/span&gt;.OrdinalIgnoreCase))&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;{&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;return&lt;/span&gt; &lt;span style="COLOR: #a31515"&gt;"http://accesscontrol.windows.net"&lt;/span&gt;;&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;}&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;throw&lt;/span&gt; &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;SecurityTokenException&lt;/span&gt;(&lt;span style="COLOR: #a31515"&gt;"Token
not issued by access control service"&lt;/span&gt;);&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;}&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;}&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Security Token Handler&lt;/strong&gt;
&lt;br&gt;
Once you trust the issuer, you also have to make sure that the token got issued by
your personal instance of the ACS. This is done by checking the SAML issuer name information
in the token. This is the job of a custom security token handler – you can simply
derive from the existing &lt;em&gt;Saml11SecurityTokenHandler&lt;/em&gt; and inject this logic
in the &lt;em&gt;ValidateToken&lt;/em&gt; method.
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span lang=EN-US style="COLOR: blue; FONT-FAMILY: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;class&lt;/span&gt;&lt;span lang=EN-US style="FONT-FAMILY: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt; &lt;span style="COLOR: #2b91af"&gt;AccessControlServiceSaml11SecurityTokenHandler&lt;/span&gt; : &lt;span style="COLOR: #2b91af"&gt;Saml11SecurityTokenHandler&lt;br&gt;
&lt;/span&gt;{&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;string&lt;/span&gt; _solution;&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;public&lt;/span&gt; AccessControlServiceSaml11SecurityTokenHandler(&lt;span style="COLOR: blue"&gt;string&lt;/span&gt; solution) 
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : &lt;span style="COLOR: blue"&gt;base&lt;/span&gt;()&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;_solution
= solution;&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;public&lt;/span&gt; &lt;span style="COLOR: blue"&gt;override&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;ClaimsIdentityCollection&lt;/span&gt; ValidateToken(&lt;span style="COLOR: #2b91af"&gt;SecurityToken&lt;/span&gt; token)&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;var&lt;/span&gt; identities
= &lt;span style="COLOR: blue"&gt;base&lt;/span&gt;.ValidateToken(token);&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;identities[0].DemandClaim(&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;ClaimTypes&lt;/span&gt;.SamlIssuerName,&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;"http://accesscontrol.windows.net/"&lt;/span&gt; +
_solution);&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;return&lt;/span&gt; identities;&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;span style="COLOR: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;}&lt;span style="COLOR: #2b91af"&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Bringing the pieces together&lt;br&gt;
&lt;/strong&gt;You can now wire up the two custom components using the &lt;em&gt;FederatedServiceCredentials&lt;/em&gt; class
like this:
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span lang=EN-US style="COLOR: #2b91af; FONT-FAMILY: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;ServiceHost&lt;/span&gt;&lt;span lang=EN-US style="FONT-FAMILY: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt; host
= &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;ServiceHost&lt;/span&gt;(&lt;span style="COLOR: blue"&gt;typeof&lt;/span&gt;(&lt;span style="COLOR: #2b91af"&gt;CalculatorService&lt;/span&gt;));&lt;br&gt;
&lt;br&gt;
&lt;span style="COLOR: blue"&gt;var&lt;/span&gt; handlers = &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;SecurityTokenHandlerCollection&lt;/span&gt;();&lt;br&gt;
handlers.Add(&lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;AccessControlServiceSaml11SecurityTokenHandler&lt;/span&gt;(&lt;span style="COLOR: #a31515"&gt;"leastprivilege"&lt;/span&gt;));&lt;br&gt;
&lt;br&gt;
&lt;span style="COLOR: #2b91af"&gt;FederatedServiceCredentials&lt;/span&gt;.ConfigureServiceHost(&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;host,&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;handlers,&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;AccessControlServiceIssuerRegistry&lt;/span&gt;(),&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;TimeSpan&lt;/span&gt;.FromMinutes(5));&lt;br&gt;
&lt;br&gt;
&lt;span style="COLOR: #2b91af"&gt;FederatedServiceCredentials&lt;/span&gt;.ConfigureServiceHost(host);&lt;br&gt;
host.Open();&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
Another option would be to use the configuration file – but in this case we somehow
have to transfer the solution name to the security token handler. Geneva security
token handlers have a standard configuration extensibility hook that we can use to
accomplish this (not very obvious at the beginning – but makes sense ;).
&lt;/p&gt;
&lt;p&gt;
Let’s say our configuration should look like this:
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span lang=EN-US style="COLOR: blue; FONT-FAMILY: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;&amp;lt;&lt;/span&gt;&lt;span lang=EN-US style="COLOR: #a31515; FONT-FAMILY: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;microsoft.identityModel&lt;/span&gt;&lt;span lang=EN-US style="COLOR: blue; FONT-FAMILY: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span lang=EN-US style="COLOR: #a31515; FONT-FAMILY: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;issuerNameRegistry &lt;/span&gt;&lt;span lang=EN-US style="COLOR: red; FONT-FAMILY: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;type&lt;/span&gt;&lt;span lang=EN-US style="COLOR: blue; FONT-FAMILY: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;=&lt;/span&gt;&lt;span lang=EN-US style="FONT-FAMILY: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;"&lt;span style="COLOR: blue"&gt;LeastPrivilege.AccessControlServiceIssuerRegistry,
Service&lt;/span&gt;"&lt;span style="COLOR: blue"&gt; /&amp;gt;&lt;br&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;securityTokenHandlers&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;clear&lt;/span&gt;&lt;span style="COLOR: blue"&gt; /&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;add&lt;/span&gt;&lt;span style="COLOR: blue"&gt; &lt;/span&gt;&lt;span style="COLOR: red"&gt;type&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;LeastPrivilege.AccessControlServiceSaml11SecurityTokenHandler,
Service&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;accessControlServiceTokenRequirement&lt;/span&gt;&lt;span style="COLOR: blue"&gt; &lt;/span&gt;&lt;span style="COLOR: red"&gt;solutionName&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;leastprivilege&lt;/span&gt;"&lt;span style="COLOR: blue"&gt; /&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;add&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;securityTokenHandlers&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;br&gt;
&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;microsoft.identityModel&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
To make the token handler aware of this sub config element, you have to add a new
constructor to the token handler like this:
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span lang=EN-US style="COLOR: blue; FONT-FAMILY: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;public&lt;/span&gt;&lt;span lang=EN-US style="FONT-FAMILY: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt; AccessControlServiceSaml11SecurityTokenHandler(&lt;span style="COLOR: #2b91af"&gt;XmlElement&lt;/span&gt; customConfigElement)&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;: &lt;span style="COLOR: blue"&gt;base&lt;/span&gt;()&lt;br&gt;
{&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;if&lt;/span&gt; (customConfigElement.LocalName
!= &lt;span style="COLOR: #a31515"&gt;"accessControlServiceTokenRequirement"&lt;/span&gt;)&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;throw&lt;/span&gt; &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;InvalidOperationException&lt;/span&gt;(&lt;span style="COLOR: #a31515"&gt;"accessControlServiceTokenRequirement
expected"&lt;/span&gt;);&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;var&lt;/span&gt; solutionAttr
= customConfigElement.Attributes[&lt;span style="COLOR: #a31515"&gt;"solutionName"&lt;/span&gt;];&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;if&lt;/span&gt; (solutionAttr
== &lt;span style="COLOR: blue"&gt;null&lt;/span&gt;)&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;throw&lt;/span&gt; &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;InvalidOperationException&lt;/span&gt;(&lt;span style="COLOR: #a31515"&gt;"solution
name expected"&lt;/span&gt;);&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;_solution = solutionAttr.Value;&lt;br&gt;
}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
(if you also need support for the &lt;em&gt;samlSecurityTokenRequirement&lt;/em&gt; element, you
can manually call &lt;em&gt;LoadSamlTokenAuthenticatorRequirement&lt;/em&gt; on the &lt;em&gt;SecurityTokenHandlerElement&lt;/em&gt; class).
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.leastprivilege.com/content/binary/CardSpaceCalculatorGeneva.zip"&gt;Here&lt;/a&gt; you
can find the complete code – to get it working I’d suggest you first get the original
SDK sample up and running. After that you have to make the necessary adjustments in
my code (solution name, certificates and URIs).
&lt;/p&gt;
&lt;p&gt;
HTH
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=d0b99d26-1cd5-467c-937c-f765efc3319d" /&gt;</description>
      <category>ASP.NET</category>
      <category>IdentityModel</category>
      <category>WCF</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=601698a7-d034-454d-8557-ed97fe31a01e</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=601698a7-d034-454d-8557-ed97fe31a01e</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <title>LeastPrivilege.IdentityModel v2</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=601698a7-d034-454d-8557-ed97fe31a01e</guid>
      <link>http://www.leastprivilege.com/LeastPrivilegeIdentityModelV2.aspx</link>
      <pubDate>Sun, 07 Dec 2008 16:49:10 GMT</pubDate>
      <description>&lt;p&gt;
Looking at the download numbers, my &lt;a href="http://www.leastprivilege.com/identityModel"&gt;add-on
library&lt;/a&gt; for System.IdentityModel was quite popular. Some days ago I started looking
the code to see what could be still useful in the face of Geneva.
&lt;/p&gt;
&lt;p&gt;
The good news is, that a lot of my helper classes are not necessary anymore thanks
to the easier claims model in Geneva. Still I think that most of the time you have
to wrap the raw &lt;em&gt;IClaimsPrincipal&lt;/em&gt; with more domain specific functionality.
Since my current project makes heavy use of Geneva I began compiling a set of classes
that made my life easier while working with the Geneva framework.
&lt;/p&gt;
&lt;p&gt;
Like in the first release, I added a bunch of extensions methods that make finding
and demanding claims easier. This is mostly syntactic sugar because the new model
is very LINQ friendly and you can easily write the queries yourself – but it makes
the code easier to read IMO. At the heart of all functionality is this extension method:
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span lang=EN-US style="COLOR: blue; FONT-FAMILY: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;public&lt;/span&gt;&lt;span lang=EN-US style="FONT-FAMILY: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt; &lt;span style="COLOR: blue"&gt;static&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="COLOR: #2b91af"&gt;Claim&lt;/span&gt;&amp;gt;
FindClaims(&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;this&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;IClaimsIdentity&lt;/span&gt; identity, &lt;span style="COLOR: #2b91af"&gt;Predicate&lt;/span&gt;&amp;lt;&lt;span style="COLOR: #2b91af"&gt;Claim&lt;/span&gt;&amp;gt;
predicate)&lt;br&gt;
{&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;return&lt;/span&gt; &lt;span style="COLOR: blue"&gt;from&lt;/span&gt; claim &lt;span style="COLOR: blue"&gt;in&lt;/span&gt; identity.Claims&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;where&lt;/span&gt; predicate(claim)&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;select&lt;/span&gt; claim;&lt;br&gt;&lt;?xml:namespace prefix = o /&gt;
}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
This allows layering all kinds of higher level functionality on top of both &lt;em&gt;IClaimsIdentity&lt;/em&gt; and &lt;em&gt;IClaimsPrincipal, &lt;/em&gt;e.g:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;FindClaims(commonly used parameters)&lt;br&gt;
&lt;/em&gt;&lt;/strong&gt;Returns a (possibly empty) list of claims. 
&lt;li&gt;
&lt;em&gt;&lt;strong&gt;DemandClaim(commonly user parameters)&lt;/strong&gt;&lt;/em&gt;
&lt;br&gt;
Throws a SecurityException if a specified claim is not found 
&lt;li&gt;
&lt;em&gt;&lt;strong&gt;GetClaimValue / TryGetClaimValue&lt;/strong&gt;&lt;/em&gt;
&lt;br&gt;
Returns the value of a specified claim&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
..and on top of that it is very easy to add business problem centric functionality.
&lt;/p&gt;
&lt;p&gt;
This allows me to write code like this:
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span lang=EN-US style="COLOR: blue; FONT-FAMILY: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;var&lt;/span&gt;&lt;span lang=EN-US style="FONT-FAMILY: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt; principal
= &lt;span style="COLOR: #2b91af"&gt;Thread&lt;/span&gt;.CurrentPrincipal.AsClaimsPrincipal();&lt;br&gt;
&lt;br&gt;
principal.DemandClaim(&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;WSAuthorizationConstants&lt;/span&gt;.Action,&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;"Logs.Clear"&lt;/span&gt;,&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;&lt;a href="http://accesscontrol.windows.net"&gt;http://accesscontrol.windows.net&lt;/a&gt;&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
I will release the code once I have done more testing.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=601698a7-d034-454d-8557-ed97fe31a01e" /&gt;</description>
      <category>ASP.NET</category>
      <category>IdentityModel</category>
      <category>WCF</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=29f18413-5458-4a8a-90be-64c9ef591f1e</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=29f18413-5458-4a8a-90be-64c9ef591f1e</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I just spent two very unpleasant days trying to get the T-Mobile ExpressCard IV to
work with Vista 64. But for some reasons the T-Mobile drivers for the Huawei E870
are screwed under 64 bit.
</p>
        <p>
Today I got a tip that I should try to install the latest version of Vodafone Mobile
Connect which also includes drivers for the same hardware. And bingo this works. You
can isolate the drivers from the Vodafone program files and uninstall Mobile Connect
afterwards. awesome…
</p>
        <p>
So you have to install a Vodafone software package to get T-Mobile hardware to run.
Is that weird?
</p>
        <p>
HTH
</p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=29f18413-5458-4a8a-90be-64c9ef591f1e" />
      </body>
      <title>T-Mobile Web&amp;rsquo;n&amp;rsquo;Walk &amp;amp; Vista 64</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=29f18413-5458-4a8a-90be-64c9ef591f1e</guid>
      <link>http://www.leastprivilege.com/TMobileWebrsquonrsquoWalkAmpVista64.aspx</link>
      <pubDate>Fri, 05 Dec 2008 09:28:54 GMT</pubDate>
      <description>&lt;p&gt;
I just spent two very unpleasant days trying to get the T-Mobile ExpressCard IV to
work with Vista 64. But for some reasons the T-Mobile drivers for the Huawei E870
are screwed under 64 bit.
&lt;/p&gt;
&lt;p&gt;
Today I got a tip that I should try to install the latest version of Vodafone Mobile
Connect which also includes drivers for the same hardware. And bingo this works. You
can isolate the drivers from the Vodafone program files and uninstall Mobile Connect
afterwards. awesome…
&lt;/p&gt;
&lt;p&gt;
So you have to install a Vodafone software package to get T-Mobile hardware to run.
Is that weird?
&lt;/p&gt;
&lt;p&gt;
HTH
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=29f18413-5458-4a8a-90be-64c9ef591f1e" /&gt;</description>
      <category>Misc</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=a4e8a227-8f41-42f6-9b3e-71355c48f10c</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=a4e8a227-8f41-42f6-9b3e-71355c48f10c</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <title>UserName Supporting Token &amp;amp; WCF revisited (this time with Geneva)</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=a4e8a227-8f41-42f6-9b3e-71355c48f10c</guid>
      <link>http://www.leastprivilege.com/UserNameSupportingTokenAmpWCFRevisitedThisTimeWithGeneva.aspx</link>
      <pubDate>Thu, 27 Nov 2008 06:47:40 GMT</pubDate>
      <description>&lt;p&gt;
A while back I &lt;a href="http://www.leastprivilege.com/UserNameSupportingTokenInWCF.aspx"&gt;wrote&lt;/a&gt; about
UserName supporting tokens in WCF and how they can be handy to create light-weight
“delegation” scenarios for middle-tiers. I wanted to give the same scenario a try
with a Geneva enabled relying party.
&lt;/p&gt;
&lt;p&gt;
First of all – there are no basic configuration changes necessary (specifically the
SecurityBindingElement – refer to my original &lt;a href="http://www.leastprivilege.com/UserNameSupportingTokenInWCF.aspx"&gt;post&lt;/a&gt; for
details). All you have to do is to configure the Geneva “runtime” and wire it in your
service host. This involves:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Specifying an issuer registry for the client’s certificate. 
&lt;li&gt;
Add a &lt;em&gt;UserNameSecurityTokenHandler&lt;/em&gt; that can cope with empty passwords (this
also gives you the chance to add some custom claims for the user name token).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Refer to this &lt;a href="http://www.leastprivilege.com/GenevaIsTheNewWCFSecurity.aspx"&gt;post&lt;/a&gt; for
details about issuer registries, and this &lt;a href="http://www.leastprivilege.com/UsernamePasswordValidationWithGeneva.aspx"&gt;post&lt;/a&gt; for
UserName security token handlers.
&lt;/p&gt;
&lt;p&gt;
All you then have to do is, to take all these pieces and configure the service host
to use Geneva:
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span lang=EN-US style="COLOR: #2b91af; FONT-FAMILY: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;ServiceHost&lt;/span&gt;&lt;span lang=EN-US style="FONT-FAMILY: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt; host
= &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;ServiceHost&lt;/span&gt;(&lt;span style="COLOR: blue"&gt;typeof&lt;/span&gt;(&lt;span style="COLOR: #2b91af"&gt;Service&lt;/span&gt;));&lt;br&gt;
&lt;br&gt;
&lt;span style="COLOR: green"&gt;// add the supporting token to the binding&lt;/span&gt;
&lt;br&gt;&lt;?xml:namespace prefix = o /&gt;
host.Description.Endpoints[0].Binding =&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span lang=EN-US style="FONT-FAMILY: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;AddUserNameSupportingTokenToBinding(host.Description.Endpoints[0].Binding);&lt;br&gt;
&lt;br&gt;
&lt;span style="COLOR: green"&gt;// create security token handlers&lt;/span&gt;
&lt;br&gt;
&lt;span style="COLOR: blue"&gt;var&lt;/span&gt; handlers = &lt;span style="COLOR: blue"&gt;new &lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;SecurityTokenHandlerCollection&lt;/span&gt;(&lt;br&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SecurityTokenHandlerCollection&lt;/span&gt;.DefaultHandlers);&lt;br&gt;
&lt;br&gt;
&lt;span style="COLOR: green"&gt;// add handler for supporting token (empty password)&lt;/span&gt;
&lt;br&gt;
handlers.AddOrReplace(&lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;SupportingUserNameSecurityTokenHandler&lt;/span&gt;());&lt;br&gt;
&lt;br&gt;
&lt;span style="COLOR: green"&gt;// add the issuer name registry (simple for demo purposes)&lt;/span&gt;
&lt;br&gt;
&lt;span style="COLOR: blue"&gt;var&lt;/span&gt; registry = &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;SimpleIssuerNameRegistry&lt;/span&gt;();&lt;br&gt;
&lt;br&gt;
&lt;span style="COLOR: green"&gt;// configure host to use Geneva plumbing&lt;/span&gt;
&lt;br&gt;
&lt;span style="COLOR: #2b91af"&gt;FederatedServiceCredentials&lt;/span&gt;.ConfigureServiceHost(&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;host,&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;handlers,&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;registry,&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;TimeSpan&lt;/span&gt;(0,
5, 0));&lt;br&gt;
&lt;br&gt;
host.Open();&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
On incoming requests, Geneva will now create an &lt;em&gt;IClaimsPrincipal&lt;/em&gt; that contains
two &lt;em&gt;IClaimsIdentity&lt;/em&gt; instances. One for the direct caller (certificate) and
one for the supporting token (user name). You can now use the standard means to query
both identities and their claims. Nice.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.leastprivilege.com/content/binary/SupportingUserNameToken1.zip"&gt;SupportingUserNameToken1.zip
(39.91 KB)&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=a4e8a227-8f41-42f6-9b3e-71355c48f10c" /&gt;</description>
      <category>IdentityModel</category>
      <category>WCF</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=40426bb2-d8ef-4ba6-9fd9-e394e68d62e7</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=40426bb2-d8ef-4ba6-9fd9-e394e68d62e7</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
By default, Geneva STS developers are quite shielded from the SAML creation process
– you simply derive from <em>SecurityTokenService </em>and implement <em>GetScope</em> and <em>GetOutputClaimsIdentity</em>,
and the rest gets done by the framework. But if you need more control over the generated
tokens, it’s worthwhile to have a closer look.
</p>
        <p>
Internally the <em>SecurityTokenService</em> class drives a “token information gathering”
pipeline which results in the construction of a <em>SecurityTokenDescriptor </em>(a
token neutral description) of the token to be issued. After that the descriptor is
passed on to a <em>SecurityTokenHandler</em> that creates the security token. In the
last step, the generated token is wrapped in an RSTR and sent back.
</p>
        <p>
In the current bits, the STS pipeline looks like this:
</p>
        <ul>
          <li>
            <em>
              <strong>GetScope</strong>
              <br />
            </em>Must be implemented. Determines scope specific information like signing and encrypting
credentials – usually based on the AppliesTo header. 
</li>
          <li>
            <em>
              <strong>CreateSecurityDescriptor</strong>
              <br />
            </em>Creates a default descriptor based on the scope from step 1. This is one option
to modify the descriptor manually. 
</li>
          <li>
            <em>
              <strong>GetSecurityTokenHandler</strong>
              <br />
C</em>reates the security token handler that is later used for creating the token.
The handler is determined based on the TokenType property of the RST. 
</li>
          <li>
            <em>
              <strong>GetIssuerName</strong>
              <br />
            </em>Returns the issuer for the token. By default the issuer from the <em>SecurityTokenServiceConfiguration</em> is
used. 
</li>
          <li>
            <em>
              <strong>GetTokenLifetime</strong>
            </em>
            <br />
Returns the life time of the token. By default the default life time from <em>SecurityTokenServiceConfiguration</em> is
used (which is 10 hours). 
</li>
          <li>
            <em>
              <strong>GetProofToken</strong>
            </em>
            <br />
Creates a <em>ProofTokenDescriptor</em> that describes the proof token (asymmetric,
symmetric or none). By default the information from the RST and the scope are used
here. 
</li>
          <li>
            <em>
              <strong>GetOutputClaimsIdentity</strong>
            </em>
            <br />
Must be implemented. Returns the identity that describes the subject. 
</li>
          <li>
            <em>
              <strong>SecurityTokenHandler.CreateToken</strong>
            </em>
            <br />
The token handler creates the token and returns it to the token service (more details
later) 
</li>
          <li>
            <strong>
              <em>GetDisplayToken</em>
            </strong>
            <br />
Returns the claims that should be client visible (e.g. for an identity selector) 
</li>
          <li>
            <em>
              <strong>GetResponse</strong>
            </em>
            <br />
Creates the RSTR. This is a popular hook for looking at the generated response before
sending it back.</li>
        </ul>
        <p>
You can override any of these methods to modify the shape of the output token. This
pipeline is always the same regardless of the token type. Token specific processing
is done in the security token handler. 
</p>
        <p>
Security token handlers also have a pipeline that drives token creation. Since they
are token specific, you have more control here over the output token details. For
the purpose of this post, I will describe the SAML 1.1 token creation. The details
differ for other token types.
</p>
        <ul>
          <li>
            <em>
              <strong>CreateStatements</strong>
            </em>
            <br />
Creates the SAML subject, attribute and authentication statements. This method calls
out to: 
<ul><li><em><strong>CreateSamlSubject</strong></em><br />
Looks for a name identifier claim and uses this to create the SAML subject. Additionally
if this claim has properties that describe the name format and qualifier these values
will be added to the subject. The last step is to set the proof key identifier and
subject confirmation method (holder of key / bearer) 
</li><li><em><strong>CreateAttributeStatement</strong></em><br />
Creates the attribute statement based on the claims from the token service. 
</li><li><em><strong>CreateAuthenticationStatementFromAuthenticationInformation</strong></em><br />
Creates the authentication statement based on the authentication information in the
token descriptor. This method only gets called if such information is present – so
be sure to populate the <em>AuthenticationInformation</em> collection on the descriptor
at some earlier point.</li></ul></li>
          <li>
            <strong>
              <em>CreateConditions</em>
            </strong>
            <br />
Sets the token lifetime and audience URIs restrictions. 
</li>
          <li>
            <em>
              <strong>CreateAdvice</strong>
              <br />
            </em>Creates the SAML advice. By default no advice is created. 
</li>
          <li>
            <em>
              <strong>CreateAssertion</strong>
            </em>
            <br />
Creates the SAML assertion based on the statements, the conditions and the advice. 
</li>
          <li>
            <em>
              <strong>GetSigningCredentials </strong>
            </em>
            <br />
Returns the credential used to sign the token. 
</li>
          <li>
            <em>
              <strong>GetEncryptingCredentials</strong>
            </em>
            <br />
Returns the credential used to encrypt the token. If this method returns null, the
token will not be encrypted.</li>
        </ul>
        <p>
Again you can override any of these methods.
</p>
        <p>
OK – that was a lot of information. Where would you now plug in when you want to modify
token creation? You basically have two options. Either you override the methods in <em>SecurityTokenService</em> to
shape the token descriptor that gets passed to the handler. Of, if you need more control,
you derive from one of the token handlers (e.g. <em>Saml11SecurityTokenHandler</em>)
and override some of the methods that create the token details.
</p>
        <p>
If you choose to write a custom handler, you can wire up the handler to the token
service by overriding the <em>SecurityTokenService.GetSecurityTokenHandler</em> method.
</p>
        <p>
HTH
</p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=40426bb2-d8ef-4ba6-9fd9-e394e68d62e7" />
      </body>
      <title>(SAML) Token Creation in a Geneva STS</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=40426bb2-d8ef-4ba6-9fd9-e394e68d62e7</guid>
      <link>http://www.leastprivilege.com/SAMLTokenCreationInAGenevaSTS.aspx</link>
      <pubDate>Sat, 22 Nov 2008 15:13:18 GMT</pubDate>
      <description>&lt;p&gt;
By default, Geneva STS developers are quite shielded from the SAML creation process
– you simply derive from &lt;em&gt;SecurityTokenService &lt;/em&gt;and implement &lt;em&gt;GetScope&lt;/em&gt; and &lt;em&gt;GetOutputClaimsIdentity&lt;/em&gt;,
and the rest gets done by the framework. But if you need more control over the generated
tokens, it’s worthwhile to have a closer look.
&lt;/p&gt;
&lt;p&gt;
Internally the &lt;em&gt;SecurityTokenService&lt;/em&gt; class drives a “token information gathering”
pipeline which results in the construction of a &lt;em&gt;SecurityTokenDescriptor &lt;/em&gt;(a
token neutral description) of the token to be issued. After that the descriptor is
passed on to a &lt;em&gt;SecurityTokenHandler&lt;/em&gt; that creates the security token. In the
last step, the generated token is wrapped in an RSTR and sent back.
&lt;/p&gt;
&lt;p&gt;
In the current bits, the STS pipeline looks like this:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;&lt;strong&gt;GetScope&lt;/strong&gt;
&lt;br&gt;
&lt;/em&gt;Must be implemented. Determines scope specific information like signing and encrypting
credentials – usually based on the AppliesTo header. 
&lt;li&gt;
&lt;em&gt;&lt;strong&gt;CreateSecurityDescriptor&lt;/strong&gt;
&lt;br&gt;
&lt;/em&gt;Creates a default descriptor based on the scope from step 1. This is one option
to modify the descriptor manually. 
&lt;li&gt;
&lt;em&gt;&lt;strong&gt;GetSecurityTokenHandler&lt;/strong&gt;
&lt;br&gt;
C&lt;/em&gt;reates the security token handler that is later used for creating the token.
The handler is determined based on the TokenType property of the RST. 
&lt;li&gt;
&lt;em&gt;&lt;strong&gt;GetIssuerName&lt;/strong&gt;
&lt;br&gt;
&lt;/em&gt;Returns the issuer for the token. By default the issuer from the &lt;em&gt;SecurityTokenServiceConfiguration&lt;/em&gt; is
used. 
&lt;li&gt;
&lt;em&gt;&lt;strong&gt;GetTokenLifetime&lt;/strong&gt;&lt;/em&gt;
&lt;br&gt;
Returns the life time of the token. By default the default life time from &lt;em&gt;SecurityTokenServiceConfiguration&lt;/em&gt; is
used (which is 10 hours). 
&lt;li&gt;
&lt;em&gt;&lt;strong&gt;GetProofToken&lt;/strong&gt;&lt;/em&gt;
&lt;br&gt;
Creates a &lt;em&gt;ProofTokenDescriptor&lt;/em&gt; that describes the proof token (asymmetric,
symmetric or none). By default the information from the RST and the scope are used
here. 
&lt;li&gt;
&lt;em&gt;&lt;strong&gt;GetOutputClaimsIdentity&lt;/strong&gt;&lt;/em&gt;
&lt;br&gt;
Must be implemented. Returns the identity that describes the subject. 
&lt;li&gt;
&lt;em&gt;&lt;strong&gt;SecurityTokenHandler.CreateToken&lt;/strong&gt;&lt;/em&gt;
&lt;br&gt;
The token handler creates the token and returns it to the token service (more details
later) 
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;GetDisplayToken&lt;/em&gt;&lt;/strong&gt;
&lt;br&gt;
Returns the claims that should be client visible (e.g. for an identity selector) 
&lt;li&gt;
&lt;em&gt;&lt;strong&gt;GetResponse&lt;/strong&gt;&lt;/em&gt;
&lt;br&gt;
Creates the RSTR. This is a popular hook for looking at the generated response before
sending it back.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
You can override any of these methods to modify the shape of the output token. This
pipeline is always the same regardless of the token type. Token specific processing
is done in the security token handler. 
&lt;/p&gt;
&lt;p&gt;
Security token handlers also have a pipeline that drives token creation. Since they
are token specific, you have more control here over the output token details. For
the purpose of this post, I will describe the SAML 1.1 token creation. The details
differ for other token types.
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;&lt;strong&gt;CreateStatements&lt;/strong&gt;&lt;/em&gt;
&lt;br&gt;
Creates the SAML subject, attribute and authentication statements. This method calls
out to: 
&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;&lt;strong&gt;CreateSamlSubject&lt;/strong&gt;&lt;/em&gt;
&lt;br&gt;
Looks for a name identifier claim and uses this to create the SAML subject. Additionally
if this claim has properties that describe the name format and qualifier these values
will be added to the subject. The last step is to set the proof key identifier and
subject confirmation method (holder of key / bearer) 
&lt;li&gt;
&lt;em&gt;&lt;strong&gt;CreateAttributeStatement&lt;/strong&gt;&lt;/em&gt;
&lt;br&gt;
Creates the attribute statement based on the claims from the token service. 
&lt;li&gt;
&lt;em&gt;&lt;strong&gt;CreateAuthenticationStatementFromAuthenticationInformation&lt;/strong&gt;&lt;/em&gt;
&lt;br&gt;
Creates the authentication statement based on the authentication information in the
token descriptor. This method only gets called if such information is present – so
be sure to populate the &lt;em&gt;AuthenticationInformation&lt;/em&gt; collection on the descriptor
at some earlier point.&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;CreateConditions&lt;/em&gt;&lt;/strong&gt; 
&lt;br&gt;
Sets the token lifetime and audience URIs restrictions. 
&lt;li&gt;
&lt;em&gt;&lt;strong&gt;CreateAdvice&lt;/strong&gt;
&lt;br&gt;
&lt;/em&gt;Creates the SAML advice. By default no advice is created. 
&lt;li&gt;
&lt;em&gt;&lt;strong&gt;CreateAssertion&lt;/strong&gt;&lt;/em&gt;
&lt;br&gt;
Creates the SAML assertion based on the statements, the conditions and the advice. 
&lt;li&gt;
&lt;em&gt;&lt;strong&gt;GetSigningCredentials &lt;/strong&gt;&lt;/em&gt;
&lt;br&gt;
Returns the credential used to sign the token. 
&lt;li&gt;
&lt;em&gt;&lt;strong&gt;GetEncryptingCredentials&lt;/strong&gt;&lt;/em&gt;
&lt;br&gt;
Returns the credential used to encrypt the token. If this method returns null, the
token will not be encrypted.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Again you can override any of these methods.
&lt;/p&gt;
&lt;p&gt;
OK – that was a lot of information. Where would you now plug in when you want to modify
token creation? You basically have two options. Either you override the methods in &lt;em&gt;SecurityTokenService&lt;/em&gt; to
shape the token descriptor that gets passed to the handler. Of, if you need more control,
you derive from one of the token handlers (e.g. &lt;em&gt;Saml11SecurityTokenHandler&lt;/em&gt;)
and override some of the methods that create the token details.
&lt;/p&gt;
&lt;p&gt;
If you choose to write a custom handler, you can wire up the handler to the token
service by overriding the &lt;em&gt;SecurityTokenService.GetSecurityTokenHandler&lt;/em&gt; method.
&lt;/p&gt;
&lt;p&gt;
HTH
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=40426bb2-d8ef-4ba6-9fd9-e394e68d62e7" /&gt;</description>
      <category>ASP.NET</category>
      <category>WCF</category>
      <category>IdentityModel</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=af477ca9-5955-4f71-a59d-084dbea055bf</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=af477ca9-5955-4f71-a59d-084dbea055bf</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Geneva ships with three HTTP modules to use with ASP.NET: <em>ClaimsPrincipalHttpModule</em>, <em>SessionAuthenticationModule</em> and <em>WSFederationAuthenticationModule</em>.
What are they for – and when to chose which?
</p>
        <p>
In this post I will focus on the simplest one of the three: <em>ClaimsPrincipalHttpModule</em> –
in following post we will have a close look at the remaining two.
</p>
        <p>
The claims principal module is your easiest entry into the claims-based world. It
simply takes whatever identity is on <em>HttpContext.User</em> and turns that into
an <em>IClaimsPrincipal</em>. No STS or issued tokens required. There are three main
decisions made:
</p>
        <ul>
          <li>
If client is using Windows authentication, create a <em>WindowsClaimsPrincipal</em>.
This principal allows downcasting to <em>WindowsPrincipal</em> and <em>WindowsIdentity</em> (to
access things like impersonation and other Windows security specific features). Furthermore
it contains the Windows token details as claims (primary SID, group SIDs, SAM account
name…). 
</li>
          <li>
If the client is a FormsAuth client, a claims principal holding the user name, authentication
method and instant is created. 
</li>
          <li>
If RoleManager is enabled, <em>Roles.GetRolesForUser()</em> is called to retrieve
the user’s role. These roles are transformed into claims of the “<a title="http://schemas.microsoft.com/ws/2008/06/identity/claims/role" href="http://schemas.microsoft.com/ws/2008/06/identity/claims/role">http://schemas.microsoft.com/ws/2008/06/identity/claims/role</a>”
type. Lovely.</li>
        </ul>
        <p>
In all cases this means, that traditional <em>IsInRole</em> based security (imperative
or via <em>UrlAuthorizationModule</em>) as well <em>IIdentity.Name </em>continues
to work while you get the benefits of claims.
</p>
        <p>
The next step would be to wire up a <a href="http://www.leastprivilege.com/ClaimsAuthenticationManagerInGeneva.aspx">ClaimsAuthenticationManager</a> to
add your own custom claims to the principal. This gives you a smooth migration path
and co-existence between roles and claims. Nice.
</p>
        <p>
One thing that’s missing IMO is the conversion of client certificates to claims. I’ll
file that as a feature request.
</p>
        <p>
Sample: <a href="http://www.leastprivilege.com/content/binary/ClaimsHttpModule.zip">ClaimsHttpModule.zip
(8.5 KB)</a></p>
        <p>
(btw – this all reminds me so much of my <a href="http://www.leastprivilege.com/UsingIdentityModelAddingASPNETSupportPart2ClaimsManager.aspx">ClaimsManagerModule</a> I
have posted in March’08 ;))
</p>
        <p>
 
</p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=af477ca9-5955-4f71-a59d-084dbea055bf" />
      </body>
      <title>Geneva HTTP Modules: ClaimsPrincipalHttpModule</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=af477ca9-5955-4f71-a59d-084dbea055bf</guid>
      <link>http://www.leastprivilege.com/GenevaHTTPModulesClaimsPrincipalHttpModule.aspx</link>
      <pubDate>Mon, 17 Nov 2008 11:07:10 GMT</pubDate>
      <description>&lt;p&gt;
Geneva ships with three HTTP modules to use with ASP.NET: &lt;em&gt;ClaimsPrincipalHttpModule&lt;/em&gt;, &lt;em&gt;SessionAuthenticationModule&lt;/em&gt; and &lt;em&gt;WSFederationAuthenticationModule&lt;/em&gt;.
What are they for – and when to chose which?
&lt;/p&gt;
&lt;p&gt;
In this post I will focus on the simplest one of the three: &lt;em&gt;ClaimsPrincipalHttpModule&lt;/em&gt; –
in following post we will have a close look at the remaining two.
&lt;/p&gt;
&lt;p&gt;
The claims principal module is your easiest entry into the claims-based world. It
simply takes whatever identity is on &lt;em&gt;HttpContext.User&lt;/em&gt; and turns that into
an &lt;em&gt;IClaimsPrincipal&lt;/em&gt;. No STS or issued tokens required. There are three main
decisions made:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
If client is using Windows authentication, create a &lt;em&gt;WindowsClaimsPrincipal&lt;/em&gt;.
This principal allows downcasting to &lt;em&gt;WindowsPrincipal&lt;/em&gt; and &lt;em&gt;WindowsIdentity&lt;/em&gt; (to
access things like impersonation and other Windows security specific features). Furthermore
it contains the Windows token details as claims (primary SID, group SIDs, SAM account
name…). 
&lt;li&gt;
If the client is a FormsAuth client, a claims principal holding the user name, authentication
method and instant is created. 
&lt;li&gt;
If RoleManager is enabled, &lt;em&gt;Roles.GetRolesForUser()&lt;/em&gt; is called to retrieve
the user’s role. These roles are transformed into claims of the “&lt;a title=http://schemas.microsoft.com/ws/2008/06/identity/claims/role href="http://schemas.microsoft.com/ws/2008/06/identity/claims/role"&gt;http://schemas.microsoft.com/ws/2008/06/identity/claims/role&lt;/a&gt;”
type. Lovely.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
In all cases this means, that traditional &lt;em&gt;IsInRole&lt;/em&gt; based security (imperative
or via &lt;em&gt;UrlAuthorizationModule&lt;/em&gt;) as well &lt;em&gt;IIdentity.Name &lt;/em&gt;continues
to work while you get the benefits of claims.
&lt;/p&gt;
&lt;p&gt;
The next step would be to wire up a &lt;a href="http://www.leastprivilege.com/ClaimsAuthenticationManagerInGeneva.aspx"&gt;ClaimsAuthenticationManager&lt;/a&gt; to
add your own custom claims to the principal. This gives you a smooth migration path
and co-existence between roles and claims. Nice.
&lt;/p&gt;
&lt;p&gt;
One thing that’s missing IMO is the conversion of client certificates to claims. I’ll
file that as a feature request.
&lt;/p&gt;
&lt;p&gt;
Sample: &lt;a href="http://www.leastprivilege.com/content/binary/ClaimsHttpModule.zip"&gt;ClaimsHttpModule.zip
(8.5 KB)&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
(btw – this all reminds me so much of my &lt;a href="http://www.leastprivilege.com/UsingIdentityModelAddingASPNETSupportPart2ClaimsManager.aspx"&gt;ClaimsManagerModule&lt;/a&gt; I
have posted in March’08 ;))
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=af477ca9-5955-4f71-a59d-084dbea055bf" /&gt;</description>
      <category>ASP.NET</category>
      <category>IdentityModel</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=2fe780fe-0771-4e0b-ada2-f4360b80916b</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=2fe780fe-0771-4e0b-ada2-f4360b80916b</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <title>ClaimsAuthenticationManager in Geneva</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=2fe780fe-0771-4e0b-ada2-f4360b80916b</guid>
      <link>http://www.leastprivilege.com/ClaimsAuthenticationManagerInGeneva.aspx</link>
      <pubDate>Fri, 14 Nov 2008 07:51:53 GMT</pubDate>
      <description>&lt;p&gt;
One of the things that Zermatt was lacking was a uniform way to look at incoming claims
(either from an STS or from auto-converted authentication information).
&lt;/p&gt;
&lt;p&gt;
In Geneva we now have a piece of plumbing called the &lt;em&gt;ClaimsAuthenticationManager&lt;/em&gt; which
gets called on the &lt;strong&gt;first&lt;/strong&gt; request when a token comes into your application.
This gives you a chance to reject or add claims as well as create a completely different
claims principal (aka claims transformation). These new claims go into the session
token and subsequent requests will bypass that logic.
&lt;/p&gt;
&lt;p&gt;
A simple claims authentication manager could look like this:
&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"&gt;
&lt;span lang="EN-US" style="color: blue; font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;class&lt;/span&gt;&lt;span lang="EN-US" style="font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt; &lt;span style="color: #2b91af"&gt;ClaimsTransformer&lt;/span&gt; : &lt;span style="color: #2b91af"&gt;ClaimsAuthenticationManager&lt;br&gt;
&lt;/span&gt;{&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;override&lt;/span&gt; &lt;span style="color: #2b91af"&gt;IClaimsPrincipal&lt;/span&gt; Authenticate(&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;string&lt;/span&gt; endpointUri, &lt;span style="color: #2b91af"&gt;IClaimsPrincipal&lt;/span&gt; incomingPrincipal)&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;return&lt;/span&gt; GetClaims(incomingPrincipal.Identity.Name,&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;incomingPrincipal.Identity.AuthenticationType);&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;private&lt;/span&gt; &lt;span style="color: #2b91af"&gt;IClaimsPrincipal&lt;/span&gt; GetClaims(&lt;span style="color: blue"&gt;string&lt;/span&gt; name, &lt;span style="color: blue"&gt;string&lt;/span&gt; authenticationType)&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;ClaimsIdentity&lt;/span&gt; id
= &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;ClaimsIdentity&lt;/span&gt;(&lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;Claim&lt;/span&gt;&amp;gt;&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Claim&lt;/span&gt;(&lt;span style="color: #2b91af"&gt;WSIdentityConstants&lt;/span&gt;.&lt;span style="color: #2b91af"&gt;ClaimTypes&lt;/span&gt;.Name, &lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;name, &lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;ClaimValueTypes&lt;/span&gt;.String, &lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #a31515"&gt;"LeastPrivilege"&lt;/span&gt;),&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Claim&lt;/span&gt;(&lt;span style="color: #a31515"&gt;"http://leastprivilege/claims/customClaim"&lt;/span&gt;, &lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #a31515"&gt;"customValue"&lt;/span&gt;, &lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;ClaimValueTypes&lt;/span&gt;.String, &lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #a31515"&gt;"LeastPrivilege"&lt;/span&gt;)&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;},
authenticationType);&lt;br&gt;
&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;return&lt;/span&gt; &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;ClaimsPrincipal&lt;/span&gt;(id);&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;}&lt;span style="color: #2b91af"&gt;&lt;?xml:namespace prefix = o /&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
You register the claims auth manager e.g. in config:
&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"&gt;
&lt;span lang="EN-US" style="color: blue; font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;&amp;lt;&lt;/span&gt;&lt;span lang="EN-US" style="color: #a31515; font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;microsoft.identityModel&lt;/span&gt;&lt;span lang="EN-US" style="color: blue; font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span lang="EN-US" style="color: #a31515; font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;claimsAuthenticationManager&lt;/span&gt;&lt;span lang="EN-US" style="color: blue; font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt; &lt;/span&gt;&lt;span lang="EN-US" style="color: red; font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;type&lt;/span&gt;&lt;span lang="EN-US" style="color: blue; font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;=&lt;/span&gt;&lt;span lang="EN-US" style="font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;"&lt;span style="color: blue"&gt;LeastPrivilege.ClaimsTransformer,
AutoClaims&lt;/span&gt;"&lt;span style="color: blue"&gt; /&amp;gt;&lt;br&gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;microsoft.identityModel&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
HTH
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=2fe780fe-0771-4e0b-ada2-f4360b80916b" /&gt;</description>
      <category>ASP.NET</category>
      <category>IdentityModel</category>
      <category>WCF</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=49f9875a-18f0-4a5e-8f06-6ac516669640</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=49f9875a-18f0-4a5e-8f06-6ac516669640</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <title>Username/Password Validation with Geneva</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=49f9875a-18f0-4a5e-8f06-6ac516669640</guid>
      <link>http://www.leastprivilege.com/UsernamePasswordValidationWithGeneva.aspx</link>
      <pubDate>Thu, 13 Nov 2008 18:43:34 GMT</pubDate>
      <description>&lt;p&gt;
In my &lt;a href="http://www.leastprivilege.com/GenevaIsTheNewWCFSecurity.aspx"&gt;previous&lt;/a&gt; post
I mentioned that Geneva takes over parts of the WCF security system - I used the example
of certificate validation. This is also true for username/password authentication.
&lt;/p&gt;
&lt;p&gt;
In the case you have an existing service with a &lt;em&gt;UserNamePasswordValidator&lt;/em&gt; -
as soon as you opt-into Geneva, the validator will stop to work. This is because Geneva
takes over parts of the WCF processing pipeline and injects its own token parsing
and validation system. 
&lt;/p&gt;
&lt;p&gt;
In Geneva, so-called &lt;em&gt;SecurityTokenHandlers&lt;/em&gt; read and validate incoming tokens.
As part of the validation process, claims based on that token are created and put
into the &lt;em&gt;IClaimsPrincipal&lt;/em&gt;, which will abe vailable from your operations.
There are two handlers that register for UserName tokens: &lt;em&gt;WindowsUserNameSecurityTokenHandler&lt;/em&gt; and &lt;em&gt;MembershipUserNameSecurityTokenHandler &lt;/em&gt;(I
guess it is clear which account stores they use). 
&lt;/p&gt;
&lt;p&gt;
By default the Windows handler is registered and unless you have a used a username/password
pair that incidentally matches a Windows account on your system, username authentication
will fail.
&lt;/p&gt;
&lt;p&gt;
You now have two options: using the membership handler (if you have an existing membership
provider) or write your own handler, which is pretty straightforward. The following
handler code makes sure that username and password are identical - nothing you should
do in your production systems - but you get the idea ;)
&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"&gt;
&lt;span lang="EN-US" style="color: blue; font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;class&lt;/span&gt;&lt;span lang="EN-US" style="font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt; &lt;span style="color: #2b91af"&gt;SimpleUserNameSecurityTokenHandler&lt;/span&gt; : &lt;span style="color: #2b91af"&gt;UserNameSecurityTokenHandler&lt;br&gt;
&lt;/span&gt;{&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;override&lt;/span&gt; &lt;span style="color: #2b91af"&gt;ClaimsIdentityCollection&lt;/span&gt; ValidateToken(&lt;span style="color: #2b91af"&gt;SecurityToken&lt;/span&gt; token)&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;UserNameSecurityToken&lt;/span&gt; unToken
= token &lt;span style="color: blue"&gt;as&lt;/span&gt; &lt;span style="color: #2b91af"&gt;UserNameSecurityToken&lt;/span&gt;;&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;if&lt;/span&gt; (unToken
== &lt;span style="color: blue"&gt;null&lt;/span&gt;)&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;throw&lt;/span&gt; &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;ArgumentException&lt;/span&gt;(&lt;span style="color: #a31515"&gt;"token"&lt;/span&gt;);&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green"&gt;//
replace with proper password validation!&lt;/span&gt;&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;if&lt;/span&gt; (unToken.UserName
!= unToken.Password)&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;throw&lt;/span&gt; &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;SecurityTokenValidationException&lt;/span&gt;();&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;ClaimsIdentity&lt;/span&gt; id
= &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;ClaimsIdentity&lt;/span&gt;(&lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;Claim&lt;/span&gt;&amp;gt;&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Claim&lt;/span&gt;(&lt;span style="color: #2b91af"&gt;WSIdentityConstants&lt;/span&gt;.&lt;span style="color: #2b91af"&gt;ClaimTypes&lt;/span&gt;.Name,
unToken.UserName)&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}, &lt;span style="color: #a31515"&gt;"UserName"&lt;/span&gt;);&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;return&lt;/span&gt; &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;ClaimsIdentityCollection&lt;/span&gt;(id);&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;override&lt;/span&gt; &lt;span style="color: blue"&gt;bool&lt;/span&gt; CanValidateToken&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;get&lt;/span&gt;&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;return&lt;/span&gt; &lt;span style="color: blue"&gt;true&lt;/span&gt;;&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;span style="color: #2b91af"&gt;
&lt;br&gt;
&lt;/span&gt;}&lt;span style="color: #2b91af"&gt;&lt;?xml:namespace prefix = o /&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal"&gt;
&lt;span lang="EN-US" style="mso-ansi-language: en-us"&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
You have to setup the handler in config - this is currently a little cumbersome but
will hopefully get easier in the future. You first have to remove the windows handler
- or clear the handler collection and add your own handler to it:
&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"&gt;
&lt;span lang="EN-US" style="color: blue; font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;&amp;lt;&lt;/span&gt;&lt;span lang="EN-US" style="color: #a31515; font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;microsoft.identityModel&lt;/span&gt;&lt;span lang="EN-US" style="color: blue; font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span lang="EN-US" style="color: #a31515; font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;securityTokenHandlers&lt;/span&gt;&lt;span lang="EN-US" style="color: blue; font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span lang="EN-US" style="color: #a31515; font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;clear&lt;/span&gt;&lt;span lang="EN-US" style="color: blue; font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt; /&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span lang="EN-US" style="color: #a31515; font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;add&lt;/span&gt;&lt;span lang="EN-US" style="color: blue; font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt; &lt;/span&gt;&lt;span lang="EN-US" style="color: red; font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;type&lt;/span&gt;&lt;span lang="EN-US" style="color: blue; font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;=&lt;/span&gt;&lt;span lang="EN-US" style="font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;"&lt;span style="color: blue"&gt;LeastPrivilege.SimpleUserNameSecurityTokenHandler,
AutoClaims&lt;/span&gt;"&lt;span style="color: blue"&gt; /&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;securityTokenHandlers&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;microsoft.identityModel&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
There is also a &lt;a href="http://social.msdn.microsoft.com/Forums/en-US/Geneva/thread/ddd45b84-f0d4-48b2-9ce0-1042bea06193"&gt;thread&lt;/a&gt; on
MSDN where Pedro shows how to do that programmatically.
&lt;/p&gt;
&lt;p&gt;
HTH
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=49f9875a-18f0-4a5e-8f06-6ac516669640" /&gt;</description>
      <category>IdentityModel</category>
      <category>WCF</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=c97e09f5-a5aa-4f2b-bd80-182fc38264a2</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=c97e09f5-a5aa-4f2b-bd80-182fc38264a2</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
A really interesting feature in .NET 4 will be Code Contracts. They allow defining
pre- and post-conditions in code along with some other more advanced options.
</p>
        <p>
See the PDC video <a href="http://mschnlnine.vo.llnwd.net/d1/pdc08/WMV-HQ/TL51.wmv">here</a> -
and  more <a href="http://blogs.msdn.com/bclteam/archive/2008/11/11/introduction-to-code-contracts-melitta-andersen.aspx">here</a>.
</p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=c97e09f5-a5aa-4f2b-bd80-182fc38264a2" />
      </body>
      <title>Code Contracts in .NET 4</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=c97e09f5-a5aa-4f2b-bd80-182fc38264a2</guid>
      <link>http://www.leastprivilege.com/CodeContractsInNET4.aspx</link>
      <pubDate>Wed, 12 Nov 2008 07:02:03 GMT</pubDate>
      <description>&lt;p&gt;
A really interesting feature in .NET 4 will be Code Contracts. They allow defining
pre- and post-conditions in code along with some other more advanced options.
&lt;/p&gt;
&lt;p&gt;
See the PDC video &lt;a href="http://mschnlnine.vo.llnwd.net/d1/pdc08/WMV-HQ/TL51.wmv"&gt;here&lt;/a&gt; -
and&amp;nbsp; more &lt;a href="http://blogs.msdn.com/bclteam/archive/2008/11/11/introduction-to-code-contracts-melitta-andersen.aspx"&gt;here&lt;/a&gt;.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=c97e09f5-a5aa-4f2b-bd80-182fc38264a2" /&gt;</description>
      <category>FX Security</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=fa57670f-f0b7-46fc-85e5-6c6983b86188</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=fa57670f-f0b7-46fc-85e5-6c6983b86188</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <title>Geneva is the new WCF Security</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=fa57670f-f0b7-46fc-85e5-6c6983b86188</guid>
      <link>http://www.leastprivilege.com/GenevaIsTheNewWCFSecurity.aspx</link>
      <pubDate>Fri, 31 Oct 2008 06:35:55 GMT</pubDate>
      <description>&lt;p&gt;
Geneva has evolved to not only a an extension to WCF/ASP.NET for STS/token related
things - it also changes how base WCF security works - to the better IMO. Let me give
you an example:
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Trusted certificate issuers&lt;br&gt;
&lt;/strong&gt;When doing client certificate based authentication you always had three choices
for validating those certs: PeerTrust, ChainTrust and Custom. I wrote about these
options in detail (&lt;a href="http://www.leastprivilege.com/CertificateBasedAuthenticationAndWCF.aspx"&gt;here&lt;/a&gt;).
Typically you ended up writing some custom validation because both Peer- and ChainTrust
is often&amp;nbsp; not what you want (and there are also some differences when it comes
to message vs transport based security - see &lt;a href="http://www.leastprivilege.com/CertificateBasedAuthenticationAndWCFMessageSecurity.aspx"&gt;here&lt;/a&gt;, &lt;a href="http://www.leastprivilege.com/CertificateBasedAuthenticationAndWCFTransportSecurity.aspx"&gt;here&lt;/a&gt; and &lt;a href="http://www.leastprivilege.com/CertificateBasedAuthenticationAndWCFModeIndependent.aspx"&gt;here&lt;/a&gt;).
&lt;/p&gt;
&lt;p&gt;
Once you opt-in to the Geneva model - you will realize that client certificates start
to break. This is because Geneva has a built-in way to restrict allowed CAs to a specified
list, and by default this list is enforced - and empty. The background here is, that
Geneva has this concept of an "issuer registry" - basically a mechanism how to map
issuers (usually certificate issuers) to a name - the name is then placed on the Issuer
property of claims. There are two built-in registry classes: the &lt;em&gt;SimpleIssuerNameRegistry&lt;/em&gt; (which
simply uses the CA's subject name and has no restrictions) and the &lt;em&gt;ConfigurationBasedIssuerNameRegistry&lt;/em&gt; (which
enforces the list I mentioned above).
&lt;/p&gt;
&lt;p&gt;
To specify a list of allowed issuers, you have to put something like this in config:
&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"&gt;
&lt;span lang="EN-US" style="color: blue; font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;&amp;lt;&lt;/span&gt;&lt;span lang="EN-US" style="color: #a31515; font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;microsoft.identityModel&lt;/span&gt;&lt;span lang="EN-US" style="color: blue; font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span lang="EN-US" style="color: #a31515; font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;issuerNameRegistry&lt;/span&gt;&lt;span lang="EN-US" style="color: blue; font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt; &lt;/span&gt;&lt;span lang="EN-US" style="color: red; font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;type&lt;/span&gt;&lt;span lang="EN-US" style="color: blue; font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;=&lt;/span&gt;&lt;span lang="EN-US" style="font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;"&lt;span style="color: blue"&gt;Microsoft.IdentityModel.Tokens.ConfigurationBasedIssuerNameRegistry,
…&lt;/span&gt;"&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;trustedIssuers&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;add&lt;/span&gt;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;LeastPrivilege
CA&lt;/span&gt;"&lt;span style="color: blue"&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: red"&gt;thumbprint&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"…"&lt;span style="color: blue"&gt; /&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;trustedIssuers&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;issuerNameRegistry&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;microsoft.identityModel&lt;/span&gt;&lt;span style="color: blue"&gt;&lt;?xml:namespace prefix = o /&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
This has the effect that only certificates issued by a CA in the &lt;em&gt;trustedIssuers&lt;/em&gt; list
will be allowed "in". If you don't want that restriction - or already have other validation
code down the line - you can use the simple name registry. Another option is of course
to write your own registry class.
&lt;/p&gt;
&lt;p&gt;
Another big simplification with Geneva comes to custom token/credential types (ever
tried adding a new credential type of WCF? Even really simple things require you to
write 10+ classes and a good understanding how they relate to each other). With Geneva's
concept of SecurityTokenHandlers this gets much easier.
&lt;/p&gt;
&lt;p&gt;
So in summary - Geneva replaces parts of the WCF security system, simplifies it and
makes it easier to extend - even if you are not using a security token service. I
like that.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=fa57670f-f0b7-46fc-85e5-6c6983b86188" /&gt;</description>
      <category>IdentityModel</category>
      <category>WCF</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=b57d38b5-8d8c-4394-a75a-c56f904aed91</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=b57d38b5-8d8c-4394-a75a-c56f904aed91</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Starting with the PDC release, Microsoft's identity framework is now code-named "Geneva
Framework". Based on that framework, there is also a product called "Geneva Server"
that brings the ADFS 1.x type of functionality (and more) to the web services/WS-Trust/CardSpace
world. Furthermore there is also a release called "Geneva CardSpace" which seems to
be CardSpace v.Next.
</p>
        <p>
You can download all the new bits <a href="https://connect.microsoft.com/site/sitehome.aspx?SiteID=642">here</a>.
</p>
        <p>
I already had the chance to test-drive some of the new bits and made some interesting
observations - stay tuned ;)
</p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=b57d38b5-8d8c-4394-a75a-c56f904aed91" />
      </body>
      <title>Geneva is the new Zermatt (and much more)</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=b57d38b5-8d8c-4394-a75a-c56f904aed91</guid>
      <link>http://www.leastprivilege.com/GenevaIsTheNewZermattAndMuchMore.aspx</link>
      <pubDate>Mon, 27 Oct 2008 21:45:34 GMT</pubDate>
      <description>&lt;p&gt;
Starting with the PDC release, Microsoft's identity framework is now code-named "Geneva
Framework". Based on that framework, there is also a product called "Geneva Server"
that brings the ADFS 1.x type of functionality (and more) to the web services/WS-Trust/CardSpace
world. Furthermore there is also a release called "Geneva CardSpace" which seems to
be CardSpace v.Next.
&lt;/p&gt;
&lt;p&gt;
You can download all the new bits &lt;a href="https://connect.microsoft.com/site/sitehome.aspx?SiteID=642"&gt;here&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
I already had the chance to test-drive some of the new bits and made some interesting
observations - stay tuned ;)
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=b57d38b5-8d8c-4394-a75a-c56f904aed91" /&gt;</description>
      <category>ASP.NET</category>
      <category>CardSpace</category>
      <category>IdentityModel</category>
      <category>WCF</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=d998aeec-6862-42e2-a2fb-98a749abf401</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=d998aeec-6862-42e2-a2fb-98a749abf401</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
It's been a <a href="http://www.leastprivilege.com/TokenKidnapping.aspx">while</a> since
I linked to Cesar Cerrudo's slide <a href="http://www.argeniss.com/research/TokenKidnapping.pdf">deck</a> about
token kidnapping. Now there is also a <a href="http://nomoreroot.blogspot.com/2008/10/windows-2003-poc-exploit-for-token.html">POC</a> available
(with samples how to use it from SQL Server and IIS).
</p>
        <p>
There is also some movement at MS now...(<a href="http://blogs.iis.net/nazim/archive/2008/10/14/token-kidnapping-in-windows.aspx">here</a>, <a href="http://www.microsoft.com/technet/security/advisory/951306.mspx">here</a>)
</p>
        <p>
Quoting from the <strong>recommendations</strong> page of the original slide deck:
</p>
        <ul>
          <li>
Windows XP and 2003</li>
          <ul>
            <li>
On IIS 6 don't run ASP .NET in full trust and if classic ASP is enabled don't allow
users to execute binaries</li>
          </ul>
          <li>
On Windows Vista and 2008</li>
          <ul>
            <li>
On IIS 7 don't run ASP .NET in full trust or don't run web sites under NetworkServer
or LocalService accounts</li>
            <li>
Don't run services under NetworkService or LocalService accounts</li>
            <ul>
              <li>
Use regular user accounts to run services</li>
            </ul>
          </ul>
        </ul>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=d998aeec-6862-42e2-a2fb-98a749abf401" />
      </body>
      <title>Token Kidnapping (revisited)</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=d998aeec-6862-42e2-a2fb-98a749abf401</guid>
      <link>http://www.leastprivilege.com/TokenKidnappingRevisited.aspx</link>
      <pubDate>Thu, 16 Oct 2008 05:10:04 GMT</pubDate>
      <description>&lt;p&gt;
It's been a &lt;a href="http://www.leastprivilege.com/TokenKidnapping.aspx"&gt;while&lt;/a&gt; since
I linked to Cesar Cerrudo's slide &lt;a href="http://www.argeniss.com/research/TokenKidnapping.pdf"&gt;deck&lt;/a&gt; about
token kidnapping. Now there is also a &lt;a href="http://nomoreroot.blogspot.com/2008/10/windows-2003-poc-exploit-for-token.html"&gt;POC&lt;/a&gt; available
(with samples how to use it from SQL Server and IIS).
&lt;/p&gt;
&lt;p&gt;
There is also some movement at MS now...(&lt;a href="http://blogs.iis.net/nazim/archive/2008/10/14/token-kidnapping-in-windows.aspx"&gt;here&lt;/a&gt;, &lt;a href="http://www.microsoft.com/technet/security/advisory/951306.mspx"&gt;here&lt;/a&gt;)
&lt;/p&gt;
&lt;p&gt;
Quoting from the &lt;strong&gt;recommendations&lt;/strong&gt; page of the original slide deck:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Windows XP and 2003&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;
On IIS 6 don't run ASP .NET in full trust and if classic ASP is enabled don't allow
users to execute binaries&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
On Windows Vista and 2008&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;
On IIS 7 don't run ASP .NET in full trust or don't run web sites under NetworkServer
or LocalService accounts&lt;/li&gt;
&lt;li&gt;
Don't run services under NetworkService or LocalService accounts&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;
Use regular user accounts to run services&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=d998aeec-6862-42e2-a2fb-98a749abf401" /&gt;</description>
      <category>Work in Progress</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=a811cfc2-01a6-4391-83f0-ce79594a2e37</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=a811cfc2-01a6-4391-83f0-ce79594a2e37</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <title>Getting rid of the .svc Extension in IIS</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=a811cfc2-01a6-4391-83f0-ce79594a2e37</guid>
      <link>http://www.leastprivilege.com/GettingRidOfTheSvcExtensionInIIS.aspx</link>
      <pubDate>Wed, 15 Oct 2008 19:30:44 GMT</pubDate>
      <description>&lt;p&gt;
&lt;a href="http://www.masteringbiztalk.com/blogs/jon/"&gt;Jon&lt;/a&gt; posted a &lt;a href="http://www.masteringbiztalk.com/blogs/jon/PermaLink,guid,9e0d8d1e-ac7c-49b5-8072-bde42609f5db.aspx"&gt;module&lt;/a&gt; that
does this.
&lt;/p&gt;
&lt;p&gt;
I recently tried to use the URL rewriting &lt;a href="http://www.iis.net/downloads/default.aspx?tabid=34&amp;amp;g=6&amp;amp;i=1691"&gt;module&lt;/a&gt; for
IIS 7 to achieve the same - this rule worked for me:
&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"&gt;
&lt;span lang="EN-US" style="color: blue; font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;&amp;lt;&lt;/span&gt;&lt;span lang="EN-US" style="color: #a31515; font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;system.webServer&lt;/span&gt;&lt;span lang="EN-US" style="color: blue; font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span lang="EN-US" style="color: #a31515; font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;rewrite&lt;/span&gt;&lt;span lang="EN-US" style="color: blue; font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span lang="EN-US" style="color: #a31515; font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;rules&lt;/span&gt;&lt;span lang="EN-US" style="color: blue; font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span lang="EN-US" style="color: #a31515; font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;rule&lt;/span&gt;&lt;span lang="EN-US" style="color: blue; font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt; &lt;/span&gt;&lt;span lang="EN-US" style="color: red; font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;name&lt;/span&gt;&lt;span lang="EN-US" style="color: blue; font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;=&lt;/span&gt;&lt;span lang="EN-US" style="font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;"&lt;span style="color: blue"&gt;Remove
.svc&lt;/span&gt;"&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;match&lt;/span&gt;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;url&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;^([0-9a-zA-Z\-]+)/([0-9a-zA-Z\-\.\/\(\)]*)&lt;/span&gt;"&lt;span style="color: blue"&gt; /&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;action&lt;/span&gt;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;type&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;Rewrite&lt;/span&gt;"&lt;span style="color: blue"&gt;
&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: red"&gt;url&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;{R:1}.svc/{R:2}&lt;/span&gt;"&lt;span style="color: blue"&gt; /&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;rule&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;rules&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;
&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;rewrite&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;system.webServer&lt;/span&gt;&lt;span style="color: blue"&gt;&lt;?xml:namespace prefix = o /&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
HTH
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=a811cfc2-01a6-4391-83f0-ce79594a2e37" /&gt;</description>
      <category>IIS</category>
      <category>WCF</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=9ad2490a-4daa-4aad-b66a-010082d6efae</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=9ad2490a-4daa-4aad-b66a-010082d6efae</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I often get the Question: “<strong>What is CardSpace?</strong>”
</p>
        <p>
While there is a whole <a href="http://www.identityblog.com/?p=354">philosophical</a> side
to CardSpace (or similar products) – the technical and pragmatic answer is:
</p>
        <blockquote>
          <p>
“CardSpace is a graphical client for security token services built into Windows”
</p>
        </blockquote>
        <p>
(or as <a href="http://www.pluralsight.com/community/blogs/keith/default.aspx">Keith</a> recently
said: “home realm discovery the nice way")
</p>
        <p>
Related questions are:
</p>
        <p>
          <strong>What is a card?</strong>
        </p>
        <blockquote>
          <p>
“A card is a graphical representation of the configuration details how to talk to
that security token service (address, required claims, credentials and more…)”
</p>
        </blockquote>
        <p>
          <strong>Then what’s the difference between personal and managed cards?</strong>
        </p>
        <blockquote>
          <p>
“Personal cards use a local (aka personal) STS. Managed cards a third-party/remote
STS”
</p>
        </blockquote>
        <p>
That’s it.
</p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=9ad2490a-4daa-4aad-b66a-010082d6efae" />
      </body>
      <title>CardSpace is&amp;hellip;</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=9ad2490a-4daa-4aad-b66a-010082d6efae</guid>
      <link>http://www.leastprivilege.com/CardSpaceIshellip.aspx</link>
      <pubDate>Thu, 09 Oct 2008 22:21:57 GMT</pubDate>
      <description>&lt;p&gt;
I often get the Question: “&lt;strong&gt;What is CardSpace?&lt;/strong&gt;”
&lt;/p&gt;
&lt;p&gt;
While there is a whole &lt;a href="http://www.identityblog.com/?p=354"&gt;philosophical&lt;/a&gt; side
to CardSpace (or similar products) – the technical and pragmatic answer is:
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
“CardSpace is a graphical client for security token services built into Windows”
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
(or as &lt;a href="http://www.pluralsight.com/community/blogs/keith/default.aspx"&gt;Keith&lt;/a&gt; recently
said: “home realm discovery the nice way")
&lt;/p&gt;
&lt;p&gt;
Related questions are:
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;What is a card?&lt;/strong&gt;
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
“A card is a graphical representation of the configuration details how to talk to
that security token service (address, required claims, credentials and more…)”
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
&lt;strong&gt;Then what’s the difference between personal and managed cards?&lt;/strong&gt;
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
“Personal cards use a local (aka personal) STS. Managed cards a third-party/remote
STS”
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
That’s it.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=9ad2490a-4daa-4aad-b66a-010082d6efae" /&gt;</description>
      <category>CardSpace</category>
      <category>IdentityModel</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=7043a1c0-533f-46ab-be03-8bd53fe4f2f1</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=7043a1c0-533f-46ab-be03-8bd53fe4f2f1</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Christian and I have written an article about the authorization infrastructure in
WCF. It covers roles- and claims-based authorization and how to customize both. Enjoy.
</p>
        <p>
          <a title="http://msdn.microsoft.com/en-us/magazine/cc948343.aspx" href="http://msdn.microsoft.com/en-us/magazine/cc948343.aspx">http://msdn.microsoft.com/en-us/magazine/cc948343.aspx</a>
          <br />
(back online now - sorry for the confusion)
</p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=7043a1c0-533f-46ab-be03-8bd53fe4f2f1" />
      </body>
      <title>MSDN Article about WCF Service Authorization</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=7043a1c0-533f-46ab-be03-8bd53fe4f2f1</guid>
      <link>http://www.leastprivilege.com/MSDNArticleAboutWCFServiceAuthorization.aspx</link>
      <pubDate>Sat, 20 Sep 2008 09:59:05 GMT</pubDate>
      <description>&lt;p&gt;
Christian and I have written an article about the authorization infrastructure in
WCF. It covers roles- and claims-based authorization and how to customize both. Enjoy.
&lt;/p&gt;
&lt;p&gt;
&lt;a title=http://msdn.microsoft.com/en-us/magazine/cc948343.aspx href="http://msdn.microsoft.com/en-us/magazine/cc948343.aspx"&gt;http://msdn.microsoft.com/en-us/magazine/cc948343.aspx&lt;/a&gt;
&lt;br&gt;
(back online now - sorry for the confusion)
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=7043a1c0-533f-46ab-be03-8bd53fe4f2f1" /&gt;</description>
      <category>IdentityModel</category>
      <category>WCF</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=8ca6947e-32d7-4503-8a28-de6b6c586b8c</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=8ca6947e-32d7-4503-8a28-de6b6c586b8c</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
When trying to implement certificate backed managed InfoCards you might run into this
slightly misleading error message:
</p>
        <blockquote>
          <p>
"There was a failure making a WS-Trust exchange with an external application. Could
not retrieve token from identity provider. 
</p>
          <p>
Inner Exception: SOAP security negotiation failed. See inner exception for more details.<br />
Inner Exception: The certificate 'CN=xy' must have a private key. The process must
have access rights for the private key."
</p>
        </blockquote>
        <p>
The real cause for this error is a bug in Windows CardSpace. You can workaround that
by disabling service credential negotiation on your STS binding by setting <em>negotiateServiceCredential</em> to <em>false</em>.
</p>
        <p>
Thanks to the Zermatt forum people for pointing me into the right direction!
</p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=8ca6947e-32d7-4503-8a28-de6b6c586b8c" />
      </body>
      <title>Certificate-backed InfoCards and Service Credential Negotiation</title>
      <guid isPermaLink="false">http://www.leastprivilege.com/PermaLink.aspx?guid=8ca6947e-32d7-4503-8a28-de6b6c586b8c</guid>
      <link>http://www.leastprivilege.com/CertificatebackedInfoCardsAndServiceCredentialNegotiation.aspx</link>
      <pubDate>Sun, 14 Sep 2008 12:16:45 GMT</pubDate>
      <description>&lt;p&gt;
When trying to implement certificate backed managed InfoCards you might run into this
slightly misleading error message:
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
"There was a failure making a WS-Trust exchange with an external application. Could
not retrieve token from identity provider. 
&lt;/p&gt;
&lt;p&gt;
Inner Exception: SOAP security negotiation failed. See inner exception for more details.&lt;br&gt;
Inner Exception: The certificate 'CN=xy' must have a private key. The process must
have access rights for the private key."
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
The real cause for this error is a bug in Windows CardSpace. You can workaround that
by disabling service credential negotiation on your STS binding by setting &lt;em&gt;negotiateServiceCredential&lt;/em&gt; to &lt;em&gt;false&lt;/em&gt;.
&lt;/p&gt;
&lt;p&gt;
Thanks to the Zermatt forum people for pointing me into the right direction!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=8ca6947e-32d7-4503-8a28-de6b6c586b8c" /&gt;</description>
      <category>IdentityModel</category>
    </item>
  </channel>
</rss>