<?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:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>Steve Syfuhs.net</title>
    <link>http://www.syfuhs.net/</link>
    <description>Theoretical Headbanging at its finest...</description>
    <language>en-us</language>
    <copyright>Steve Syfuhs</copyright>
    <lastBuildDate>Fri, 03 Sep 2010 21:49:42 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.3.9074.18820</generator>
    <managingEditor>steve@syfuhs.net</managingEditor>
    <webMaster>steve@syfuhs.net</webMaster>
    <item>
      <trackback:ping>http://www.syfuhs.net/Trackback.aspx?guid=1678b522-4ab8-489c-8f3d-755aef66642a</trackback:ping>
      <pingback:server>http://www.syfuhs.net/pingback.aspx</pingback:server>
      <pingback:target>http://www.syfuhs.net/PermaLink,guid,1678b522-4ab8-489c-8f3d-755aef66642a.aspx</pingback:target>
      <dc:creator>Steve Syfuhs</dc:creator>
      <wfw:comment>http://www.syfuhs.net/CommentView,guid,1678b522-4ab8-489c-8f3d-755aef66642a.aspx</wfw:comment>
      <wfw:commentRss>http://www.syfuhs.net/SyndicationService.asmx/GetEntryCommentsRss?guid=1678b522-4ab8-489c-8f3d-755aef66642a</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
This is more of a random collection of thoughts because earlier today I came to the
conclusion that I need something very similar to <a href="http://www.syfuhs.net/2010/08/14/InstallingADFS2AndFederatingAnApplication.aspx">Active
Directory Federation Services</a>, except for non-domain users. This is relatively
easy to do; all I need is to create a Secure Token Service with a user store for the
back end. 
</p>
        <p>
The simplest approach is to use ASP.NET Membership and Roles with SqlProvider’s wrapped
up by some WIF special sauce. Turns out Dominick Baier already did just that with <a href="http://startersts.codeplex.com/">StarterSTS</a>.
</p>
        <p>
The problems I have with this is that it’s a pain to manage when you start getting
more than a hundred or so users. Extending user properties is hard to do too. So my
solution is to use something that is designed for user identities… an LDAP directory.
If it’s good enough for Active Directory, it’ll be plenty useful for this situation.
</p>
        <blockquote>
          <p>
            <strong>Reasoning 
<br /></strong>As an aside, the reason I’m not using Active Directory in the first place
is because I need to manage a few thousand well known users without CAL’s. This would
amount to upwards of a couple hundred thousand dollars in licensing costs that just
isn’t in the budget. Further, most of these users <em>probably</em> wouldn’t use any
of our systems that use Active Directory for authentication, but nevertheless, we
need accounts for them.
</p>
          <p>
Also, it would be a lot easier to manage creation and modification of user accounts
because there are loads of processes that have been designed to pull user data out
of HR applications into LDAP directories instead of custom SQL queries.
</p>
        </blockquote>
        <p>
So lets think about what makes up Active Directory Federation Services. It has roles
that provides:
</p>
        <ul>
          <li>
Token Services 
</li>
          <li>
A Windows Authentication end-point 
</li>
          <li>
An Attribute store-property-to-claim mapper (maps any LDAP properties to any claim
types) 
</li>
          <li>
An application management tool (MMC snap-in and PowerShell cmdlets) 
</li>
          <li>
Proxy Services (Allows requests to pass NAT’ed zones) 
</li>
        </ul>
        <p>
That’s actually a pretty lightweight product when you compare it to the other services
in Microsoft’s Identity stack. 
</p>
        <p>
We can actually simplify it even further by breaking down the roles we need.
</p>
        <p>
          <strong>Token Services</strong>
        </p>
        <p>
This is actually pretty easy to accomplish. Refer back to the WIF magic sauce.
</p>
        <p>
          <strong>Authentication end-point</strong>
        </p>
        <p>
This is just (well, you know what I mean) a web page login control. We can’t do Windows
Authentication without Kerberos (or NTLM), and we can’t do Kerberos without Active
Directory (technically it could be done, but you’d be crazy to try).
</p>
        <p>
          <strong>Attribute store-property-to-claim mapper</strong>
        </p>
        <p>
ADFS can connect to a bunch of different attribute stores, including custom built
stores if you provide assemblies. We only really need to map to a few LDAP properties,
and make it easy to map to other properties in the future.
</p>
        <p>
          <strong>Application management tool</strong>
        </p>
        <p>
This would be to manage the mapper and a few STS settings like URI names and certificates.
This, I think, would be a relatively simple application if we designed the configuration
database properly.
</p>
        <p>
          <strong>Proxy Services</strong>
        </p>
        <p>
Proxies are a pain in the butt. Useful in general, but we don’t really need to think
about this at the moment.
</p>
        <p>
          <strong>Some Warnings</strong>
        </p>
        <p>
There are some things that are worth mentioning. We have to be really careful about
what we create because we are developing a serious piece of the security infrastructure.
Yes, it is for a group of employees that won’t have much access to anything dangerous
(if they need access, they’d be migrated to Active Directory), but nevertheless we
are creating the main ingress point for the majority of our employees. It also needs
to be accessible from the internet.
</p>
        <p>
It may sound like I think it’ll be a synch to develop this system and have it work
securely, but in reality there is a lot that will need to go into it to protect the
network, the employees, and the data this could possibly interact with. It is tough
to develop applications securely. It is far harder to develop secure applications
whose sole responsibility is security related.
</p>
        <p>
          <strong>Next Steps</strong>
        </p>
        <p>
The next step is to design the thing. I know how it will exist in relation to the
systems it will be used to provide identity to, but aside from that, the architecture
of the thing is still unknown. With any luck I can accomplish rough designs tomorrow
on the train, on my way to visit family for the holiday.
</p>
        <p>
Better yet, maybe while visiting with family. <img style="display:inline" alt="Winking smile" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/BuildyourownDirectoryFederationService_E2E1/wlEmoticon-winkingsmile_2.png" /></p>
        <img width="0" height="0" src="http://www.syfuhs.net/aggbug.ashx?id=1678b522-4ab8-489c-8f3d-755aef66642a" />
      </body>
      <title>Build your own Directory Federation Service</title>
      <guid isPermaLink="false">http://www.syfuhs.net/PermaLink,guid,1678b522-4ab8-489c-8f3d-755aef66642a.aspx</guid>
      <link>http://www.syfuhs.net/2010/09/03/BuildYourOwnDirectoryFederationService.aspx</link>
      <pubDate>Fri, 03 Sep 2010 21:49:42 GMT</pubDate>
      <description>&lt;p&gt;
This is more of a random collection of thoughts because earlier today I came to the
conclusion that I need something very similar to &lt;a href="http://www.syfuhs.net/2010/08/14/InstallingADFS2AndFederatingAnApplication.aspx"&gt;Active
Directory Federation Services&lt;/a&gt;, except for non-domain users. This is relatively
easy to do; all I need is to create a Secure Token Service with a user store for the
back end. 
&lt;/p&gt;
&lt;p&gt;
The simplest approach is to use ASP.NET Membership and Roles with SqlProvider’s wrapped
up by some WIF special sauce. Turns out Dominick Baier already did just that with &lt;a href="http://startersts.codeplex.com/"&gt;StarterSTS&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
The problems I have with this is that it’s a pain to manage when you start getting
more than a hundred or so users. Extending user properties is hard to do too. So my
solution is to use something that is designed for user identities… an LDAP directory.
If it’s good enough for Active Directory, it’ll be plenty useful for this situation.
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
&lt;strong&gt;Reasoning 
&lt;br /&gt;
&lt;/strong&gt;As an aside, the reason I’m not using Active Directory in the first place
is because I need to manage a few thousand well known users without CAL’s. This would
amount to upwards of a couple hundred thousand dollars in licensing costs that just
isn’t in the budget. Further, most of these users &lt;em&gt;probably&lt;/em&gt; wouldn’t use any
of our systems that use Active Directory for authentication, but nevertheless, we
need accounts for them.
&lt;/p&gt;
&lt;p&gt;
Also, it would be a lot easier to manage creation and modification of user accounts
because there are loads of processes that have been designed to pull user data out
of HR applications into LDAP directories instead of custom SQL queries.
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
So lets think about what makes up Active Directory Federation Services. It has roles
that provides:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Token Services 
&lt;/li&gt;
&lt;li&gt;
A Windows Authentication end-point 
&lt;/li&gt;
&lt;li&gt;
An Attribute store-property-to-claim mapper (maps any LDAP properties to any claim
types) 
&lt;/li&gt;
&lt;li&gt;
An application management tool (MMC snap-in and PowerShell cmdlets) 
&lt;/li&gt;
&lt;li&gt;
Proxy Services (Allows requests to pass NAT’ed zones) 
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
That’s actually a pretty lightweight product when you compare it to the other services
in Microsoft’s Identity stack. 
&lt;/p&gt;
&lt;p&gt;
We can actually simplify it even further by breaking down the roles we need.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Token Services&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
This is actually pretty easy to accomplish. Refer back to the WIF magic sauce.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Authentication end-point&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
This is just (well, you know what I mean) a web page login control. We can’t do Windows
Authentication without Kerberos (or NTLM), and we can’t do Kerberos without Active
Directory (technically it could be done, but you’d be crazy to try).
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Attribute store-property-to-claim mapper&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
ADFS can connect to a bunch of different attribute stores, including custom built
stores if you provide assemblies. We only really need to map to a few LDAP properties,
and make it easy to map to other properties in the future.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Application management tool&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
This would be to manage the mapper and a few STS settings like URI names and certificates.
This, I think, would be a relatively simple application if we designed the configuration
database properly.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Proxy Services&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
Proxies are a pain in the butt. Useful in general, but we don’t really need to think
about this at the moment.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Some Warnings&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
There are some things that are worth mentioning. We have to be really careful about
what we create because we are developing a serious piece of the security infrastructure.
Yes, it is for a group of employees that won’t have much access to anything dangerous
(if they need access, they’d be migrated to Active Directory), but nevertheless we
are creating the main ingress point for the majority of our employees. It also needs
to be accessible from the internet.
&lt;/p&gt;
&lt;p&gt;
It may sound like I think it’ll be a synch to develop this system and have it work
securely, but in reality there is a lot that will need to go into it to protect the
network, the employees, and the data this could possibly interact with. It is tough
to develop applications securely. It is far harder to develop secure applications
whose sole responsibility is security related.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Next Steps&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
The next step is to design the thing. I know how it will exist in relation to the
systems it will be used to provide identity to, but aside from that, the architecture
of the thing is still unknown. With any luck I can accomplish rough designs tomorrow
on the train, on my way to visit family for the holiday.
&lt;/p&gt;
&lt;p&gt;
Better yet, maybe while visiting with family. &lt;img style="display:inline" alt="Winking smile" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/BuildyourownDirectoryFederationService_E2E1/wlEmoticon-winkingsmile_2.png" /&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.syfuhs.net/aggbug.ashx?id=1678b522-4ab8-489c-8f3d-755aef66642a" /&gt;</description>
      <comments>http://www.syfuhs.net/CommentView,guid,1678b522-4ab8-489c-8f3d-755aef66642a.aspx</comments>
      <category>Active Directory</category>
      <category>ADFS</category>
      <category>Architecture</category>
      <category>Claims</category>
      <category>Development</category>
      <category>Direcory Services</category>
      <category>Federation</category>
    </item>
    <item>
      <trackback:ping>http://www.syfuhs.net/Trackback.aspx?guid=3cc901e4-d761-4621-9f08-1e84e9f0a325</trackback:ping>
      <pingback:server>http://www.syfuhs.net/pingback.aspx</pingback:server>
      <pingback:target>http://www.syfuhs.net/PermaLink,guid,3cc901e4-d761-4621-9f08-1e84e9f0a325.aspx</pingback:target>
      <dc:creator>Steve Syfuhs</dc:creator>
      <wfw:comment>http://www.syfuhs.net/CommentView,guid,3cc901e4-d761-4621-9f08-1e84e9f0a325.aspx</wfw:comment>
      <wfw:commentRss>http://www.syfuhs.net/SyndicationService.asmx/GetEntryCommentsRss?guid=3cc901e4-d761-4621-9f08-1e84e9f0a325</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Earlier this week Twitter disabled Basic Authentication for clients, and switched
over to their new OAuth implementation.  It turns out though that OAuth is fairly
weak in a few areas, as it hasn’t really become a mature standard.  While this
isn’t the end of the world, it does leave each implementer to their own devices to
cover the weak points.
</p>
        <p>
This is just a quick overview of the one of the WTF’s that is Twitter OAuth, but <a href="http://arstechnica.com/security/guides/2010/09/twitter-a-case-study-on-how-to-do-oauth-wrong.ars/">Ars
Technica has a great article</a> on this in detail.
</p>
        <p>
One key point that Twitter seemed to miss entirely is how they handle client verification. 
I.e. proving that the client in question is really who they say they are.  For
instance, I use <a href="http://www.sobees.com/">Sobees</a> quite a bit, and have
been playing around with <a href="http://www.metrotwit.com/">MetroTwit</a> lately
too.  Twitter want’s each instance of Sobees to prove that it is Sobees. 
The client application does this by getting a public/private key and passing them
to the authentication mechanism.
</p>
        <p>
This seems odd.  How does the application store the private key?  Most implementations
will probably stick it in a config file while others might encrypt it.  Suffice
to say, all applications need this private key.  It is very easy to extract text
from binary structures, let alone config files, so what happens if I get another client’s
private key?
</p>
        <p>
Since this private key is used for identification, I could very easily stick that
key into my application and pretend that I am that application.  This wouldn’t
really lead to user PII being compromised, but it can easily cause harm.  Twitter’s
goal for this is to reduce spam, because if they track too much spam coming from certain
private keys they will revoke the key preventing the application from being able to
sign the user in.
</p>
        <p>
Who see’s the problem here?  What happens if my competitor steals my key and
starts spamming people?  My key gets revoked, and I need to replace it. 
If it’s a client application, that means updating it, testing it, deploying it, and
hope that the mass downtime across every instance doesn’t lose too many customers
for you.  Worse yet for those that have written iPhone apps, because that could
mean weeks of delays while Apple twiddles their thumbs.
</p>
        <p>
I suspect that they won’t revoke any keys once they come to their senses.  Or
more likely, will revoke a key for something like TweetDeck and hear the outcry from
the large user base.  After they can sign back in again, of course.
</p>
        <img width="0" height="0" src="http://www.syfuhs.net/aggbug.ashx?id=3cc901e4-d761-4621-9f08-1e84e9f0a325" />
      </body>
      <title>Vulnerabilities in Twitter’s OAuth Implementation</title>
      <guid isPermaLink="false">http://www.syfuhs.net/PermaLink,guid,3cc901e4-d761-4621-9f08-1e84e9f0a325.aspx</guid>
      <link>http://www.syfuhs.net/2010/09/03/VulnerabilitiesInTwittersOAuthImplementation.aspx</link>
      <pubDate>Fri, 03 Sep 2010 03:30:24 GMT</pubDate>
      <description>&lt;p&gt;
Earlier this week Twitter disabled Basic Authentication for clients, and switched
over to their new OAuth implementation.&amp;#160; It turns out though that OAuth is fairly
weak in a few areas, as it hasn’t really become a mature standard.&amp;#160; While this
isn’t the end of the world, it does leave each implementer to their own devices to
cover the weak points.
&lt;/p&gt;
&lt;p&gt;
This is just a quick overview of the one of the WTF’s that is Twitter OAuth, but &lt;a href="http://arstechnica.com/security/guides/2010/09/twitter-a-case-study-on-how-to-do-oauth-wrong.ars/"&gt;Ars
Technica has a great article&lt;/a&gt; on this in detail.
&lt;/p&gt;
&lt;p&gt;
One key point that Twitter seemed to miss entirely is how they handle client verification.&amp;#160;
I.e. proving that the client in question is really who they say they are.&amp;#160; For
instance, I use &lt;a href="http://www.sobees.com/"&gt;Sobees&lt;/a&gt; quite a bit, and have
been playing around with &lt;a href="http://www.metrotwit.com/"&gt;MetroTwit&lt;/a&gt; lately
too.&amp;#160; Twitter want’s each instance of Sobees to prove that it is Sobees.&amp;#160;
The client application does this by getting a public/private key and passing them
to the authentication mechanism.
&lt;/p&gt;
&lt;p&gt;
This seems odd.&amp;#160; How does the application store the private key?&amp;#160; Most implementations
will probably stick it in a config file while others might encrypt it.&amp;#160; Suffice
to say, all applications need this private key.&amp;#160; It is very easy to extract text
from binary structures, let alone config files, so what happens if I get another client’s
private key?
&lt;/p&gt;
&lt;p&gt;
Since this private key is used for identification, I could very easily stick that
key into my application and pretend that I am that application.&amp;#160; This wouldn’t
really lead to user PII being compromised, but it can easily cause harm.&amp;#160; Twitter’s
goal for this is to reduce spam, because if they track too much spam coming from certain
private keys they will revoke the key preventing the application from being able to
sign the user in.
&lt;/p&gt;
&lt;p&gt;
Who see’s the problem here?&amp;#160; What happens if my competitor steals my key and
starts spamming people?&amp;#160; My key gets revoked, and I need to replace it.&amp;#160;
If it’s a client application, that means updating it, testing it, deploying it, and
hope that the mass downtime across every instance doesn’t lose too many customers
for you.&amp;#160; Worse yet for those that have written iPhone apps, because that could
mean weeks of delays while Apple twiddles their thumbs.
&lt;/p&gt;
&lt;p&gt;
I suspect that they won’t revoke any keys once they come to their senses.&amp;#160; Or
more likely, will revoke a key for something like TweetDeck and hear the outcry from
the large user base.&amp;#160; After they can sign back in again, of course.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.syfuhs.net/aggbug.ashx?id=3cc901e4-d761-4621-9f08-1e84e9f0a325" /&gt;</description>
      <comments>http://www.syfuhs.net/CommentView,guid,3cc901e4-d761-4621-9f08-1e84e9f0a325.aspx</comments>
      <category>Authentication</category>
      <category>Bugs</category>
      <category>Twitter</category>
      <category>Vulnerabilities</category>
    </item>
    <item>
      <trackback:ping>http://www.syfuhs.net/Trackback.aspx?guid=aed8400a-b65e-4329-b4c2-5e9aa29a2a5c</trackback:ping>
      <pingback:server>http://www.syfuhs.net/pingback.aspx</pingback:server>
      <pingback:target>http://www.syfuhs.net/PermaLink,guid,aed8400a-b65e-4329-b4c2-5e9aa29a2a5c.aspx</pingback:target>
      <dc:creator>Steve Syfuhs</dc:creator>
      <wfw:comment>http://www.syfuhs.net/CommentView,guid,aed8400a-b65e-4329-b4c2-5e9aa29a2a5c.aspx</wfw:comment>
      <wfw:commentRss>http://www.syfuhs.net/SyndicationService.asmx/GetEntryCommentsRss?guid=aed8400a-b65e-4329-b4c2-5e9aa29a2a5c</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Using the Windows Identity Foundation to handle user authentication and identity management
can require you to drastically rethink how you will build your application. 
There are a few fundamental differences between how authentication and roles will
be handled when you switch to a Claims model.  
</p>
        <p>
As an example if you used an STS to provide Claims to your application, you wouldn’t
(couldn’t really) use the FormsAuthentication class.
</p>
        <p>
Another thing to keep in mind is how you would handle Roles.  WIF sort of handles
roles if you were to use &lt;location&gt; tags in web.config files like:
</p>
        <blockquote>
          <pre>  &lt;location path="test.aspx"&gt;<br />
    &lt;system.web&gt;<br />
      &lt;authorization&gt;<br />
        &lt;deny users="*" /&gt;<br />
        &lt;allow roles="admin" /&gt;<br />
      &lt;/authorization&gt;<br />
    &lt;/system.web&gt;<br />
  &lt;/location&gt;<br /></pre>
        </blockquote>
        <p>
WIF would handle this in an earlier part of the page lifecycle, and only allow authenticated
users with a returned Role claim of <em>admin</em>.  This works well for some
cases, but not all.
</p>
        <p>
In larger applications we may want custom Roles, and the ability to map these roles
to the Roles provided by the STS.  
</p>
        <p>
This is by no means a place to tell you when you should use what architectural design,
but a lot of times we want somewhere in the middle of these extremes… 
</p>
        <p>
Sometimes we just want to use the Roles class to check for role membership based on
the Role claims.  From what I can find there is no RolesProvider implementation
for WIF, so I wrote a <em>very</em> simple provider.  It is by all rights a hack. 
The reason I say this is because there are quite a few methods that just can’t be
implemented.  For instance, getting roles for other users is impossible, or adding
a user to a role, or creating a role, deleting a role, etc.  This is all impossible
because we can’t send anything back to the STS telling it what to do with the roles.
</p>
        <p>
We are also limited to the scope of the roles.  I can only get the roles of the
currently logged in user, nothing beyond.  So, with all the usual warnings (it
works on my machine, don’t blame me if it steals your soul, etc)…
</p>
        <pre class="c-sharp" name="code">
using System;
using System.Linq;
using System.Threading;
using System.Web.Security;
using Microsoft.IdentityModel.Claims;

public class ClaimsRoleProvider : RoleProvider
{
    IClaimsIdentity claimsIdentity;
    ClaimCollection userClaims;

    private void initClaims()
    {
        claimsIdentity = ((IClaimsPrincipal)(Thread.CurrentPrincipal)).Identities[0];
        userClaims = claimsIdentity.Claims;
    }

    public override string ApplicationName
    {
        get
        {
            initClaims();
            return claimsIdentity.GetType().ToString();
        }
        set
        {
            throw new NotImplementedException();
        }
    }

    public override bool RoleExists(string roleName)
    {
        initClaims();

        return userClaims.Where(r =&gt; r.Value == roleName).Any();
    }

    public override bool IsUserInRole(string username, string roleName)
    {
        initClaims();

        return userClaims.Where(r =&gt; r.Value == roleName).Any();
    }

    public override string[] GetRolesForUser(string username)
    {
        initClaims();

        return userClaims.Where(r =&gt; r.ClaimType == ClaimTypes.Role).Select(r =&gt; r.Value).ToArray();
    }

    public override string[] GetAllRoles()
    {
        initClaims();

        return userClaims.Where(r =&gt; r.ClaimType == ClaimTypes.Role).Select(r =&gt; r.Value).ToArray();
    }

    #region Not implementable

    public override string[] GetUsersInRole(string roleName)
    {
        throw new NotImplementedException();
    }

    public override void RemoveUsersFromRoles(string[] usernames, string[] roleNames)
    {
        throw new NotImplementedException();
    }

    public override void CreateRole(string roleName)
    {
        throw new NotImplementedException();
    }

    public override bool DeleteRole(string roleName, bool throwOnPopulatedRole)
    {
        throw new NotImplementedException();
    }

    public override string[] FindUsersInRole(string roleName, string usernameToMatch)
    {
        throw new NotImplementedException();
    }

    public override void AddUsersToRoles(string[] usernames, string[] roleNames)
    {
        throw new NotImplementedException();
    }

    #endregion
}</pre>
        <p>
The next step is to modify the web.config to use this provider.  I put this in
a separate assembly so it could be re-used.
</p>
        <pre>    &lt;roleManager enabled="true" defaultProvider="claimsRoleProvider"&gt;<br />
      &lt;providers&gt;<br />
        &lt;clear /&gt;<br />
        &lt;add name="claimsRoleProvider"
type="ClaimsRoleProvider, MyAssem.Providers,<br />
Version=1.0.0.0, Culture=neutral, PublicKeyToken=4a27739ef3347280" /&gt;<br />
      &lt;/providers&gt;<br />
    &lt;/roleManager&gt;<br /></pre>
        <p>
One final thing to be aware of… Roles.IsUserInRole(string roleName) uses IPrincipal.Identity.Name
in it’s overloaded version in lieu of a username parameter which could result in this
ArgumentNullException:
</p>
        <h4>
          <i>Value cannot be null. 
<br />
Parameter name: username</i>
        </h4>
        <b>Description: </b>An unhandled exception occurred during the execution of the current
web request. Please review the stack trace for more information about the error and
where it originated in the code. 
<br /><b>Exception Details: </b>System.ArgumentNullException: Value cannot be null. 
<br />
Parameter name: username 
<br /><b>Source Error:</b><p><code></code></p><pre>Line 17:         var claims = from c in claimsIdentity.Claims select c;
Line 18: 
Line 19:         bool inRole = Roles.IsUserInRole("VPN");
Line 20:         
Line 21:         foreach (var r in claims)</pre><p>
Since the IClaimsIdentity is getting generated based on the claims it receives, it
sets the Name property to whatever claim value is associated with the http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name
claim type. If one isn't present, it will be set to null. 
</p><p>
It took way too long for me to figure that one out. :)
</p><img width="0" height="0" src="http://www.syfuhs.net/aggbug.ashx?id=aed8400a-b65e-4329-b4c2-5e9aa29a2a5c" /></body>
      <title>Using the ASP.NET Roles Provider with Windows Identity Foundation</title>
      <guid isPermaLink="false">http://www.syfuhs.net/PermaLink,guid,aed8400a-b65e-4329-b4c2-5e9aa29a2a5c.aspx</guid>
      <link>http://www.syfuhs.net/2010/08/31/UsingTheASPNETRolesProviderWithWindowsIdentityFoundation.aspx</link>
      <pubDate>Tue, 31 Aug 2010 03:43:14 GMT</pubDate>
      <description>&lt;p&gt;
Using the Windows Identity Foundation to handle user authentication and identity management
can require you to drastically rethink how you will build your application.&amp;#160;
There are a few fundamental differences between how authentication and roles will
be handled when you switch to a Claims model.&amp;#160; 
&lt;/p&gt;
&lt;p&gt;
As an example if you used an STS to provide Claims to your application, you wouldn’t
(couldn’t really) use the FormsAuthentication class.
&lt;/p&gt;
&lt;p&gt;
Another thing to keep in mind is how you would handle Roles.&amp;#160; WIF sort of handles
roles if you were to use &amp;lt;location&amp;gt; tags in web.config files like:
&lt;/p&gt;
&lt;blockquote&gt; &lt;pre&gt;&amp;#160; &amp;lt;location path=&amp;quot;test.aspx&amp;quot;&amp;gt;&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160; &amp;lt;system.web&amp;gt;&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;authorization&amp;gt;&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;deny users=&amp;quot;*&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;allow roles=&amp;quot;admin&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/authorization&amp;gt;&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160; &amp;lt;/system.web&amp;gt;&lt;br /&gt;
&amp;#160; &amp;lt;/location&amp;gt;&lt;br /&gt;
&lt;/pre&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
WIF would handle this in an earlier part of the page lifecycle, and only allow authenticated
users with a returned Role claim of &lt;em&gt;admin&lt;/em&gt;.&amp;#160; This works well for some
cases, but not all.
&lt;/p&gt;
&lt;p&gt;
In larger applications we may want custom Roles, and the ability to map these roles
to the Roles provided by the STS.&amp;#160; 
&lt;/p&gt;
&lt;p&gt;
This is by no means a place to tell you when you should use what architectural design,
but a lot of times we want somewhere in the middle of these extremes… 
&lt;/p&gt;
&lt;p&gt;
Sometimes we just want to use the Roles class to check for role membership based on
the Role claims.&amp;#160; From what I can find there is no RolesProvider implementation
for WIF, so I wrote a &lt;em&gt;very&lt;/em&gt; simple provider.&amp;#160; It is by all rights a hack.&amp;#160;
The reason I say this is because there are quite a few methods that just can’t be
implemented.&amp;#160; For instance, getting roles for other users is impossible, or adding
a user to a role, or creating a role, deleting a role, etc.&amp;#160; This is all impossible
because we can’t send anything back to the STS telling it what to do with the roles.
&lt;/p&gt;
&lt;p&gt;
We are also limited to the scope of the roles.&amp;#160; I can only get the roles of the
currently logged in user, nothing beyond.&amp;#160; So, with all the usual warnings (it
works on my machine, don’t blame me if it steals your soul, etc)…
&lt;/p&gt;
&lt;pre class="c-sharp" name="code"&gt;
using System;
using System.Linq;
using System.Threading;
using System.Web.Security;
using Microsoft.IdentityModel.Claims;

public class ClaimsRoleProvider : RoleProvider
{
    IClaimsIdentity claimsIdentity;
    ClaimCollection userClaims;

    private void initClaims()
    {
        claimsIdentity = ((IClaimsPrincipal)(Thread.CurrentPrincipal)).Identities[0];
        userClaims = claimsIdentity.Claims;
    }

    public override string ApplicationName
    {
        get
        {
            initClaims();
            return claimsIdentity.GetType().ToString();
        }
        set
        {
            throw new NotImplementedException();
        }
    }

    public override bool RoleExists(string roleName)
    {
        initClaims();

        return userClaims.Where(r =&amp;gt; r.Value == roleName).Any();
    }

    public override bool IsUserInRole(string username, string roleName)
    {
        initClaims();

        return userClaims.Where(r =&amp;gt; r.Value == roleName).Any();
    }

    public override string[] GetRolesForUser(string username)
    {
        initClaims();

        return userClaims.Where(r =&amp;gt; r.ClaimType == ClaimTypes.Role).Select(r =&amp;gt; r.Value).ToArray();
    }

    public override string[] GetAllRoles()
    {
        initClaims();

        return userClaims.Where(r =&amp;gt; r.ClaimType == ClaimTypes.Role).Select(r =&amp;gt; r.Value).ToArray();
    }

    #region Not implementable

    public override string[] GetUsersInRole(string roleName)
    {
        throw new NotImplementedException();
    }

    public override void RemoveUsersFromRoles(string[] usernames, string[] roleNames)
    {
        throw new NotImplementedException();
    }

    public override void CreateRole(string roleName)
    {
        throw new NotImplementedException();
    }

    public override bool DeleteRole(string roleName, bool throwOnPopulatedRole)
    {
        throw new NotImplementedException();
    }

    public override string[] FindUsersInRole(string roleName, string usernameToMatch)
    {
        throw new NotImplementedException();
    }

    public override void AddUsersToRoles(string[] usernames, string[] roleNames)
    {
        throw new NotImplementedException();
    }

    #endregion
}&lt;/pre&gt;
&lt;p&gt;
The next step is to modify the web.config to use this provider.&amp;#160; I put this in
a separate assembly so it could be re-used.
&lt;/p&gt;
&lt;pre&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;roleManager enabled=&amp;quot;true&amp;quot; defaultProvider=&amp;quot;claimsRoleProvider&amp;quot;&amp;gt;&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;providers&amp;gt;&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;clear /&amp;gt;&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;add name=&amp;quot;claimsRoleProvider&amp;quot;
type=&amp;quot;ClaimsRoleProvider, MyAssem.Providers,&lt;br /&gt;
Version=1.0.0.0, Culture=neutral, PublicKeyToken=4a27739ef3347280&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/providers&amp;gt;&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160; &amp;lt;/roleManager&amp;gt;&lt;br /&gt;
&lt;/pre&gt;
&lt;p&gt;
One final thing to be aware of… Roles.IsUserInRole(string roleName) uses IPrincipal.Identity.Name
in it’s overloaded version in lieu of a username parameter which could result in this
ArgumentNullException:
&lt;/p&gt;
&lt;h4&gt;&lt;i&gt;Value cannot be null. 
&lt;br /&gt;
Parameter name: username&lt;/i&gt;
&lt;/h4&gt;
&lt;b&gt;Description: &lt;/b&gt;An unhandled exception occurred during the execution of the current
web request. Please review the stack trace for more information about the error and
where it originated in the code. 
&lt;br /&gt;
&lt;b&gt;Exception Details: &lt;/b&gt;System.ArgumentNullException: Value cannot be null. 
&lt;br /&gt;
Parameter name: username 
&lt;br /&gt;
&lt;b&gt;Source Error:&lt;/b&gt; 
&lt;p&gt;
&lt;code&gt;&lt;/code&gt;
&lt;/p&gt;
&lt;pre&gt;Line 17:         var claims = from c in claimsIdentity.Claims select c;
Line 18: 
Line 19:         bool inRole = Roles.IsUserInRole(&amp;quot;VPN&amp;quot;);
Line 20:         
Line 21:         foreach (var r in claims)&lt;/pre&gt;
&lt;p&gt;
Since the IClaimsIdentity is getting generated based on the claims it receives, it
sets the Name property to whatever claim value is associated with the http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name
claim type. If one isn't present, it will be set to null. 
&lt;/p&gt;
&lt;p&gt;
It took way too long for me to figure that one out. :)
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.syfuhs.net/aggbug.ashx?id=aed8400a-b65e-4329-b4c2-5e9aa29a2a5c" /&gt;</description>
      <comments>http://www.syfuhs.net/CommentView,guid,aed8400a-b65e-4329-b4c2-5e9aa29a2a5c.aspx</comments>
      <category>Claims</category>
      <category>Error Handling</category>
      <category>Exceptions</category>
      <category>IClaimsIdentity</category>
      <category>IClaimsPrincipal</category>
      <category>IPrincipal</category>
      <category>Providers</category>
      <category>Roles</category>
    </item>
    <item>
      <trackback:ping>http://www.syfuhs.net/Trackback.aspx?guid=ad180083-ec6b-4951-bd5d-9e0477bf3d7b</trackback:ping>
      <pingback:server>http://www.syfuhs.net/pingback.aspx</pingback:server>
      <pingback:target>http://www.syfuhs.net/PermaLink,guid,ad180083-ec6b-4951-bd5d-9e0477bf3d7b.aspx</pingback:target>
      <dc:creator>Steve Syfuhs</dc:creator>
      <wfw:comment>http://www.syfuhs.net/CommentView,guid,ad180083-ec6b-4951-bd5d-9e0477bf3d7b.aspx</wfw:comment>
      <wfw:commentRss>http://www.syfuhs.net/SyndicationService.asmx/GetEntryCommentsRss?guid=ad180083-ec6b-4951-bd5d-9e0477bf3d7b</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Over the last few years Microsoft has made a push for all of it’s Server Solutions
to have the capability of being managed via PowerShell.  Active Directory Federation
Services is no different.
</p>
        <p>
When we installed ADFS for the <a href="http://www.syfuhs.net/2010/08/14/InstallingADFS2AndFederatingAnApplication.aspx">first
time</a>, the installer told us it needed PowerShell as a pre-requisite, so we get
some cmdlets available to us out of the box.  Before we start playing around
with them though we need to register the cmdlets to our PowerShell session. We can
do with this command:
</p>
        <blockquote>
          <p>
Add-PSSnapin Microsoft.Adfs.PowerShell
</p>
        </blockquote>
        <p>
At this point we can now muck around with all of the available cmdlets.  For
a full list of <a href="http://technet.microsoft.com/en-ca/library/dd727967(WS.10).aspx">available
cmdlets for ADFS check out TechNet</a>.
</p>
        <p>
Let’s take a look at our ADFS Server Properties:
</p>
        <blockquote>
          <p>
Get-AdfsProperties
</p>
        </blockquote>
        <blockquote>
          <p>
AcceptableIdentifiers          : {} 
<br />
AddProxyAuthorizationRules     : […snip…] 
<br />
AutoCertificateRollover        : True 
<br />
CertificateCriticalThreshold   : 2 
<br />
CertificateDuration           
: 365 
<br />
CertificateGenerationThreshold : 20 
<br />
CertificatePromotionThreshold  : 5 
<br />
CertificateRolloverInterval    : 720 
<br />
CertificateSharingContainer    : 
<br />
CertificateThresholdMultiplier : 1440 
<br />
ClientCertRevocationCheck      : None 
<br />
ContactPerson                 
: 
<br />
DisplayName                   
: WEB1.nexus.external.test 
<br />
ExtendedProtectionTokenCheck   : Allow 
<br />
FederationPassiveAddress       : /adfs/ls/ 
<br />
HostName                      
: WEB1.nexus.external.test 
<br />
HttpPort                      
: 80 
<br />
HttpsPort                     
: 443 
<br />
Identifier                    
: http://web1.nexus.external.test/adfs/services/trust 
<br />
InstalledLanguage             
: en-US 
<br />
LogLevel                      
: {Errors, Information, Verbose, Warnings} 
<br />
MonitoringInterval            
: 1440 
<br />
NetTcpPort                    
: 1501 
<br />
NtlmOnlySupportedClientAtProxy : False 
<br />
OrganizationInfo              
: 
<br />
PreventTokenReplays           
: True 
<br />
ProxyTrustId                  
: 58cb3f40-0633-4d9e-b3c2-84f9bc8c2ce8 
<br />
ProxyTrustTokenLifetime        : 21600 
<br />
ReplayCacheExpirationInterval  : 60 
<br />
SignedSamlRequestsRequired     : False 
<br />
SamlMessageDeliveryWindow      : 5 
<br />
SignSamlAuthnRequests          : False 
<br />
SsoLifetime                   
: 480
</p>
        </blockquote>
        <p>
Nothing fancy there.  What about updating?
</p>
        <blockquote>
          <p>
get-help Set-AdfsProperties
</p>
        </blockquote>
        <p>
Yep, we can do that:
</p>
        <blockquote>
          <p>
NAME 
<br />
    Set-ADFSProperties 
<br />
    
<br />
SYNOPSIS 
<br />
    Sets the properties of the Federation Service. 
<br />
    
<br />
    
<br />
SYNTAX  
<br />
    […snip…]     
<br />
    
<br />
DETAILED DESCRIPTION 
<br />
    The Set-ADFSProperties cmdlet sets the global properties and configuration
of the Federation Service. 
</p>
        </blockquote>
        <p>
Updating settings isn’t all that exciting, so what about managing Relying Parties?
</p>
        <blockquote>
          <p>
Add-ADFSRelyingPartyTrust 
<br />
Get-ADFSRelyingPartyTrust 
<br />
Remove-ADFSRelyingPartyTrust 
<br />
Enable-ADFSRelyingPartyTrust 
<br />
Disable-ADFSRelyingPartyTrust 
<br />
Update-ADFSRelyingPartyTrust
</p>
        </blockquote>
        <p>
You can also manage things like Certificates:
</p>
        <blockquote>
          <p>
Add-ADFSCertificate 
<br />
Remove-ADFSCertificate 
<br />
Update-ADFSCertificate 
</p>
        </blockquote>
        <p>
There are many more things you can do from within PowerShell.  Again, for the
full list <a href="http://technet.microsoft.com/en-ca/library/dd727967(WS.10).aspx">check
out TechNet</a>.
</p>
        <p>
Being able to manage ADFS directly from PowerShell makes things a lot easier. 
Not only for those who aren’t too keen on using MMC snap-ins, but also for the developers
to automate deployment for testing and development.
</p>
        <img width="0" height="0" src="http://www.syfuhs.net/aggbug.ashx?id=ad180083-ec6b-4951-bd5d-9e0477bf3d7b" />
      </body>
      <title>Working with ADFS 2 via PowerShell</title>
      <guid isPermaLink="false">http://www.syfuhs.net/PermaLink,guid,ad180083-ec6b-4951-bd5d-9e0477bf3d7b.aspx</guid>
      <link>http://www.syfuhs.net/2010/08/19/WorkingWithADFS2ViaPowerShell.aspx</link>
      <pubDate>Thu, 19 Aug 2010 03:22:46 GMT</pubDate>
      <description>&lt;p&gt;
Over the last few years Microsoft has made a push for all of it’s Server Solutions
to have the capability of being managed via PowerShell.&amp;#160; Active Directory Federation
Services is no different.
&lt;/p&gt;
&lt;p&gt;
When we installed ADFS for the &lt;a href="http://www.syfuhs.net/2010/08/14/InstallingADFS2AndFederatingAnApplication.aspx"&gt;first
time&lt;/a&gt;, the installer told us it needed PowerShell as a pre-requisite, so we get
some cmdlets available to us out of the box.&amp;#160; Before we start playing around
with them though we need to register the cmdlets to our PowerShell session. We can
do with this command:
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
Add-PSSnapin Microsoft.Adfs.PowerShell
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
At this point we can now muck around with all of the available cmdlets.&amp;#160; For
a full list of &lt;a href="http://technet.microsoft.com/en-ca/library/dd727967(WS.10).aspx"&gt;available
cmdlets for ADFS check out TechNet&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
Let’s take a look at our ADFS Server Properties:
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
Get-AdfsProperties
&lt;/p&gt;
&lt;/blockquote&gt; &lt;blockquote&gt; 
&lt;p&gt;
AcceptableIdentifiers&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; : {} 
&lt;br /&gt;
AddProxyAuthorizationRules&amp;#160;&amp;#160;&amp;#160;&amp;#160; : […snip…] 
&lt;br /&gt;
AutoCertificateRollover&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; : True 
&lt;br /&gt;
CertificateCriticalThreshold&amp;#160;&amp;#160; : 2 
&lt;br /&gt;
CertificateDuration&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;
: 365 
&lt;br /&gt;
CertificateGenerationThreshold : 20 
&lt;br /&gt;
CertificatePromotionThreshold&amp;#160; : 5 
&lt;br /&gt;
CertificateRolloverInterval&amp;#160;&amp;#160;&amp;#160; : 720 
&lt;br /&gt;
CertificateSharingContainer&amp;#160;&amp;#160;&amp;#160; : 
&lt;br /&gt;
CertificateThresholdMultiplier : 1440 
&lt;br /&gt;
ClientCertRevocationCheck&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; : None 
&lt;br /&gt;
ContactPerson&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;
: 
&lt;br /&gt;
DisplayName&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;
: WEB1.nexus.external.test 
&lt;br /&gt;
ExtendedProtectionTokenCheck&amp;#160;&amp;#160; : Allow 
&lt;br /&gt;
FederationPassiveAddress&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; : /adfs/ls/ 
&lt;br /&gt;
HostName&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;
: WEB1.nexus.external.test 
&lt;br /&gt;
HttpPort&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;
: 80 
&lt;br /&gt;
HttpsPort&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;
: 443 
&lt;br /&gt;
Identifier&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;
: http://web1.nexus.external.test/adfs/services/trust 
&lt;br /&gt;
InstalledLanguage&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;
: en-US 
&lt;br /&gt;
LogLevel&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;
: {Errors, Information, Verbose, Warnings} 
&lt;br /&gt;
MonitoringInterval&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;
: 1440 
&lt;br /&gt;
NetTcpPort&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;
: 1501 
&lt;br /&gt;
NtlmOnlySupportedClientAtProxy : False 
&lt;br /&gt;
OrganizationInfo&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;
: 
&lt;br /&gt;
PreventTokenReplays&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;
: True 
&lt;br /&gt;
ProxyTrustId&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;
: 58cb3f40-0633-4d9e-b3c2-84f9bc8c2ce8 
&lt;br /&gt;
ProxyTrustTokenLifetime&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; : 21600 
&lt;br /&gt;
ReplayCacheExpirationInterval&amp;#160; : 60 
&lt;br /&gt;
SignedSamlRequestsRequired&amp;#160;&amp;#160;&amp;#160;&amp;#160; : False 
&lt;br /&gt;
SamlMessageDeliveryWindow&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; : 5 
&lt;br /&gt;
SignSamlAuthnRequests&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; : False 
&lt;br /&gt;
SsoLifetime&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;
: 480
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
Nothing fancy there.&amp;#160; What about updating?
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
get-help Set-AdfsProperties
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
Yep, we can do that:
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
NAME 
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160; Set-ADFSProperties 
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160; 
&lt;br /&gt;
SYNOPSIS 
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160; Sets the properties of the Federation Service. 
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160; 
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160; 
&lt;br /&gt;
SYNTAX&amp;#160; 
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160; […snip…]&amp;#160;&amp;#160;&amp;#160;&amp;#160; 
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160; 
&lt;br /&gt;
DETAILED DESCRIPTION 
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160; The Set-ADFSProperties cmdlet sets the global properties and configuration
of the Federation Service. 
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
Updating settings isn’t all that exciting, so what about managing Relying Parties?
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
Add-ADFSRelyingPartyTrust 
&lt;br /&gt;
Get-ADFSRelyingPartyTrust 
&lt;br /&gt;
Remove-ADFSRelyingPartyTrust 
&lt;br /&gt;
Enable-ADFSRelyingPartyTrust 
&lt;br /&gt;
Disable-ADFSRelyingPartyTrust 
&lt;br /&gt;
Update-ADFSRelyingPartyTrust
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
You can also manage things like Certificates:
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
Add-ADFSCertificate 
&lt;br /&gt;
Remove-ADFSCertificate 
&lt;br /&gt;
Update-ADFSCertificate 
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
There are many more things you can do from within PowerShell.&amp;#160; Again, for the
full list &lt;a href="http://technet.microsoft.com/en-ca/library/dd727967(WS.10).aspx"&gt;check
out TechNet&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
Being able to manage ADFS directly from PowerShell makes things a lot easier.&amp;#160;
Not only for those who aren’t too keen on using MMC snap-ins, but also for the developers
to automate deployment for testing and development.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.syfuhs.net/aggbug.ashx?id=ad180083-ec6b-4951-bd5d-9e0477bf3d7b" /&gt;</description>
      <comments>http://www.syfuhs.net/CommentView,guid,ad180083-ec6b-4951-bd5d-9e0477bf3d7b.aspx</comments>
      <category>ADFS</category>
      <category>management</category>
      <category>PowerShell</category>
    </item>
    <item>
      <trackback:ping>http://www.syfuhs.net/Trackback.aspx?guid=e79f0a19-99bf-4870-9fd0-6593a5e59588</trackback:ping>
      <pingback:server>http://www.syfuhs.net/pingback.aspx</pingback:server>
      <pingback:target>http://www.syfuhs.net/PermaLink,guid,e79f0a19-99bf-4870-9fd0-6593a5e59588.aspx</pingback:target>
      <dc:creator>Steve Syfuhs</dc:creator>
      <wfw:comment>http://www.syfuhs.net/CommentView,guid,e79f0a19-99bf-4870-9fd0-6593a5e59588.aspx</wfw:comment>
      <wfw:commentRss>http://www.syfuhs.net/SyndicationService.asmx/GetEntryCommentsRss?guid=e79f0a19-99bf-4870-9fd0-6593a5e59588</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Originally found on <a href="http://www.schneier.com/blog/archives/2010/08/crypto_2010_pro.html">Bruce
Schneier</a>’s blog.  All credit to him…
</p>
        <p>
Springer-Verlag publishes the <a href="http://www.amazon.com/exec/obidos/ASIN/3642146228/counterpane/">proceedings</a>,
but they're available as a <a href="http://www.iacr.org/conferences/crypto2010/download.html">free
download</a> for the next few days.
</p>
        <p>
Interesting read.
</p>
        <img width="0" height="0" src="http://www.syfuhs.net/aggbug.ashx?id=e79f0a19-99bf-4870-9fd0-6593a5e59588" />
      </body>
      <title>Proceedings from the Crypto 2010 Conference</title>
      <guid isPermaLink="false">http://www.syfuhs.net/PermaLink,guid,e79f0a19-99bf-4870-9fd0-6593a5e59588.aspx</guid>
      <link>http://www.syfuhs.net/2010/08/17/ProceedingsFromTheCrypto2010Conference.aspx</link>
      <pubDate>Tue, 17 Aug 2010 17:51:20 GMT</pubDate>
      <description>&lt;p&gt;
Originally found on &lt;a href="http://www.schneier.com/blog/archives/2010/08/crypto_2010_pro.html"&gt;Bruce
Schneier&lt;/a&gt;’s blog.&amp;#160; All credit to him…
&lt;/p&gt;
&lt;p&gt;
Springer-Verlag publishes the &lt;a href="http://www.amazon.com/exec/obidos/ASIN/3642146228/counterpane/"&gt;proceedings&lt;/a&gt;,
but they're available as a &lt;a href="http://www.iacr.org/conferences/crypto2010/download.html"&gt;free
download&lt;/a&gt; for the next few days.
&lt;/p&gt;
&lt;p&gt;
Interesting read.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.syfuhs.net/aggbug.ashx?id=e79f0a19-99bf-4870-9fd0-6593a5e59588" /&gt;</description>
      <comments>http://www.syfuhs.net/CommentView,guid,e79f0a19-99bf-4870-9fd0-6593a5e59588.aspx</comments>
      <category>Bruce Schneier</category>
      <category>Conferences</category>
      <category>Cryptography</category>
    </item>
    <item>
      <trackback:ping>http://www.syfuhs.net/Trackback.aspx?guid=4a03dde7-ec4d-4fd9-92f2-746a7f859fb2</trackback:ping>
      <pingback:server>http://www.syfuhs.net/pingback.aspx</pingback:server>
      <pingback:target>http://www.syfuhs.net/PermaLink,guid,4a03dde7-ec4d-4fd9-92f2-746a7f859fb2.aspx</pingback:target>
      <dc:creator>Steve Syfuhs</dc:creator>
      <wfw:comment>http://www.syfuhs.net/CommentView,guid,4a03dde7-ec4d-4fd9-92f2-746a7f859fb2.aspx</wfw:comment>
      <wfw:commentRss>http://www.syfuhs.net/SyndicationService.asmx/GetEntryCommentsRss?guid=4a03dde7-ec4d-4fd9-92f2-746a7f859fb2</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Some videos from the last PDC…
</p>
        <ul>
          <li>
            <a href="http://www.microsoftpdc.com/2009/P09-21">Windows Identity Foundation Overview</a>
          </li>
          <li>
            <a href="http://www.microsoftpdc.com/2009/SVC17">Enabling Single Sign-On to Windows
Azure Applications</a>
          </li>
          <li>
            <a href="http://www.microsoftpdc.com/2009/SVC10">Software + Services Identity Roadmap
Update</a>
          </li>
          <li>
            <a href="http://www.microsoftpdc.com/2009/SVC28">The ‘M’-Based System.Identity Model
for Accessing Directory Services</a>
          </li>
        </ul>
        <p>
LOTS of information…
</p>
        <img width="0" height="0" src="http://www.syfuhs.net/aggbug.ashx?id=4a03dde7-ec4d-4fd9-92f2-746a7f859fb2" />
      </body>
      <title>Videos on Identity Foundation and ADFS</title>
      <guid isPermaLink="false">http://www.syfuhs.net/PermaLink,guid,4a03dde7-ec4d-4fd9-92f2-746a7f859fb2.aspx</guid>
      <link>http://www.syfuhs.net/2010/08/15/VideosOnIdentityFoundationAndADFS.aspx</link>
      <pubDate>Sun, 15 Aug 2010 21:19:21 GMT</pubDate>
      <description>&lt;p&gt;
Some videos from the last PDC…
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="http://www.microsoftpdc.com/2009/P09-21"&gt;Windows Identity Foundation Overview&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://www.microsoftpdc.com/2009/SVC17"&gt;Enabling Single Sign-On to Windows
Azure Applications&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://www.microsoftpdc.com/2009/SVC10"&gt;Software + Services Identity Roadmap
Update&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://www.microsoftpdc.com/2009/SVC28"&gt;The ‘M’-Based System.Identity Model
for Accessing Directory Services&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
LOTS of information…
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.syfuhs.net/aggbug.ashx?id=4a03dde7-ec4d-4fd9-92f2-746a7f859fb2" /&gt;</description>
      <comments>http://www.syfuhs.net/CommentView,guid,4a03dde7-ec4d-4fd9-92f2-746a7f859fb2.aspx</comments>
      <category>ADFS</category>
      <category>Identity</category>
      <category>Software + Services</category>
      <category>Videos</category>
      <category>WIF</category>
    </item>
    <item>
      <trackback:ping>http://www.syfuhs.net/Trackback.aspx?guid=2b3710e6-0faa-4119-b1f0-600375990875</trackback:ping>
      <pingback:server>http://www.syfuhs.net/pingback.aspx</pingback:server>
      <pingback:target>http://www.syfuhs.net/PermaLink,guid,2b3710e6-0faa-4119-b1f0-600375990875.aspx</pingback:target>
      <dc:creator>Steve Syfuhs</dc:creator>
      <wfw:comment>http://www.syfuhs.net/CommentView,guid,2b3710e6-0faa-4119-b1f0-600375990875.aspx</wfw:comment>
      <wfw:commentRss>http://www.syfuhs.net/SyndicationService.asmx/GetEntryCommentsRss?guid=2b3710e6-0faa-4119-b1f0-600375990875</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
One of the problems with pushing all this data back and forth between Token Services
and clients and Relying Parties is that some of this information really needs to encrypted. 
If someone can eavesdrop on your communications and catch your token authorization
they could easily impersonate you.  We don’t want that.  As such, we use
certificates in ADFS for EVERYTHING.
</p>
        <p>
The problem with doing things this way is that certificates are a pain in the neck. 
With ADFS we need at least three certificates for each server:
</p>
        <ul>
          <li>
            <strong>Service Communication certificate:</strong> This certificate is used for SSL
communications for web services and connections between proxies.  This is the
certificate used by IIS for the Federation Service site.</li>
          <li>
            <strong>Token Signing certificate: </strong>This certificate is used to sign all tokens
passed to the client.</li>
          <li>
            <strong>Token decryption certificate: </strong>This certificate is used for decrypting
incoming tokens.  This would be the private key for the Service Communication
certificate.</li>
        </ul>
        <p>
Managing these certificates isn’t easy.  Sometimes we can get away with just
using our domain CA, other times we need 3rd party CA’s to sign them.  Microsoft
has provided lots of guidance in this, but it’s not the easiest to find.  You
can access it on TechNet (Certificate Requirements for Federation Servers): <a title="http://technet.microsoft.com/en-ca/library/dd807040(WS.10).aspx" href="http://technet.microsoft.com/en-ca/library/dd807040(WS.10).aspx">http://technet.microsoft.com/en-ca/library/dd807040(WS.10).aspx</a></p>
        <p>
Hopefully that helps.
</p>
        <img width="0" height="0" src="http://www.syfuhs.net/aggbug.ashx?id=2b3710e6-0faa-4119-b1f0-600375990875" />
      </body>
      <title>Certificates and ADFS 2.0</title>
      <guid isPermaLink="false">http://www.syfuhs.net/PermaLink,guid,2b3710e6-0faa-4119-b1f0-600375990875.aspx</guid>
      <link>http://www.syfuhs.net/2010/08/15/CertificatesAndADFS20.aspx</link>
      <pubDate>Sun, 15 Aug 2010 20:54:11 GMT</pubDate>
      <description>&lt;p&gt;
One of the problems with pushing all this data back and forth between Token Services
and clients and Relying Parties is that some of this information really needs to encrypted.&amp;#160;
If someone can eavesdrop on your communications and catch your token authorization
they could easily impersonate you.&amp;#160; We don’t want that.&amp;#160; As such, we use
certificates in ADFS for EVERYTHING.
&lt;/p&gt;
&lt;p&gt;
The problem with doing things this way is that certificates are a pain in the neck.&amp;#160;
With ADFS we need at least three certificates for each server:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Service Communication certificate:&lt;/strong&gt; This certificate is used for SSL
communications for web services and connections between proxies.&amp;#160; This is the
certificate used by IIS for the Federation Service site.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Token Signing certificate: &lt;/strong&gt;This certificate is used to sign all tokens
passed to the client.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Token decryption certificate: &lt;/strong&gt;This certificate is used for decrypting
incoming tokens.&amp;#160; This would be the private key for the Service Communication
certificate.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Managing these certificates isn’t easy.&amp;#160; Sometimes we can get away with just
using our domain CA, other times we need 3rd party CA’s to sign them.&amp;#160; Microsoft
has provided lots of guidance in this, but it’s not the easiest to find.&amp;#160; You
can access it on TechNet (Certificate Requirements for Federation Servers): &lt;a title="http://technet.microsoft.com/en-ca/library/dd807040(WS.10).aspx" href="http://technet.microsoft.com/en-ca/library/dd807040(WS.10).aspx"&gt;http://technet.microsoft.com/en-ca/library/dd807040(WS.10).aspx&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Hopefully that helps.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.syfuhs.net/aggbug.ashx?id=2b3710e6-0faa-4119-b1f0-600375990875" /&gt;</description>
      <comments>http://www.syfuhs.net/CommentView,guid,2b3710e6-0faa-4119-b1f0-600375990875.aspx</comments>
      <category>ADFS</category>
      <category>Certificates</category>
      <category>Technet</category>
    </item>
    <item>
      <trackback:ping>http://www.syfuhs.net/Trackback.aspx?guid=6a7689dd-5a00-450c-8173-75529e2236e1</trackback:ping>
      <pingback:server>http://www.syfuhs.net/pingback.aspx</pingback:server>
      <pingback:target>http://www.syfuhs.net/PermaLink,guid,6a7689dd-5a00-450c-8173-75529e2236e1.aspx</pingback:target>
      <dc:creator>Steve Syfuhs</dc:creator>
      <wfw:comment>http://www.syfuhs.net/CommentView,guid,6a7689dd-5a00-450c-8173-75529e2236e1.aspx</wfw:comment>
      <wfw:commentRss>http://www.syfuhs.net/SyndicationService.asmx/GetEntryCommentsRss?guid=6a7689dd-5a00-450c-8173-75529e2236e1</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
One of the issues I hear about hosting services in the cloud has to do with managing
Identity.  Since the service isn’t local, it’s harder to tie it into services
like Active Directory.  What do I mean by this?
</p>
        <p>
I’m kind of particular how certain things work.  I hate having more than one
set of credentials across applications.  Theoretically since we can’t join our
Azure Servers to our domain, there’s a good chance we will need separate credentials
between our internal domain and Cloud Services.  However, it’s possible to make
our Cloud Applications use our Active Directory credentials via a Claims Service.
</p>
        <p>
With Federation Services it’s surprisingly easy to do.  Yesterday we talked about <a href="http://www.syfuhs.net/2010/08/14/InstallingADFS2AndFederatingAnApplication.aspx">installing
Active Directory Federation Services and federating an application</a>.  Today
we will talk about what it takes to get things talking between Azure and ADFS.
</p>
        <p>
As a recap, yesterday we:
</p>
        <ol>
          <li>
Installed prerequisites</li>
          <li>
Installed ADFS 2.0 on a domain joined server</li>
          <li>
Created a relying party</li>
          <li>
Created claims mappings to data in Active Directory</li>
          <li>
Created a simple Claims-Aware application</li>
        </ol>
        <p>
So what do we need to do next?  There really isn’t much we need to do:
</p>
        <ol>
          <li>
Build Azure App</li>
          <li>
Federate it using FedUtil.exe</li>
        </ol>
        <p>
Building an Azure application isn’t trivial, but we don’t need to know much to Federate
it.  
</p>
        <p>
How do we federate it?  Follow <a href="http://www.syfuhs.net/2010/08/03/MakingAnASPNETWebsiteClaimsAwareWithTheWindowsIdentityFoundation.aspx">these
steps</a> providing the Azure details for the application URI and the Federation Metadata
from ADFS.  
</p>
        <p>
One of the gotcha’s with deploying to Azure though is that the Microsoft.IdentityModel
assembly is not part of the GAC, and it’s not in Azure builds.  Therefore we
need to copy the assembly to the bin folder for deployment.  We do that by going
to the Microsoft.IdentityModel reference properties and setting Copy Local to true:
</p>
        <p>
          <a href="http://www.syfuhs.net/content/binary/WindowsLiveWriter/EnablingSingleSignOn_C61D/image_2.png">
            <img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/EnablingSingleSignOn_C61D/image_thumb.png" width="438" height="322" />
          </a>
        </p>
        <p>
That isn’t the only gotcha.  We need to keep in mind how data is transferred
between Cloud and intranet.  In most cases, nothing goes on behind the scenes;
it passes across the client’s browser through POST calls.  If the client’s browser
is on the local intranet, when it hits the cloud app it will redirect to an intranet
location.  This works because the client has access to both the cloud app and
can access ADFS.  This isn’t necessarily the case with people who work offsite,
or are partners with the company.
</p>
        <p>
          <em>We need to have the ADFS Server accessible to the public</em>.  This is kind
of an ugly situation.  Leaving the politics out of this, we are sticking a domain
joined system out in the public that’s sole responsibility is authentication and identity
mapping.
</p>
        <p>
One way to mitigate certain risks is to use an ADFS Proxy Service.  This service
will sit on a non-domain joined system sitting on an edge network that creates a connection
to the ADFS Server sitting inside the corporate network.  External applications
would use the Proxy service.
</p>
        <p>
Installing the Proxy service is relatively simple, but a topic for another post.
</p>
        <img width="0" height="0" src="http://www.syfuhs.net/aggbug.ashx?id=6a7689dd-5a00-450c-8173-75529e2236e1" />
      </body>
      <title>Single Sign-On Between the Cloud and On-Premise using ADFS 2</title>
      <guid isPermaLink="false">http://www.syfuhs.net/PermaLink,guid,6a7689dd-5a00-450c-8173-75529e2236e1.aspx</guid>
      <link>http://www.syfuhs.net/2010/08/15/SingleSignOnBetweenTheCloudAndOnPremiseUsingADFS2.aspx</link>
      <pubDate>Sun, 15 Aug 2010 20:09:38 GMT</pubDate>
      <description>&lt;p&gt;
One of the issues I hear about hosting services in the cloud has to do with managing
Identity.&amp;#160; Since the service isn’t local, it’s harder to tie it into services
like Active Directory.&amp;#160; What do I mean by this?
&lt;/p&gt;
&lt;p&gt;
I’m kind of particular how certain things work.&amp;#160; I hate having more than one
set of credentials across applications.&amp;#160; Theoretically since we can’t join our
Azure Servers to our domain, there’s a good chance we will need separate credentials
between our internal domain and Cloud Services.&amp;#160; However, it’s possible to make
our Cloud Applications use our Active Directory credentials via a Claims Service.
&lt;/p&gt;
&lt;p&gt;
With Federation Services it’s surprisingly easy to do.&amp;#160; Yesterday we talked about &lt;a href="http://www.syfuhs.net/2010/08/14/InstallingADFS2AndFederatingAnApplication.aspx"&gt;installing
Active Directory Federation Services and federating an application&lt;/a&gt;.&amp;#160; Today
we will talk about what it takes to get things talking between Azure and ADFS.
&lt;/p&gt;
&lt;p&gt;
As a recap, yesterday we:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Installed prerequisites&lt;/li&gt;
&lt;li&gt;
Installed ADFS 2.0 on a domain joined server&lt;/li&gt;
&lt;li&gt;
Created a relying party&lt;/li&gt;
&lt;li&gt;
Created claims mappings to data in Active Directory&lt;/li&gt;
&lt;li&gt;
Created a simple Claims-Aware application&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
So what do we need to do next?&amp;#160; There really isn’t much we need to do:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Build Azure App&lt;/li&gt;
&lt;li&gt;
Federate it using FedUtil.exe&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
Building an Azure application isn’t trivial, but we don’t need to know much to Federate
it.&amp;#160; 
&lt;/p&gt;
&lt;p&gt;
How do we federate it?&amp;#160; Follow &lt;a href="http://www.syfuhs.net/2010/08/03/MakingAnASPNETWebsiteClaimsAwareWithTheWindowsIdentityFoundation.aspx"&gt;these
steps&lt;/a&gt; providing the Azure details for the application URI and the Federation Metadata
from ADFS.&amp;#160; 
&lt;/p&gt;
&lt;p&gt;
One of the gotcha’s with deploying to Azure though is that the Microsoft.IdentityModel
assembly is not part of the GAC, and it’s not in Azure builds.&amp;#160; Therefore we
need to copy the assembly to the bin folder for deployment.&amp;#160; We do that by going
to the Microsoft.IdentityModel reference properties and setting Copy Local to true:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.syfuhs.net/content/binary/WindowsLiveWriter/EnablingSingleSignOn_C61D/image_2.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/EnablingSingleSignOn_C61D/image_thumb.png" width="438" height="322" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
That isn’t the only gotcha.&amp;#160; We need to keep in mind how data is transferred
between Cloud and intranet.&amp;#160; In most cases, nothing goes on behind the scenes;
it passes across the client’s browser through POST calls.&amp;#160; If the client’s browser
is on the local intranet, when it hits the cloud app it will redirect to an intranet
location.&amp;#160; This works because the client has access to both the cloud app and
can access ADFS.&amp;#160; This isn’t necessarily the case with people who work offsite,
or are partners with the company.
&lt;/p&gt;
&lt;p&gt;
&lt;em&gt;We need to have the ADFS Server accessible to the public&lt;/em&gt;.&amp;#160; This is kind
of an ugly situation.&amp;#160; Leaving the politics out of this, we are sticking a domain
joined system out in the public that’s sole responsibility is authentication and identity
mapping.
&lt;/p&gt;
&lt;p&gt;
One way to mitigate certain risks is to use an ADFS Proxy Service.&amp;#160; This service
will sit on a non-domain joined system sitting on an edge network that creates a connection
to the ADFS Server sitting inside the corporate network.&amp;#160; External applications
would use the Proxy service.
&lt;/p&gt;
&lt;p&gt;
Installing the Proxy service is relatively simple, but a topic for another post.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.syfuhs.net/aggbug.ashx?id=6a7689dd-5a00-450c-8173-75529e2236e1" /&gt;</description>
      <comments>http://www.syfuhs.net/CommentView,guid,6a7689dd-5a00-450c-8173-75529e2236e1.aspx</comments>
      <category>Active Directory</category>
      <category>ADFS</category>
      <category>Azure</category>
      <category>Claims</category>
      <category>Proxy</category>
      <category>Single Sign-On</category>
    </item>
    <item>
      <trackback:ping>http://www.syfuhs.net/Trackback.aspx?guid=046a6d7b-ea3b-473a-94aa-5e986f30fed5</trackback:ping>
      <pingback:server>http://www.syfuhs.net/pingback.aspx</pingback:server>
      <pingback:target>http://www.syfuhs.net/PermaLink,guid,046a6d7b-ea3b-473a-94aa-5e986f30fed5.aspx</pingback:target>
      <dc:creator>Steve Syfuhs</dc:creator>
      <wfw:comment>http://www.syfuhs.net/CommentView,guid,046a6d7b-ea3b-473a-94aa-5e986f30fed5.aspx</wfw:comment>
      <wfw:commentRss>http://www.syfuhs.net/SyndicationService.asmx/GetEntryCommentsRss?guid=046a6d7b-ea3b-473a-94aa-5e986f30fed5</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
From Microsoft Marketing, ADFS 2.0 is:
</p>
        <blockquote>
          <p>
Active Directory Federation Services 2.0 helps IT enable users to collaborate across
organizational boundaries and easily access applications on-premises and in the cloud,
while maintaining application security. Through a <font style="background-color: #ffff00">claims-based
infrastructure</font>, IT can enable a single sign-on experience for end-users to
applications without requiring a separate account or password, whether applications
are located in partner organizations or hosted in the cloud.
</p>
        </blockquote>
        <p>
So, it’s a Token Service plus some.  In a previous post I had said:
</p>
        <blockquote>
          <p>
In other words it is a method for <font style="background-color: #ffff00">centralizing
user Identity information</font>, very much like how the Windows Live and OpenID systems
work.  The system is reasonably simple.  I have a Membership data store
that contains user information.  I want (n) number of websites to use that membership
store, EXCEPT I don’t want each application to have direct access to membership data
such as passwords.  The way around it is through claims.
</p>
        </blockquote>
        <p>
The membership store in this case being Active Directory.
</p>
        <p>
I thought it would be a good idea to run through how to install ADFS and set up an
application to use it.  Since we already discussed how to federate an application
using FedUtil.exe, I will let you go through the <a href="http://www.syfuhs.net/2010/08/03/MakingAnASPNETWebsiteClaimsAwareWithTheWindowsIdentityFoundation.aspx">steps
in the previous post</a>.  I will provide information on where to find the Metadata
later on in this post.
</p>
        <p>
          <strong>But First: The Prerequisites</strong>
        </p>
        <ol>
          <li>
Join the Server to the Domain. (I’ve started the installation of ADFS three times
on non-domain joined systems.  Doh!) 
</li>
          <li>
Install the latest .NET Framework.  I’m kinda partial to using <a href="http://www.smallestdotnet.com/"><strong>SmallestDotNet.com</strong></a><strong> </strong>created
by <a href="http://www.hanselman.com">Scott Hanselman</a>.  It’s easy. 
</li>
          <li>
Install IIS.  If you are running Server 2008 R2 you can follow <a href="http://www.syfuhs.net/2010/07/26/InstallingIIS75OnWindows7FromTheCommandLine.aspx">these
steps in another post</a>, or just go through the wizards.  FYI: The post installs
EVERY feature.  Just remember that when you move to production.  Surface
Area and what not… 
</li>
          <li>
Install PowerShell. 
</li>
          <li>
Install the Windows Identity Foundation: <a title="http://www.microsoft.com/downloads/details.aspx?FamilyID=eb9c345f-e830-40b8-a5fe-ae7a864c4d76&amp;displaylang=en" href="http://www.microsoft.com/downloads/details.aspx?FamilyID=eb9c345f-e830-40b8-a5fe-ae7a864c4d76&amp;displaylang=en">http://www.microsoft.com/downloads/details.aspx?FamilyID=eb9c345f-e830-40b8-a5fe-ae7a864c4d76&amp;displaylang=en</a></li>
          <li>
Install SQL Server.  <strong>This is NOT required.</strong>  You only need
to install it if you want to use a SQL Database to get custom Claims data.  You
could also use a SQL Server on another server… 
</li>
          <li>
Download ADFS 2.0 RTW: <a title="http://www.microsoft.com/downloads/details.aspx?familyid=118c3588-9070-426a-b655-6cec0a92c10b&amp;displaylang=en" href="http://www.microsoft.com/downloads/details.aspx?familyid=118c3588-9070-426a-b655-6cec0a92c10b&amp;displaylang=en">http://www.microsoft.com/downloads/details.aspx?familyid=118c3588-9070-426a-b655-6cec0a92c10b&amp;displaylang=en</a></li>
        </ol>
        <p>
          <strong>The Installation</strong>
        </p>
        <p>
          <a href="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_2.png">
            <img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb.png" width="473" height="400" />
          </a>
        </p>
Read the terms and accept them.  If you notice, you only have to read half of
what you see because the rest is in French.  Maybe the lawyers are listening…these
things are getting more readable. 
<p><a href="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_4.png"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb_1.png" width="473" height="400" /></a></p><p>
Select <em>Federation Server</em>.  A Server Proxy allows you to use ADFS on
a web server not joined to the domain.
</p><p><a href="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_6.png"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb_2.png" width="474" height="400" /></a></p><p>
We already installed all of these things.  When you click next it will check
for latest hotfixes and ask if you want to open the configuration MMC snap-in. 
Start it.
</p><p><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb_3.png" width="530" height="330" /></p><p>
We want to start the configuration Wizard and then create a new Federation Service:
</p><p><a href="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_10.png"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb_4.png" width="500" height="400" /></a></p><p>
Next we want to create a Stand-alone federation server:
</p><p><a href="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_12.png"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb_5.png" width="493" height="400" /></a></p><p>
We need to select a certificate for ADFS to use.  By default it uses the SSL
certificate of the default site in IIS.  So lets add one.  In the IIS Manager
select the server and then select Server Certificates:
</p><p><a href="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_16.png"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb_7.png" width="238" height="194" /></a></p><p>
We have a couple options when it comes to adding a certificate.  For the sake
of this post I’ll just create a self-signed certificate, but if you have a domain
Certificate Authority you could go that route, or if this is a public facing service
create a request and get a certificate from a 3rd party CA.
</p><p><a href="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_18.png"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb_8.png" width="241" height="229" /></a></p><p>
Once we’ve created the certificate we assign it to the web site.  Go to the website
and select Bindings…
</p><p><a href="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_20.png"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb_9.png" width="211" height="185" /></a></p><p>
Add a site binding for https: 
</p><p><a href="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_24.png"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb_11.png" width="419" height="240" /></a></p><p>
Now that we’ve done that we can go back to the Configuration Wizard:
</p><p><a href="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_14.png"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb_6.png" width="500" height="400" /></a></p>
Click next and it will install the service.  It will stop IIS so be aware of
that. 
<p><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb_12.png" width="498" height="400" /></p><p>
You may receive this error if you are installing on Server 2008:
</p><p><a href="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_28.png"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb_13.png" width="397" height="151" /></a></p><p>
The fix for this is here: <a title="http://www.syfuhs.net/2010/07/23/ADFS20WindowsServiceNotStartingOnServer2008.aspx" href="http://www.syfuhs.net/2010/07/23/ADFS20WindowsServiceNotStartingOnServer2008.aspx">http://www.syfuhs.net/2010/07/23/ADFS20WindowsServiceNotStartingOnServer2008.aspx</a></p><p>
You will need to re-run the configuration wizard if you do this.  It may complain
about the virtual applications already existing.  You two options: 1) delete
the applications in IIS as well as the folder C:\inetpub\adfs; 2) Ignore the warning.
</p><p>
Back to the installation, it will create two new Virtual Applications in IIS:
</p><a href="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_30.png"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb_14.png" width="530" height="149" /></a><p>
Once the wizard finishes you can go back to the MMC snap-in and fiddle around. 
The first thing we need to do is create an entry for a Relying Party.  This will
allow us to create a web application to work with it.
</p><p><a href="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_32.png"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb_15.png" width="584" height="186" /></a></p><p>
When creating an RP we have a couple options to provide configuration data.
</p><p><a href="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_34.png"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb_16.png" width="497" height="400" /></a></p><p>
Since we are going to create a web application from scratch we will enter in manual
data.  If you already have the application built and have Federation Metadata
available for it, by all means just use that.
</p><p>
We need a name:
</p><p><a href="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_36.png"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb_17.png" width="499" height="400" /></a></p><p>
Very original, eh?
</p><p>
Next we need to decide on what profile we will be using.  Since we are building
an application from scratch we can take advantage of the 2.0 profile, but if we needed
backwards compatibility for a legacy application we should select the 1.0/1.1 profile.
</p><p><a href="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_38.png"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb_18.png" width="499" height="400" /></a></p><p>
Next we specify the certificate to encrypt our claims sent to the application. 
We only need the public key of the certificate.  When we run FedUtil.exe we can
specify which certificate we want to use to decrypt the incoming tokens.  This
will be the private key of the same certificate.  For the sake of this, we’ll
skip it.
</p><p><a href="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_40.png"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb_19.png" width="499" height="400" /></a></p><p>
The next step gets a little confusing.  It asks which protocols we want to use
if we are federating with a separate STS.  In this case since we aren’t doing
anything that crazy we can ignore them and continue:
</p><p><a href="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_42.png"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb_20.png" width="500" height="400" /></a></p><p>
We next need to specify the RP’s identifying URI.
</p><p><a href="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_44.png"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb_21.png" width="498" height="400" /></a></p><p>
Allow anyone and everyone, or deny everyone and add specific users later?  Allow
everyone…
</p><p><a href="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_46.png"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb_22.png" width="499" height="400" /></a></p><p>
When we finish we want to edit the claim rules:
</p><p><a href="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_48.png"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb_23.png" width="495" height="400" /></a></p><p>
This dialog will allow us to add mappings between claims and the data within Active
Directory:
</p><p><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb_24.png" width="368" height="400" /></p><p>
So lets add a rule.  We want to <strong>Send LDAP Attributes as Claims</strong></p><p><a href="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_52.png"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb_25.png" width="499" height="400" /></a></p><p>
First we specify what data in Active Directory we want to provide:
</p><p><a href="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_54.png"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb_26.png" width="468" height="400" /></a></p><p>
Then we specify which claim type to use:
</p><p><a href="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_56.png"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb_27.png" width="485" height="400" /></a></p><p>
And ADFS is configured!  Lets create our Relying Party.  You can follow
these steps: <a title="Making an ASP.NET Website Claims Aware with the Windows Identity Foundation" href="http://www.syfuhs.net/2010/08/03/MakingAnASPNETWebsiteClaimsAwareWithTheWindowsIdentityFoundation.aspx">Making
an ASP.NET Website Claims Aware with the Windows Identity Foundation</a>.  To
get the Federation Metadata for ADFS navigate to the URL that the default website
is mapped to + /FederationMetadata/2007-06/FederationMetadata.xml.  In my case
it’s <a title="https://web1.nexus.internal.test/FederationMetadata/2007-06/FederationMetadata.xml" href="https://web1.nexus.internal.test/FederationMetadata/2007-06/FederationMetadata.xml">https://web1.nexus.internal.test/FederationMetadata/2007-06/FederationMetadata.xml</a>.
</p><p>
Once you finish the utility it’s important that we tell ADFS that our new RP has Metadata
available.  Double click on the RP to get to the properties.  Select Monitoring:
</p><p><a href="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_58.png"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb_28.png" width="348" height="400" /></a></p><p>
Add the URL for the Metadata and select Monitor relying party.  This will periodically
call up the URL and download the metadata in the event that it changes.
</p><p>
At this point we can test.  Hit F5 and we will redirect to the ADFS page. 
It will ask for domain credentials and redirect back to our page.  Since I tested
it with a domain admin account I got this back:
</p><p><a href="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_60.png"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb_29.png" width="506" height="222" /></a></p><p>
It works!
</p><p>
For more information on ADFS 2.0 check out <a title="http://www.microsoft.com/windowsserver2008/en/us/ad-fs-2-overview.aspx" href="http://www.microsoft.com/windowsserver2008/en/us/ad-fs-2-overview.aspx">http://www.microsoft.com/windowsserver2008/en/us/ad-fs-2-overview.aspx</a> or
the WIF Blog at <a title="http://blogs.msdn.com/b/card/" href="http://blogs.msdn.com/b/card/">http://blogs.msdn.com/b/card/</a></p><p>
Happy coding!
</p><img width="0" height="0" src="http://www.syfuhs.net/aggbug.ashx?id=046a6d7b-ea3b-473a-94aa-5e986f30fed5" /></body>
      <title>Installing ADFS 2 and Federating an Application</title>
      <guid isPermaLink="false">http://www.syfuhs.net/PermaLink,guid,046a6d7b-ea3b-473a-94aa-5e986f30fed5.aspx</guid>
      <link>http://www.syfuhs.net/2010/08/14/InstallingADFS2AndFederatingAnApplication.aspx</link>
      <pubDate>Sat, 14 Aug 2010 22:39:41 GMT</pubDate>
      <description>&lt;p&gt;
From Microsoft Marketing, ADFS 2.0 is:
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
Active Directory Federation Services 2.0 helps IT enable users to collaborate across
organizational boundaries and easily access applications on-premises and in the cloud,
while maintaining application security. Through a &lt;font style="background-color: #ffff00"&gt;claims-based
infrastructure&lt;/font&gt;, IT can enable a single sign-on experience for end-users to
applications without requiring a separate account or password, whether applications
are located in partner organizations or hosted in the cloud.
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
So, it’s a Token Service plus some.&amp;#160; In a previous post I had said:
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
In other words it is a method for &lt;font style="background-color: #ffff00"&gt;centralizing
user Identity information&lt;/font&gt;, very much like how the Windows Live and OpenID systems
work.&amp;#160; The system is reasonably simple.&amp;#160; I have a Membership data store
that contains user information.&amp;#160; I want (n) number of websites to use that membership
store, EXCEPT I don’t want each application to have direct access to membership data
such as passwords.&amp;#160; The way around it is through claims.
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
The membership store in this case being Active Directory.
&lt;/p&gt;
&lt;p&gt;
I thought it would be a good idea to run through how to install ADFS and set up an
application to use it.&amp;#160; Since we already discussed how to federate an application
using FedUtil.exe, I will let you go through the &lt;a href="http://www.syfuhs.net/2010/08/03/MakingAnASPNETWebsiteClaimsAwareWithTheWindowsIdentityFoundation.aspx"&gt;steps
in the previous post&lt;/a&gt;.&amp;#160; I will provide information on where to find the Metadata
later on in this post.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;But First: The Prerequisites&lt;/strong&gt;
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Join the Server to the Domain. (I’ve started the installation of ADFS three times
on non-domain joined systems.&amp;#160; Doh!) 
&lt;/li&gt;
&lt;li&gt;
Install the latest .NET Framework.&amp;#160; I’m kinda partial to using &lt;a href="http://www.smallestdotnet.com/"&gt;&lt;strong&gt;SmallestDotNet.com&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;&amp;#160;&lt;/strong&gt;created
by &lt;a href="http://www.hanselman.com"&gt;Scott Hanselman&lt;/a&gt;.&amp;#160; It’s easy. 
&lt;/li&gt;
&lt;li&gt;
Install IIS.&amp;#160; If you are running Server 2008 R2 you can follow &lt;a href="http://www.syfuhs.net/2010/07/26/InstallingIIS75OnWindows7FromTheCommandLine.aspx"&gt;these
steps in another post&lt;/a&gt;, or just go through the wizards.&amp;#160; FYI: The post installs
EVERY feature.&amp;#160; Just remember that when you move to production.&amp;#160; Surface
Area and what not… 
&lt;/li&gt;
&lt;li&gt;
Install PowerShell. 
&lt;/li&gt;
&lt;li&gt;
Install the Windows Identity Foundation: &lt;a title="http://www.microsoft.com/downloads/details.aspx?FamilyID=eb9c345f-e830-40b8-a5fe-ae7a864c4d76&amp;amp;displaylang=en" href="http://www.microsoft.com/downloads/details.aspx?FamilyID=eb9c345f-e830-40b8-a5fe-ae7a864c4d76&amp;amp;displaylang=en"&gt;http://www.microsoft.com/downloads/details.aspx?FamilyID=eb9c345f-e830-40b8-a5fe-ae7a864c4d76&amp;amp;displaylang=en&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
Install SQL Server.&amp;#160; &lt;strong&gt;This is NOT required.&lt;/strong&gt;&amp;#160; You only need
to install it if you want to use a SQL Database to get custom Claims data.&amp;#160; You
could also use a SQL Server on another server… 
&lt;/li&gt;
&lt;li&gt;
Download ADFS 2.0 RTW: &lt;a title="http://www.microsoft.com/downloads/details.aspx?familyid=118c3588-9070-426a-b655-6cec0a92c10b&amp;amp;displaylang=en" href="http://www.microsoft.com/downloads/details.aspx?familyid=118c3588-9070-426a-b655-6cec0a92c10b&amp;amp;displaylang=en"&gt;http://www.microsoft.com/downloads/details.aspx?familyid=118c3588-9070-426a-b655-6cec0a92c10b&amp;amp;displaylang=en&lt;/a&gt; 
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
&lt;strong&gt;The Installation&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_2.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb.png" width="473" height="400" /&gt;&lt;/a&gt;
&lt;/p&gt;
Read the terms and accept them.&amp;#160; If you notice, you only have to read half of
what you see because the rest is in French.&amp;#160; Maybe the lawyers are listening…these
things are getting more readable. 
&lt;p&gt;
&lt;a href="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_4.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb_1.png" width="473" height="400" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Select &lt;em&gt;Federation Server&lt;/em&gt;.&amp;#160; A Server Proxy allows you to use ADFS on
a web server not joined to the domain.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_6.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb_2.png" width="474" height="400" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
We already installed all of these things.&amp;#160; When you click next it will check
for latest hotfixes and ask if you want to open the configuration MMC snap-in.&amp;#160;
Start it.
&lt;/p&gt;
&lt;p&gt;
&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb_3.png" width="530" height="330" /&gt;
&lt;/p&gt;
&lt;p&gt;
We want to start the configuration Wizard and then create a new Federation Service:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_10.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb_4.png" width="500" height="400" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Next we want to create a Stand-alone federation server:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_12.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb_5.png" width="493" height="400" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
We need to select a certificate for ADFS to use.&amp;#160; By default it uses the SSL
certificate of the default site in IIS.&amp;#160; So lets add one.&amp;#160; In the IIS Manager
select the server and then select Server Certificates:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_16.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb_7.png" width="238" height="194" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
We have a couple options when it comes to adding a certificate.&amp;#160; For the sake
of this post I’ll just create a self-signed certificate, but if you have a domain
Certificate Authority you could go that route, or if this is a public facing service
create a request and get a certificate from a 3rd party CA.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_18.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb_8.png" width="241" height="229" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Once we’ve created the certificate we assign it to the web site.&amp;#160; Go to the website
and select Bindings…
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_20.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb_9.png" width="211" height="185" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Add a site binding for https: 
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_24.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb_11.png" width="419" height="240" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Now that we’ve done that we can go back to the Configuration Wizard:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_14.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb_6.png" width="500" height="400" /&gt;&lt;/a&gt;
&lt;/p&gt;
Click next and it will install the service.&amp;#160; It will stop IIS so be aware of
that. 
&lt;p&gt;
&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb_12.png" width="498" height="400" /&gt;
&lt;/p&gt;
&lt;p&gt;
You may receive this error if you are installing on Server 2008:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_28.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb_13.png" width="397" height="151" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
The fix for this is here: &lt;a title="http://www.syfuhs.net/2010/07/23/ADFS20WindowsServiceNotStartingOnServer2008.aspx" href="http://www.syfuhs.net/2010/07/23/ADFS20WindowsServiceNotStartingOnServer2008.aspx"&gt;http://www.syfuhs.net/2010/07/23/ADFS20WindowsServiceNotStartingOnServer2008.aspx&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
You will need to re-run the configuration wizard if you do this.&amp;#160; It may complain
about the virtual applications already existing.&amp;#160; You two options: 1) delete
the applications in IIS as well as the folder C:\inetpub\adfs; 2) Ignore the warning.
&lt;/p&gt;
&lt;p&gt;
Back to the installation, it will create two new Virtual Applications in IIS:
&lt;/p&gt;
&lt;a href="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_30.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb_14.png" width="530" height="149" /&gt;&lt;/a&gt; 
&lt;p&gt;
Once the wizard finishes you can go back to the MMC snap-in and fiddle around.&amp;#160;
The first thing we need to do is create an entry for a Relying Party.&amp;#160; This will
allow us to create a web application to work with it.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_32.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb_15.png" width="584" height="186" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
When creating an RP we have a couple options to provide configuration data.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_34.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb_16.png" width="497" height="400" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Since we are going to create a web application from scratch we will enter in manual
data.&amp;#160; If you already have the application built and have Federation Metadata
available for it, by all means just use that.
&lt;/p&gt;
&lt;p&gt;
We need a name:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_36.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb_17.png" width="499" height="400" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Very original, eh?
&lt;/p&gt;
&lt;p&gt;
Next we need to decide on what profile we will be using.&amp;#160; Since we are building
an application from scratch we can take advantage of the 2.0 profile, but if we needed
backwards compatibility for a legacy application we should select the 1.0/1.1 profile.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_38.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb_18.png" width="499" height="400" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Next we specify the certificate to encrypt our claims sent to the application.&amp;#160;
We only need the public key of the certificate.&amp;#160; When we run FedUtil.exe we can
specify which certificate we want to use to decrypt the incoming tokens.&amp;#160; This
will be the private key of the same certificate.&amp;#160; For the sake of this, we’ll
skip it.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_40.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb_19.png" width="499" height="400" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
The next step gets a little confusing.&amp;#160; It asks which protocols we want to use
if we are federating with a separate STS.&amp;#160; In this case since we aren’t doing
anything that crazy we can ignore them and continue:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_42.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb_20.png" width="500" height="400" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
We next need to specify the RP’s identifying URI.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_44.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb_21.png" width="498" height="400" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Allow anyone and everyone, or deny everyone and add specific users later?&amp;#160; Allow
everyone…
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_46.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb_22.png" width="499" height="400" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
When we finish we want to edit the claim rules:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_48.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb_23.png" width="495" height="400" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
This dialog will allow us to add mappings between claims and the data within Active
Directory:
&lt;/p&gt;
&lt;p&gt;
&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb_24.png" width="368" height="400" /&gt;
&lt;/p&gt;
&lt;p&gt;
So lets add a rule.&amp;#160; We want to &lt;strong&gt;Send LDAP Attributes as Claims&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_52.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb_25.png" width="499" height="400" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
First we specify what data in Active Directory we want to provide:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_54.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb_26.png" width="468" height="400" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Then we specify which claim type to use:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_56.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb_27.png" width="485" height="400" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
And ADFS is configured!&amp;#160; Lets create our Relying Party.&amp;#160; You can follow
these steps: &lt;a title="Making an ASP.NET Website Claims Aware with the Windows Identity Foundation" href="http://www.syfuhs.net/2010/08/03/MakingAnASPNETWebsiteClaimsAwareWithTheWindowsIdentityFoundation.aspx"&gt;Making
an ASP.NET Website Claims Aware with the Windows Identity Foundation&lt;/a&gt;.&amp;#160; To
get the Federation Metadata for ADFS navigate to the URL that the default website
is mapped to + /FederationMetadata/2007-06/FederationMetadata.xml.&amp;#160; In my case
it’s &lt;a title="https://web1.nexus.internal.test/FederationMetadata/2007-06/FederationMetadata.xml" href="https://web1.nexus.internal.test/FederationMetadata/2007-06/FederationMetadata.xml"&gt;https://web1.nexus.internal.test/FederationMetadata/2007-06/FederationMetadata.xml&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
Once you finish the utility it’s important that we tell ADFS that our new RP has Metadata
available.&amp;#160; Double click on the RP to get to the properties.&amp;#160; Select Monitoring:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_58.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb_28.png" width="348" height="400" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Add the URL for the Metadata and select Monitor relying party.&amp;#160; This will periodically
call up the URL and download the metadata in the event that it changes.
&lt;/p&gt;
&lt;p&gt;
At this point we can test.&amp;#160; Hit F5 and we will redirect to the ADFS page.&amp;#160;
It will ask for domain credentials and redirect back to our page.&amp;#160; Since I tested
it with a domain admin account I got this back:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_60.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.syfuhs.net/content/binary/WindowsLiveWriter/5faa9c1bc727_ECC4/image_thumb_29.png" width="506" height="222" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
It works!
&lt;/p&gt;
&lt;p&gt;
For more information on ADFS 2.0 check out &lt;a title="http://www.microsoft.com/windowsserver2008/en/us/ad-fs-2-overview.aspx" href="http://www.microsoft.com/windowsserver2008/en/us/ad-fs-2-overview.aspx"&gt;http://www.microsoft.com/windowsserver2008/en/us/ad-fs-2-overview.aspx&lt;/a&gt; or
the WIF Blog at &lt;a title="http://blogs.msdn.com/b/card/" href="http://blogs.msdn.com/b/card/"&gt;http://blogs.msdn.com/b/card/&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Happy coding!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.syfuhs.net/aggbug.ashx?id=046a6d7b-ea3b-473a-94aa-5e986f30fed5" /&gt;</description>
      <comments>http://www.syfuhs.net/CommentView,guid,046a6d7b-ea3b-473a-94aa-5e986f30fed5.aspx</comments>
      <category>.NET</category>
      <category>ADFS</category>
      <category>ASP.NET</category>
      <category>Authentication</category>
      <category>C#</category>
      <category>Claims</category>
      <category>Identity</category>
      <category>IIS</category>
      <category>STS</category>
      <category>Token Service</category>
    </item>
    <item>
      <trackback:ping>http://www.syfuhs.net/Trackback.aspx?guid=b27cfd2d-5451-40d0-b398-990f37f1436d</trackback:ping>
      <pingback:server>http://www.syfuhs.net/pingback.aspx</pingback:server>
      <pingback:target>http://www.syfuhs.net/PermaLink,guid,b27cfd2d-5451-40d0-b398-990f37f1436d.aspx</pingback:target>
      <dc:creator>Steve Syfuhs</dc:creator>
      <wfw:comment>http://www.syfuhs.net/CommentView,guid,b27cfd2d-5451-40d0-b398-990f37f1436d.aspx</wfw:comment>
      <wfw:commentRss>http://www.syfuhs.net/SyndicationService.asmx/GetEntryCommentsRss?guid=b27cfd2d-5451-40d0-b398-990f37f1436d</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
The other day I kept hearing this noise from my neighbor.  I couldn’t quite figure
it out, and naturally it was annoying.  I didn’t do anything about it, but it
got me thinking about some random facts about sound and noise.
</p>
        <ul>
          <li>
Sound travels faster through concrete than air 
</li>
          <li>
Sound travels faster through most materials faster than air 
</li>
          <li>
Below is a list of common materials and how fast sound travels through them (Values
found at <a title="http://www.engineeringtoolbox.com/sound-speed-solids-d_713.html" href="http://www.engineeringtoolbox.com/sound-speed-solids-d_713.html">http://www.engineeringtoolbox.com/sound-speed-solids-d_713.html</a>) 
</li>
        </ul>
        <div style="text-align: center">
          <table style="text-align: left" border="1" cellspacing="0" cellpadding="0">
            <tbody>
              <tr>
                <td rowspan="2">
                  <p>
Medium
</p>
                </td>
                <td colspan="2">
                  <p align="center">
Velocity
</p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
(m/s)
</p>
                </td>
                <td>
                  <p>
(ft/s)
</p>
                </td>
              </tr>
              <tr>
                <td width="33%">
                  <p>
Aluminum
</p>
                </td>
                <td width="33%">
                  <p>
4877
</p>
                </td>
                <td width="33%">
                  <p>
16000
</p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
Brass
</p>
                </td>
                <td>
                  <p>
3475
</p>
                </td>
                <td>
                  <p>
11400
</p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
Brick
</p>
                </td>
                <td>
                  <p>
4176
</p>
                </td>
                <td>
                  <p>
13700
</p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
Concrete
</p>
                </td>
                <td>
                  <p>
3200 - 3600
</p>
                </td>
                <td>
                  <p>
10500 - 11800
</p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
Copper
</p>
                </td>
                <td>
                  <p>
3901
</p>
                </td>
                <td>
                  <p>
12800
</p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
Cork
</p>
                </td>
                <td>
                  <p>
366 - 518
</p>
                </td>
                <td>
                  <p>
1200 - 1700
</p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
Diamond
</p>
                </td>
                <td>
                  <p>
12000
</p>
                </td>
                <td>
                  <p>
39400
</p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
Glass
</p>
                </td>
                <td>
                  <p>
3962
</p>
                </td>
                <td>
                  <p>
13000
</p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
Glass, Pyrex
</p>
                </td>
                <td>
                  <p>
5640
</p>
                </td>
                <td>
                  <p>
18500
</p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
Gold
</p>
                </td>
                <td>
                  <p>
3240
</p>
                </td>
                <td>
                  <p>
10630
</p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
Hardwood
</p>
                </td>
                <td>
                  <p>
3962
</p>
                </td>
                <td>
                  <p>
13000
</p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
Iron
</p>
                </td>
                <td>
                  <p>
5130
</p>
                </td>
                <td>
                  <p>
16830
</p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
Lead
</p>
                </td>
                <td>
                  <p>
1158
</p>
                </td>
                <td>
                  <p>
3800
</p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
Lucite
</p>
                </td>
                <td>
                  <p>
2680
</p>
                </td>
                <td>
                  <p>
8790
</p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
Rubber
</p>
                </td>
                <td>
                  <p>
40 - 150
</p>
                </td>
                <td>
                  <p>
130 - 492
</p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
Steel
</p>
                </td>
                <td>
                  <p>
6100
</p>
                </td>
                <td>
                  <p>
20000
</p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
Water
</p>
                </td>
                <td>
                  <p>
1433
</p>
                </td>
                <td>
                  <p>
4700
</p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
Wood (hard)
</p>
                </td>
                <td>
                  <p>
3960
</p>
                </td>
                <td>
                  <p>
13000
</p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
Wood
</p>
                </td>
                <td>
                  <p>
3300 - 3600
</p>
                </td>
                <td>
                  <p>
10820 - 11810
</p>
                </td>
              </tr>
            </tbody>
          </table>
        </div>
        <ul>
          <li>
The range of human hearing is 20 Hz – 20,000 Hz, however most people can only hear
between 40 Hz – 16,000 Hz</li>
          <li>
All frequencies are not equal.  Our ears perceive certain frequencies to be louder
than others (found at Wikipedia <a title="http://en.wikipedia.org/wiki/Equal-loudness_contour" href="http://en.wikipedia.org/wiki/Equal-loudness_contour">http://en.wikipedia.org/wiki/Equal-loudness_contour</a>):</li>
        </ul>
        <p>
          <a href="http://en.wikipedia.org/wiki/File:Lindos1.svg">
            <img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" border="0" alt="Lindos1.svg" src="http://upload.wikimedia.org/wikipedia/commons/thumb/4/47/Lindos1.svg/400px-Lindos1.svg.png" width="400" height="359" />
          </a>
        </p>
        <ul>
          <li>
Sound travels a smidge less than 1 foot per second at standard temperature and pressure. 
Therefore if you need to place speakers in front of other speakers, you need to delay
them based on distance… 40 feet = ~40ms of delay.</li>
          <li>
If a speaker is placed in front of another without a delay, the sound from the speaker
farthest from you will sound similar to an echo.  This is called the Haas effect. 
However, most people don’t notice this until there is a 40ms gap between sounds, or
roughly 40 feet.  After about 40ms of delay, the intelligibility of the sound
also decreases.  I.e. it starts to degrade the quality, and you start having
trouble understanding what you hear.</li>
        </ul>
        <p>
Mostly useless facts, but they are fun to know.
</p>
        <img width="0" height="0" src="http://www.syfuhs.net/aggbug.ashx?id=b27cfd2d-5451-40d0-b398-990f37f1436d" />
      </body>
      <title>Facts about Sound you Probably didn’t Know</title>
      <guid isPermaLink="false">http://www.syfuhs.net/PermaLink,guid,b27cfd2d-5451-40d0-b398-990f37f1436d.aspx</guid>
      <link>http://www.syfuhs.net/2010/08/12/FactsAboutSoundYouProbablyDidntKnow.aspx</link>
      <pubDate>Thu, 12 Aug 2010 01:35:00 GMT</pubDate>
      <description>&lt;p&gt;
The other day I kept hearing this noise from my neighbor.&amp;#160; I couldn’t quite figure
it out, and naturally it was annoying.&amp;#160; I didn’t do anything about it, but it
got me thinking about some random facts about sound and noise.
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Sound travels faster through concrete than air 
&lt;/li&gt;
&lt;li&gt;
Sound travels faster through most materials faster than air 
&lt;/li&gt;
&lt;li&gt;
Below is a list of common materials and how fast sound travels through them (Values
found at &lt;a title="http://www.engineeringtoolbox.com/sound-speed-solids-d_713.html" href="http://www.engineeringtoolbox.com/sound-speed-solids-d_713.html"&gt;http://www.engineeringtoolbox.com/sound-speed-solids-d_713.html&lt;/a&gt;) 
&lt;/li&gt;
&lt;/ul&gt;
&lt;div style="text-align: center"&gt;
&lt;table style="text-align: left" border="1" cellspacing="0" cellpadding="0"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td rowspan="2"&gt;
&lt;p&gt;
Medium
&lt;/p&gt;
&lt;/td&gt;
&lt;td colspan="2"&gt;
&lt;p align="center"&gt;
Velocity
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p&gt;
(m/s)
&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;
(ft/s)
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="33%"&gt;
&lt;p&gt;
Aluminum
&lt;/p&gt;
&lt;/td&gt;
&lt;td width="33%"&gt;
&lt;p&gt;
4877
&lt;/p&gt;
&lt;/td&gt;
&lt;td width="33%"&gt;
&lt;p&gt;
16000
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p&gt;
Brass
&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;
3475
&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;
11400
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p&gt;
Brick
&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;
4176
&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;
13700
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p&gt;
Concrete
&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;
3200 - 3600
&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;
10500 - 11800
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p&gt;
Copper
&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;
3901
&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;
12800
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p&gt;
Cork
&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;
366 - 518
&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;
1200 - 1700
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p&gt;
Diamond
&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;
12000
&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;
39400
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p&gt;
Glass
&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;
3962
&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;
13000
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p&gt;
Glass, Pyrex
&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;
5640
&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;
18500
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p&gt;
Gold
&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;
3240
&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;
10630
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p&gt;
Hardwood
&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;
3962
&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;
13000
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p&gt;
Iron
&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;
5130
&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;
16830
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p&gt;
Lead
&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;
1158
&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;
3800
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p&gt;
Lucite
&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;
2680
&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;
8790
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p&gt;
Rubber
&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;
40 - 150
&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;
130 - 492
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p&gt;
Steel
&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;
6100
&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;
20000
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p&gt;
Water
&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;
1433
&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;
4700
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p&gt;
Wood (hard)
&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;
3960
&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;
13000
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p&gt;
Wood
&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;
3300 - 3600
&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;
10820 - 11810
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;
The range of human hearing is 20 Hz – 20,000 Hz, however most people can only hear
between 40 Hz – 16,000 Hz&lt;/li&gt;
&lt;li&gt;
All frequencies are not equal.&amp;#160; Our ears perceive certain frequencies to be louder
than others (found at Wikipedia &lt;a title="http://en.wikipedia.org/wiki/Equal-loudness_contour" href="http://en.wikipedia.org/wiki/Equal-loudness_contour"&gt;http://en.wikipedia.org/wiki/Equal-loudness_contour&lt;/a&gt;):&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;a href="http://en.wikipedia.org/wiki/File:Lindos1.svg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" border="0" alt="Lindos1.svg" src="http://upload.wikimedia.org/wikipedia/commons/thumb/4/47/Lindos1.svg/400px-Lindos1.svg.png" width="400" height="359" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Sound travels a smidge less than 1 foot per second at standard temperature and pressure.&amp;#160;
Therefore if you need to place speakers in front of other speakers, you need to delay
them based on distance… 40 feet = ~40ms of delay.&lt;/li&gt;
&lt;li&gt;
If a speaker is placed in front of another without a delay, the sound from the speaker
farthest from you will sound similar to an echo.&amp;#160; This is called the Haas effect.&amp;#160;
However, most people don’t notice this until there is a 40ms gap between sounds, or
roughly 40 feet.&amp;#160; After about 40ms of delay, the intelligibility of the sound
also decreases.&amp;#160; I.e. it starts to degrade the quality, and you start having
trouble understanding what you hear.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Mostly useless facts, but they are fun to know.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.syfuhs.net/aggbug.ashx?id=b27cfd2d-5451-40d0-b398-990f37f1436d" /&gt;</description>
      <comments>http://www.syfuhs.net/CommentView,guid,b27cfd2d-5451-40d0-b398-990f37f1436d.aspx</comments>
      <category>Random</category>
      <category>Science</category>
      <category>Sound</category>
    </item>
    <item>
      <trackback:ping>http://www.syfuhs.net/Trackback.aspx?guid=7a6a3d4c-36fc-4e1a-86bb-8687c993c364</trackback:ping>
      <pingback:server>http://www.syfuhs.net/pingback.aspx</pingback:server>
      <pingback:target>http://www.syfuhs.net/PermaLink,guid,7a6a3d4c-36fc-4e1a-86bb-8687c993c364.aspx</pingback:target>
      <dc:creator>Steve Syfuhs</dc:creator>
      <wfw:comment>http://www.syfuhs.net/CommentView,guid,7a6a3d4c-36fc-4e1a-86bb-8687c993c364.aspx</wfw:comment>
      <wfw:commentRss>http://www.syfuhs.net/SyndicationService.asmx/GetEntryCommentsRss?guid=7a6a3d4c-36fc-4e1a-86bb-8687c993c364</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
At first glance the obvious answer is no, of course not.  However, if we took
away the practical aspects of both, things might be a little different.  Think
about it…
</p>
        <p>
In medicine there is a standard of care: keep the person alive and healthy. 
This is done through years of study, years of practice, not to mention the constant
need to keep up on latest drugs and treatments.  There is however one constant.  
</p>
        <p>
The body, in all it’s natural wonders, only really has one specification.  One
heart, two lungs, two kidneys, one liver, one stomach, one brain, etc.
</p>
        <p>
Software development on the other hand, does not have one specification.  Arguably,
there is <em>no</em> specification.
</p>
        <blockquote>
          <p>
            <em>Software Development: Be able to develop anything and everything.</em>
          </p>
        </blockquote>
        <p>
It’s an interesting concept.  There are similarities between the jobs (as well
as between a lot of other jobs too) because both need to keep up on latest practices,
abide by rules, procedures, policies, and laws, all the while doing it well.
</p>
        <p>
Developers, however, do not have the luxury of being able to follow a single set of
standards though.  In our world, the righteous developers don’t just stick to
one platform or one language.  You aren’t a true developer if you only know one
language, or can only code on one platform.
</p>
        <p>
You aren’t a doctor if you can only save human lives.  Wait.  No. 
That’s not right.
</p>
        <p>
We are considered uninformed if we stick to one platform.
</p>
        <p>
Practically speaking, being a doctor is without a doubt much harder than being a developer. 
There are days though that I wish I were a doctor so I didn’t have to listen to other
developers complain about platforms or languages or methodologies or…
</p>
        <p>
My point being: stop telling me that your way is better.  I don’t care. 
I really, really don’t.  I will use what feels natural to me.
</p>
        <p>
&lt;/rant&gt;
</p>
        <img width="0" height="0" src="http://www.syfuhs.net/aggbug.ashx?id=7a6a3d4c-36fc-4e1a-86bb-8687c993c364" />
      </body>
      <title>Is being a Developer Fundamentally Harder than being a Doctor?</title>
      <guid isPermaLink="false">http://www.syfuhs.net/PermaLink,guid,7a6a3d4c-36fc-4e1a-86bb-8687c993c364.aspx</guid>
      <link>http://www.syfuhs.net/2010/08/10/IsBeingADeveloperFundamentallyHarderThanBeingADoctor.aspx</link>
      <pubDate>Tue, 10 Aug 2010 02:46:57 GMT</pubDate>
      <description>&lt;p&gt;
At first glance the obvious answer is no, of course not.&amp;#160; However, if we took
away the practical aspects of both, things might be a little different.&amp;#160; Think
about it…
&lt;/p&gt;
&lt;p&gt;
In medicine there is a standard of care: keep the person alive and healthy.&amp;#160;
This is done through years of study, years of practice, not to mention the constant
need to keep up on latest drugs and treatments.&amp;#160; There is however one constant.&amp;#160; 
&lt;/p&gt;
&lt;p&gt;
The body, in all it’s natural wonders, only really has one specification.&amp;#160; One
heart, two lungs, two kidneys, one liver, one stomach, one brain, etc.
&lt;/p&gt;
&lt;p&gt;
Software development on the other hand, does not have one specification.&amp;#160; Arguably,
there is &lt;em&gt;no&lt;/em&gt; specification.
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
&lt;em&gt;Software Development: Be able to develop anything and everything.&lt;/em&gt;
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
It’s an interesting concept.&amp;#160; There are similarities between the jobs (as well
as between a lot of other jobs too) because both need to keep up on latest practices,
abide by rules, procedures, policies, and laws, all the while doing it well.
&lt;/p&gt;
&lt;p&gt;
Developers, however, do not have the luxury of being able to follow a single set of
standards though.&amp;#160; In our world, the righteous developers don’t just stick to
one platform or one language.&amp;#160; You aren’t a true developer if you only know one
language, or can only code on one platform.
&lt;/p&gt;
&lt;p&gt;
You aren’t a doctor if you can only save human lives.&amp;#160; Wait.&amp;#160; No.&amp;#160;
That’s not right.
&lt;/p&gt;
&lt;p&gt;
We are considered uninformed if we stick to one platform.
&lt;/p&gt;
&lt;p&gt;
Practically speaking, being a doctor is without a doubt much harder than being a developer.&amp;#160;
There are days though that I wish I were a doctor so I didn’t have to listen to other
developers complain about platforms or languages or methodologies or…
&lt;/p&gt;
&lt;p&gt;
My point being: stop telling me that your way is better.&amp;#160; I don’t care.&amp;#160;
I really, really don’t.&amp;#160; I will use what feels natural to me.
&lt;/p&gt;
&lt;p&gt;
&amp;lt;/rant&amp;gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.syfuhs.net/aggbug.ashx?id=7a6a3d4c-36fc-4e1a-86bb-8687c993c364" /&gt;</description>
      <comments>http://www.syfuhs.net/CommentView,guid,7a6a3d4c-36fc-4e1a-86bb-8687c993c364.aspx</comments>
      <category>Random</category>
      <category>rant</category>
    </item>
    <item>
      <trackback:ping>http://www.syfuhs.net/Trackback.aspx?guid=796a8c9e-90d2-4a6f-a036-771b893ecc8d</trackback:ping>
      <pingback:server>http://www.syfuhs.net/pingback.aspx</pingback:server>
      <pingback:target>http://www.syfuhs.net/PermaLink,guid,796a8c9e-90d2-4a6f-a036-771b893ecc8d.aspx</pingback:target>
      <dc:creator>Steve Syfuhs</dc:creator>
      <wfw:comment>http://www.syfuhs.net/CommentView,guid,796a8c9e-90d2-4a6f-a036-771b893ecc8d.aspx</wfw:comment>
      <wfw:commentRss>http://www.syfuhs.net/SyndicationService.asmx/GetEntryCommentsRss?guid=796a8c9e-90d2-4a6f-a036-771b893ecc8d</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
A <a href="http://www.syfuhs.net/2010/08/03/MakingAnASPNETWebsiteClaimsAwareWithTheWindowsIdentityFoundation.aspx">couple
posts back</a> I had discussed how you would make an ASP.NET webforms application
claims aware. It was reasonably detailed an hopefully it was clear.  I say that
because to make an MVC application Claims aware, you follow the exact same procedure.
</p>
        <p>
The only difference is the small little chunk of code to see what claims were returned. 
Just drop this little snipped into a view and you can muck about:
</p>
        <pre class="c-sharp" name="code">&lt;ul&gt;
    &lt;%
    var claimsIdentity 
        = (System.Threading.Thread.CurrentPrincipal 
	   as Microsoft.IdentityModel.Claims.IClaimsPrincipal)
	  .Identities[0];
    foreach (var claim in claimsIdentity.Claims)
    {%&gt;
    &lt;li&gt;
       &lt;%: claim.ClaimType %&gt;
    --
    &lt;%: claim.Value %&gt;
    
    &lt;% } %&gt;
    &lt;/li&gt;
&lt;/ul&gt;</pre>
        <img width="0" height="0" src="http://www.syfuhs.net/aggbug.ashx?id=796a8c9e-90d2-4a6f-a036-771b893ecc8d" />
      </body>
      <title>Making an ASP.NET MVC Application Claims Aware with Windows Identity Foundation</title>
      <guid isPermaLink="false">http://www.syfuhs.net/PermaLink,guid,796a8c9e-90d2-4a6f-a036-771b893ecc8d.aspx</guid>
      <link>http://www.syfuhs.net/2010/08/06/MakingAnASPNETMVCApplicationClaimsAwareWithWindowsIdentityFoundation.aspx</link>
      <pubDate>Fri, 06 Aug 2010 22:10:59 GMT</pubDate>
      <description>&lt;p&gt;
A &lt;a href="http://www.syfuhs.net/2010/08/03/MakingAnASPNETWebsiteClaimsAwareWithTheWindowsIdentityFoundation.aspx"&gt;couple
posts back&lt;/a&gt; I had discussed how you would make an ASP.NET webforms application
claims aware. It was reasonably detailed an hopefully it was clear.&amp;#160; I say that
because to make an MVC application Claims aware, you follow the exact same procedure.
&lt;/p&gt;
&lt;p&gt;
The only difference is the small little chunk of code to see what claims were returned.&amp;#160;
Just drop this little snipped into a view and you can muck about:
&lt;/p&gt;
&lt;pre class="c-sharp" name="code"&gt;&amp;lt;ul&amp;gt;
    &amp;lt;%
    var claimsIdentity 
        = (System.Threading.Thread.CurrentPrincipal 
	   as Microsoft.IdentityModel.Claims.IClaimsPrincipal)
	  .Identities[0];
    foreach (var claim in claimsIdentity.Claims)
    {%&amp;gt;
    &amp;lt;li&amp;gt;
       &amp;lt;%: claim.ClaimType %&amp;gt;
    --
    &amp;lt;%: claim.Value %&amp;gt;
    
    &amp;lt;% } %&amp;gt;
    &amp;lt;/li&amp;gt;
&amp;lt;/ul&amp;gt;&lt;/pre&gt;&lt;img width="0" height="0" src="http://www.syfuhs.net/aggbug.ashx?id=796a8c9e-90d2-4a6f-a036-771b893ecc8d" /&gt;</description>
      <comments>http://www.syfuhs.net/CommentView,guid,796a8c9e-90d2-4a6f-a036-771b893ecc8d.aspx</comments>
      <category>.NET</category>
      <category>ASP.NET</category>
      <category>Authentication</category>
      <category>Identity</category>
      <category>MVC</category>
      <category>WIF</category>
    </item>
    <item>
      <trackback:ping>http://www.syfuhs.net/Trackback.aspx?guid=1f130fe9-7335-4335-add0-3277b5b53774</trackback:ping>
      <pingback:server>http://www.syfuhs.net/pingback.aspx</pingback:server>
      <pingback:target>http://www.syfuhs.net/PermaLink,guid,1f130fe9-7335-4335-add0-3277b5b53774.aspx</pingback:target>
      <dc:creator>Steve Syfuhs</dc:creator>
      <wfw:comment>http://www.syfuhs.net/CommentView,guid,1f130fe9-7335-4335-add0-3277b5b53774.aspx</wfw:comment>
      <wfw:commentRss>http://www.syfuhs.net/SyndicationService.asmx/GetEntryCommentsRss?guid=1f130fe9-7335-4335-add0-3277b5b53774</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Just a quick little collection of useful code snippets when dealing with certificates. 
Some of these don’t really need to be in their own methods but it helps for clarification.
</p>
        <p>
          <strong>Namespaces for Everything</strong>
        </p>
        <pre class="c-sharp" name="code">using System.Security.Cryptography.X509Certificates;
using System.Security;</pre>
        <p>
          <strong>Save Certificate to Store</strong>
        </p>
        <pre class="c-sharp" name="code">// Nothing fancy here.  Just a helper method to parse strings.
private StoreName parseStoreName(string name)
{
    return (StoreName)Enum.Parse(typeof(StoreName), name);
}
	
// Same here
private StoreLocation parseStoreLocation(string location)
{
    return (StoreLocation)Enum.Parse(typeof(StoreLocation), location);
}
	
private void saveCertToStore(X509Certificate2 x509Certificate2, StoreName storeName, StoreLocation storeLocation)
{
    X509Store store = new X509Store(storeName, storeLocation);

    store.Open(OpenFlags.ReadWrite);
    store.Add(x509Certificate2);

    store.Close();
}</pre>
        <p>
          <strong>Create Certificate from byte[] array</strong>
        </p>
        <pre class="c-sharp" name="code">private X509Certificate2 CreateCertificateFromByteArray(byte[] certFile)
{
     return new X509Certificate2(certFile); 
	// will throw exception if certificate has private key
}</pre>
        <p>
The comment says that it will throw an exception if the certificate has a private
key because the private key has a password associated with it. If you don't pass the
password as a parameter it will throw a System.Security.Cryptography.CryptographicException
exception. 
</p>
        <p>
          <strong>Get Certificate from Store by Thumbprint</strong>
        </p>
        <pre class="c-sharp" name="code">private bool FindCertInStore(
    string thumbprint, 
    StoreName storeName, 
    StoreLocation storeLocation, 
    out X509Certificate2 theCert)
{
    theCert = null;
    X509Store store = new X509Store(storeName, storeLocation);

    try
    {
        store.Open(OpenFlags.ReadWrite);

        string thumbprintFixed = thumbprint.Replace(" ", "").ToUpperInvariant();

        foreach (var cert in store.Certificates)
        {
            if (cert.Thumbprint.ToUpperInvariant().Equals(thumbprintFixed))
            {
                theCert = cert;

                return true;
            }
        }

        return false;
    }
    finally
    {
        store.Close();
    }
}</pre>
        <p>
Have fun!
</p>
        <img width="0" height="0" src="http://www.syfuhs.net/aggbug.ashx?id=1f130fe9-7335-4335-add0-3277b5b53774" />
      </body>
      <title>Working with Certificates in Code</title>
      <guid isPermaLink="false">http://www.syfuhs.net/PermaLink,guid,1f130fe9-7335-4335-add0-3277b5b53774.aspx</guid>
      <link>http://www.syfuhs.net/2010/08/05/WorkingWithCertificatesInCode.aspx</link>
      <pubDate>Thu, 05 Aug 2010 22:40:43 GMT</pubDate>
      <description>&lt;p&gt;
Just a quick little collection of useful code snippets when dealing with certificates.&amp;#160;
Some of these don’t really need to be in their own methods but it helps for clarification.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Namespaces for Everything&lt;/strong&gt;
&lt;/p&gt;
&lt;pre class="c-sharp" name="code"&gt;using System.Security.Cryptography.X509Certificates;
using System.Security;&lt;/pre&gt;
&lt;p&gt;
&lt;strong&gt;Save Certificate to Store&lt;/strong&gt;
&lt;/p&gt;
&lt;pre class="c-sharp" name="code"&gt;// Nothing fancy here.  Just a helper method to parse strings.
private StoreName parseStoreName(string name)
{
    return (StoreName)Enum.Parse(typeof(StoreName), name);
}
	
// Same here
private StoreLocation parseStoreLocation(string location)
{
    return (StoreLocation)Enum.Parse(typeof(StoreLocation), location);
}
	
private void saveCertToStore(X509Certificate2 x509Certificate2, StoreName storeName, StoreLocation storeLocation)
{
    X509Store store = new X509Store(storeName, storeLocation);

    store.Open(OpenFlags.ReadWrite);
    store.Add(x509Certificate2);

    store.Close();
}&lt;/pre&gt;
&lt;p&gt;
&lt;strong&gt;Create Certificate from byte[] array&lt;/strong&gt;
&lt;/p&gt;
&lt;pre class="c-sharp" name="code"&gt;private X509Certificate2 CreateCertificateFromByteArray(byte[] certFile)
{
     return new X509Certificate2(certFile); 
	// will throw exception if certificate has private key
}&lt;/pre&gt;
&lt;p&gt;
The comment says that it will throw an exception if the certificate has a private
key because the private key has a password associated with it. If you don't pass the
password as a parameter it will throw a System.Security.Cryptography.CryptographicException
exception. 
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Get Certificate from Store by Thumbprint&lt;/strong&gt;
&lt;/p&gt;
&lt;pre class="c-sharp" name="code"&gt;private bool FindCertInStore(
    string thumbprint, 
    StoreName storeName, 
    StoreLocation storeLocation, 
    out X509Certificate2 theCert)
{
    theCert = null;
    X509Store store = new X509Store(storeName, storeLocation);

    try
    {
        store.Open(OpenFlags.ReadWrite);

        string thumbprintFixed = thumbprint.Replace(&amp;quot; &amp;quot;, &amp;quot;&amp;quot;).ToUpperInvariant();

        foreach (var cert in store.Certificates)
        {
            if (cert.Thumbprint.ToUpperInvariant().Equals(thumbprintFixed))
            {
                theCert = cert;

                return true;
            }
        }

        return false;
    }
    finally
    {
        store.Close();
    }
}&lt;/pre&gt;
&lt;p&gt;
Have fun!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.syfuhs.net/aggbug.ashx?id=1f130fe9-7335-4335-add0-3277b5b53774" /&gt;</description>
      <comments>http://www.syfuhs.net/CommentView,guid,1f130fe9-7335-4335-add0-3277b5b53774.aspx</comments>
      <category>.NET</category>
      <category>Certificates</category>
      <category>Cryptography</category>
      <category>Encryption</category>
      <category>Fun Stuff</category>
      <category>Geek Stuff</category>
      <category>Microsoft</category>
      <category>Security</category>
    </item>
  </channel>
</rss>