<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>The Hogg Blog : F#</title><link>http://blogs.msdn.com/thehoggblog/archive/tags/F_2300_/default.aspx</link><description>Tags: F#</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>SecPAL Parser Updated for VS2008 and F#1.9.6.16</title><link>http://blogs.msdn.com/thehoggblog/archive/2009/09/26/secpal-parser-updated-for-vs2008-and-f-1-9-6-16.aspx</link><pubDate>Sun, 27 Sep 2009 01:27:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9899907</guid><dc:creator>Jason Hogg</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/thehoggblog/comments/9899907.aspx</comments><wfw:commentRss>http://blogs.msdn.com/thehoggblog/commentrss.aspx?PostID=9899907</wfw:commentRss><wfw:comment>http://blogs.msdn.com/thehoggblog/rsscomments.aspx?PostID=9899907</wfw:comment><description>&lt;TABLE class=FullWidth class="FullWidth"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;
&lt;DIV id=ctl00_ctl00_MasterContent_Content_PostRepeater_ctl00_BodyDiv class=discussionListContent&gt;
&lt;P&gt;I finally got around to updating the SecPAL Parser to run on the latest version of Visual Studio and F#. Development experience should be much cleaner now because F# is far better integrated into VS. If you run into any problems please post a note or drop me an email. For more information please see our &lt;A href="http://secpal.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=33592" mce_href="http://secpal.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=33592"&gt;SecPAL CodeBox Community Site&lt;/A&gt;. &lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9899907" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/thehoggblog/archive/tags/SecPAL/default.aspx">SecPAL</category><category domain="http://blogs.msdn.com/thehoggblog/archive/tags/Web+Service+Security/default.aspx">Web Service Security</category><category domain="http://blogs.msdn.com/thehoggblog/archive/tags/Security/default.aspx">Security</category><category domain="http://blogs.msdn.com/thehoggblog/archive/tags/F_2300_/default.aspx">F#</category><category domain="http://blogs.msdn.com/thehoggblog/archive/tags/DSL/default.aspx">DSL</category></item><item><title>Language Oriented Programming</title><link>http://blogs.msdn.com/thehoggblog/archive/2008/06/20/language-oriented-programming.aspx</link><pubDate>Fri, 20 Jun 2008 17:58:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8625501</guid><dc:creator>Jason Hogg</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/thehoggblog/comments/8625501.aspx</comments><wfw:commentRss>http://blogs.msdn.com/thehoggblog/commentrss.aspx?PostID=8625501</wfw:commentRss><wfw:comment>http://blogs.msdn.com/thehoggblog/rsscomments.aspx?PostID=8625501</wfw:comment><description>&lt;P&gt;Chris Smith from the F# team has an awesome blog post on &lt;A class="" href="http://blogs.msdn.com/chrsmith/archive/2008/05/30/language-oriented-programming-in-f.aspx" mce_href="http://blogs.msdn.com/chrsmith/archive/2008/05/30/language-oriented-programming-in-f.aspx"&gt;language oriented programming &lt;/A&gt;- and specifically LOP in F#. For those new to LOP Chris describes it as a style of programming that resembles a domain specific language - but is still valid in a general purpose programming language. &lt;/P&gt;
&lt;P&gt;As we see more and more DSL's emerge - specifically in domains where visual models aren't adequate to sufficiently represent domain concepts - I believe we will see a huge movement toward LOP. For our Security Policy Language this was the case - leading us to the creation of our &lt;A class="" href="http://blogs.msdn.com/thehoggblog/archive/2007/08/26/parser-for-secpal-simplified-english-grammar-now-available.aspx" mce_href="http://blogs.msdn.com/thehoggblog/archive/2007/08/26/parser-for-secpal-simplified-english-grammar-now-available.aspx"&gt;SecPAL Parser &lt;/A&gt;- which was also written in F#.&lt;/P&gt;
&lt;P&gt;Anyone interested in DSL's should definitely read Chris' blog post...&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8625501" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/thehoggblog/archive/tags/F_2300_/default.aspx">F#</category><category domain="http://blogs.msdn.com/thehoggblog/archive/tags/DSL/default.aspx">DSL</category></item><item><title>F# is getting productized!</title><link>http://blogs.msdn.com/thehoggblog/archive/2007/10/18/f-is-getting-productized.aspx</link><pubDate>Thu, 18 Oct 2007 23:41:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5513300</guid><dc:creator>Jason Hogg</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/thehoggblog/comments/5513300.aspx</comments><wfw:commentRss>http://blogs.msdn.com/thehoggblog/commentrss.aspx?PostID=5513300</wfw:commentRss><wfw:comment>http://blogs.msdn.com/thehoggblog/rsscomments.aspx?PostID=5513300</wfw:comment><description>&lt;P&gt;I just saw the announcement on Don and Soma's blogs about the fact that a product team has officially been established to productize F#. This is great news for Don Syme and James Margetson who have been working slavishly on F# for the last couple of years. Congratulations guys!!! &lt;/P&gt;
&lt;P&gt;For more information see:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A class="" href="http://blogs.msdn.com/somasegar/archive/2007/10/17/f-a-functional-programming-language.aspx" mce_href="http://blogs.msdn.com/somasegar/archive/2007/10/17/f-a-functional-programming-language.aspx"&gt;&lt;FONT color=#0000ff&gt;The formation of a team to take F# forward&lt;/FONT&gt;&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A id=bp___ctl00___RecentPosts___postlist___EntryItems_ctl00_PostTitle href="http://blogs.msdn.com/dsyme/archive/2007/10/17/s-somasegar-on-taking-f-forward.aspx"&gt;&lt;FONT color=#0000ff&gt;S. Somasegar on taking F# forward&lt;/FONT&gt;&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=5513300" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/thehoggblog/archive/tags/F_2300_/default.aspx">F#</category></item><item><title>Parser for SecPAL simplified English grammar now available! </title><link>http://blogs.msdn.com/thehoggblog/archive/2007/08/26/parser-for-secpal-simplified-english-grammar-now-available.aspx</link><pubDate>Mon, 27 Aug 2007 00:17:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4579556</guid><dc:creator>Jason Hogg</dc:creator><slash:comments>5</slash:comments><comments>http://blogs.msdn.com/thehoggblog/comments/4579556.aspx</comments><wfw:commentRss>http://blogs.msdn.com/thehoggblog/commentrss.aspx?PostID=4579556</wfw:commentRss><wfw:comment>http://blogs.msdn.com/thehoggblog/rsscomments.aspx?PostID=4579556</wfw:comment><description>&lt;DIV class=wikidoc&gt;One of the great strengths of SecPAL is its unique support for multiple representations of a security policy; XML for interoperability; and a simplified English grammar for human readbility. The SecPAL v1.1 Research Release (available from http://research.microsoft.com/projects/secpal) allows SecPAL assertions to be created using the rich and flexible.NET object model or deserialized from (or serialized into XML) XML according to the SecPAL Schema Specification (also available at the aforementioned URL). &lt;BR&gt;&lt;BR&gt;We have now also created a sample parser that allows SecPAL policies and authorization queries to be specified using a simplified English grammar and then translated into the SecPAL object model. This allows policies to be specified declaratively in a human readable form. The parser is written using F# and uses the Lexx and Yacc tools that accompany F#. Full source code is included - so if you are looking for a good project to start learning F# - or if you want to see a complete parser implementation developed using F# and the accompanying tools then this is a great place to start. &lt;/DIV&gt;
&lt;DIV class=wikidoc&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class=wikidoc&gt;I really enjoyed working on this sample as it gave me an opportunity to learn a lot more about F#&amp;nbsp;- so over the next couple of posts I will share a lot more information on how the sample works including some tips about F# that I have learned. I will also start posting additional additional access control patterns specified declaratively - hopefully making the samples much easier to follow than the more length samples written purely in C# or F#. &lt;/DIV&gt;
&lt;DIV class=wikidoc&gt;&lt;BR&gt;The parser sample is available from here: &lt;A class=externalLink href="http://www.codeplex.com/secpal/Release/ProjectReleases.aspx?ReleaseId=6667"&gt;http://www.codeplex.com/secpal/Release/ProjectReleases.aspx?ReleaseId=6667&lt;SPAN class=externalLinkIcon&gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;BR&gt;&lt;/DIV&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=4579556" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/thehoggblog/archive/tags/SecPAL/default.aspx">SecPAL</category><category domain="http://blogs.msdn.com/thehoggblog/archive/tags/Web+Service+Security/default.aspx">Web Service Security</category><category domain="http://blogs.msdn.com/thehoggblog/archive/tags/Security/default.aspx">Security</category><category domain="http://blogs.msdn.com/thehoggblog/archive/tags/Grid/default.aspx">Grid</category><category domain="http://blogs.msdn.com/thehoggblog/archive/tags/F_2300_/default.aspx">F#</category></item><item><title>Writing SecPAL Assertions In F# - Contd</title><link>http://blogs.msdn.com/thehoggblog/archive/2007/06/20/writing-secpal-assertions-in-f-contd.aspx</link><pubDate>Wed, 20 Jun 2007 19:24:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3427769</guid><dc:creator>Jason Hogg</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/thehoggblog/comments/3427769.aspx</comments><wfw:commentRss>http://blogs.msdn.com/thehoggblog/commentrss.aspx?PostID=3427769</wfw:commentRss><wfw:comment>http://blogs.msdn.com/thehoggblog/rsscomments.aspx?PostID=3427769</wfw:comment><description>&lt;P&gt;In my earlier &lt;A class="" href="http://blogs.msdn.com/thehoggblog/archive/2007/06/15/writing-secpal-assertions-in-f.aspx" mce_href="http://blogs.msdn.com/thehoggblog/archive/2007/06/15/writing-secpal-assertions-in-f.aspx"&gt;post&lt;/A&gt; I showed how SecPAL could be used to grant access to a particular user based on a token issued by an STS that we explicitly established a trust relationship with using the SecPAL "canSay" predicate. Now I am going to show you something that I think is really cool&amp;nbsp;- and something that demonstrates the advantage of our underlying &lt;A class="" href="http://en.wikipedia.org/wiki/Datalog" mce_href="http://en.wikipedia.org/wiki/Datalog"&gt;Datalog&lt;/A&gt; engine. We are going to make three small changes to the code I showed you in the earlier post to demonstrate how instead of an authorization query being used to determine whether a particualr user can access a resource, we are going to ask who all the users are that can possibly access a resouce based on the policies we have defined. &lt;/P&gt;
&lt;P&gt;This kind of query is simple for SecPAL. We simply change our authorization query from including a concreate value (&lt;EM&gt;LA says jason can read &lt;/EM&gt;&lt;A href="file://public/foo.txt"&gt;&lt;EM&gt;file://public/foo.txt&lt;/EM&gt;&lt;/A&gt;) to a query that includes a variable (&lt;EM&gt;LA says %p can read &lt;/EM&gt;&lt;A href="file://public/foo.txt"&gt;&lt;EM&gt;file://public/foo.txt&lt;/EM&gt;&lt;/A&gt;) at which point Datalog will evaluate what all the possible principals are that can read this resource and will then return a list of substitutions. In addition to the substitutions it will also include proof graphs for each possible substitution showing exactly why it is that a particular user could access this resource. Anyone who has used Prolog in the past will likely realize that this is similar to how Prolog works and this is in fact because Datalog is in a subset of Prolog!&lt;/P&gt;
&lt;P&gt;Now &lt;STRONG&gt;before&lt;/STRONG&gt; you run this code take a look at this and the original resource access policy and decide which of our users will in fact be granted access to read this file. Not all of them will be... and it should hopefully be obvious which one will not be granted access.&lt;/P&gt;
&lt;P&gt;In order to make this change three pieces of code need to change:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;1. Create additional users &lt;/STRONG&gt;- We will create five additional users, four of which are actually the SecPAL developers, and the fifth is not.&lt;/P&gt;&lt;PRE&gt;// Define the users within the simple scenario
let User1 = KeyHolderPrincipal(new RSACryptoServiceProvider(), "John")
let User2 = KeyHolderPrincipal(new RSACryptoServiceProvider(), "Greg")
let User3 = KeyHolderPrincipal(new RSACryptoServiceProvider(), "Jason")
let User4 = KeyHolderPrincipal(new RSACryptoServiceProvider(), "Larry")
let User5 = KeyHolderPrincipal(new RSACryptoServiceProvider(), "Fred")

&lt;/PRE&gt;
&lt;P&gt;&lt;STRONG&gt;2. Issue tokens for the additional users&lt;/STRONG&gt; - For this example I am being lazy and simply putting all the claims about possession of attributes in one token. In reality each user would normally be issued their own token. &lt;/P&gt;&lt;PRE&gt;// Create a Token to identify our Users with 
let token = Token(issuer=PrincipalIssuer(STS),
                  claims=[ Claim(fact=PossessFact(User1, 
                                                  new SecPALAttribute(AttributeType.rfc822Name,@"john@microsoft.com")));
                           Claim(fact=PossessFact(User2, 
                                                  new SecPALAttribute(AttributeType.rfc822Name,@"greg@microsoft.com")));
                           Claim(fact=PossessFact(User3, 
                                                  new SecPALAttribute(AttributeType.rfc822Name,@"jason@microsoft.com")));
                           Claim(fact=PossessFact(User4, 
                                                  new SecPALAttribute(AttributeType.rfc822Name,@"larry@microsoft.com")));
                           Claim(fact=PossessFact(User4, 
                                                  new SecPALAttribute(AttributeType.rfc822Name,@"fred@hotmail.com")))
                                                  ]) 

let tokens = [ token ]

&lt;/PRE&gt;
&lt;P&gt;&lt;STRONG&gt;3. Modify our authorization query&lt;/STRONG&gt; - We now change the authorization query so that we leave a variable in the query. SecPAL will then determine all the valid users are for this this variable can be unified. &lt;/P&gt;&lt;PRE&gt;// Create our Authorization Query 
//		LA says %p can read &lt;A href="file://public/foo.txt?let"&gt;file://public/foo.txt?
let&lt;/A&gt; query = AuthorizationQuery
               (expression=AssertionExpression
                   (assertion=AtomicAssertion
                       (principal=ResourceGuard, 
                        fact=ActionFact(PrincipalVariable("p"), ActionVerbs.read, 
                                        Resource(ResourceType.digitalContent, 
                                                 System.Uri(@"file://public/foo.txt"))))))


&lt;/PRE&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=3427769" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/thehoggblog/archive/tags/SecPAL/default.aspx">SecPAL</category><category domain="http://blogs.msdn.com/thehoggblog/archive/tags/Security/default.aspx">Security</category><category domain="http://blogs.msdn.com/thehoggblog/archive/tags/Grid/default.aspx">Grid</category><category domain="http://blogs.msdn.com/thehoggblog/archive/tags/F_2300_/default.aspx">F#</category></item><item><title>Writing SecPAL assertions in F#</title><link>http://blogs.msdn.com/thehoggblog/archive/2007/06/15/writing-secpal-assertions-in-f.aspx</link><pubDate>Sat, 16 Jun 2007 02:22:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3323346</guid><dc:creator>Jason Hogg</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/thehoggblog/comments/3323346.aspx</comments><wfw:commentRss>http://blogs.msdn.com/thehoggblog/commentrss.aspx?PostID=3323346</wfw:commentRss><wfw:comment>http://blogs.msdn.com/thehoggblog/rsscomments.aspx?PostID=3323346</wfw:comment><description>&lt;P&gt;I figured I would try to learn F# over this summer - and thought what better way to start than create a couple of SecPAL samples in F#. I thought this might help people that are interested in learning more about &lt;A class="" href="http://research.microsoft.com/fsharp/fsharp.aspx" mce_href="http://research.microsoft.com/fsharp/fsharp.aspx"&gt;F#&lt;/A&gt;, or potentially F# users that are interested in learning more about how &lt;A class="" href="http://blogs.msdn.com/thehoggblog/archive/2007/04/20/secpal-access-control-for-grid-computing-environments.aspx" mce_href="http://blogs.msdn.com/thehoggblog/archive/2007/04/20/secpal-access-control-for-grid-computing-environments.aspx"&gt;SecPAL&lt;/A&gt; can be used for access control scenarios. The sample below is simplified version of our classic multi-domain scenario (see &lt;A class="" href="http://www.gridtoday.com/grid/1546527.html" mce_href="http://www.gridtoday.com/grid/1546527.html"&gt;here &lt;/A&gt;for a complete description). In short we have three parties: A resource guard that is responsible for protecting access to a resource, an STS that is trusted to issue claims about users, and a user that wants to access a file.&lt;/P&gt;
&lt;P mce_keep="true"&gt;In order to support this scenario we have the following assertions:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;
&lt;DIV mce_keep="true"&gt;SecPAL policies&lt;/DIV&gt;&lt;/LI&gt;
&lt;UL&gt;
&lt;LI&gt;
&lt;DIV mce_keep="true"&gt;Resource access policy - &lt;EM&gt;LA &lt;STRONG&gt;says&lt;/STRONG&gt; %p read file://public/ &lt;STRONG&gt;if&lt;/STRONG&gt; %p possesses %a &lt;STRONG&gt;where&lt;/STRONG&gt; %a match &lt;/EM&gt;&lt;A href="mailto:.*@microsoft.com"&gt;&lt;EM&gt;.*@microsoft.com&lt;/EM&gt;&lt;/A&gt; &lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV mce_keep="true"&gt;Trust policy - &lt;EM&gt;LA &lt;STRONG&gt;says&lt;/STRONG&gt; STS &lt;STRONG&gt;canSay&lt;/STRONG&gt; %p possesses %a &lt;STRONG&gt;where&lt;/STRONG&gt; %a match &lt;/EM&gt;&lt;A href="mailto:.*@microsoft.com"&gt;&lt;EM&gt;.*@microsoft.com&lt;/EM&gt;&lt;/A&gt;&lt;EM&gt; &lt;/EM&gt;&lt;/DIV&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;LI&gt;
&lt;DIV mce_keep="true"&gt;SecPAL token&lt;/DIV&gt;&lt;/LI&gt;
&lt;UL&gt;
&lt;LI&gt;
&lt;DIV mce_keep="true"&gt;&lt;EM&gt;STS &lt;STRONG&gt;says&lt;/STRONG&gt; User possesses rfc822Name:&lt;/EM&gt;&lt;A href="mailto:jason@microsoft.com"&gt;&lt;EM&gt;jason@microsoft.com&lt;/EM&gt;&lt;/A&gt;&lt;/DIV&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;LI&gt;
&lt;DIV mce_keep="true"&gt;SecPAL authorization query&lt;/DIV&gt;&lt;/LI&gt;
&lt;UL&gt;
&lt;LI&gt;
&lt;DIV mce_keep="true"&gt;&lt;EM&gt;LA &lt;STRONG&gt;says&lt;/STRONG&gt; Jason can read &lt;/EM&gt;&lt;A href="file://public/foo.txt"&gt;&lt;EM&gt;file://public/foo.txt&lt;/EM&gt;&lt;/A&gt;&lt;EM&gt;?&lt;/EM&gt;&lt;/DIV&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;
&lt;P mce_keep="true"&gt;When run the code will output a textual proof graph illustrating exactly what the chain of deductions were that lead to this authorization decision being approved. If you want to use our graphical proof graph viewer take a look at this &lt;A class="" href="http://www.codeplex.com/secpal/Thread/View.aspx?ThreadId=11187" mce_href="http://www.codeplex.com/secpal/Thread/View.aspx?ThreadId=11187"&gt;post&lt;/A&gt;. You will have to add an audit policy but that is really straight forward.&lt;/P&gt;
&lt;P mce_keep="true"&gt;The F# code for this scenario is included below. In the my next few blog posts I will show you how to modify this code to do some extra cool things... In the mean time let me know if you have any questions, or if there are any scenarios you would like me to demonstrate.&lt;/P&gt;
&lt;P mce_keep="true"&gt;Thanks to &lt;A class="" href="http://blogs.msdn.com/dsyme/" mce_href="http://blogs.msdn.com/dsyme/"&gt;Don Syme&lt;/A&gt; and Can Erton of the F-Sharp team for reviewing my code before I released it! &lt;BR&gt;&lt;/P&gt;&lt;PRE&gt;// Title: Simple SecPAL security scenario (F#)
#light
// Update the pointer below to your SecPAL DLL (The SecPAL .NET implementation is available from &lt;A href="http://research.microsoft.com/projects/secpal"&gt;http://research.microsoft.com/projects/secpal&lt;/A&gt;) &lt;/PRE&gt;&lt;PRE&gt;#I "C:\Users\jahogg\Documents\Microsoft SecPal Research Release\Bin\Microsoft.Research.SecPal.dll"
#r "Microsoft.Research.SecPal.dll"

open Microsoft.Research.SecPal.Authorization 
open System.Security.Cryptography
open System.Collections.Generic
type SecPALAttribute = Microsoft.Research.SecPal.Authorization.Attribute

// Define the users within the simple scenario
let User = KeyHolderPrincipal(new RSACryptoServiceProvider(), "Jason")
let STS = KeyHolderPrincipal(new RSACryptoServiceProvider(), "STS")
let ResourceGuard = LocalAuthorityPrincipal("ResourceGuard") // ResouceGuard == LocalAuthority == LA

// Define Resource Access Policy 
//		LA says %p read file://public/ if %p possesses %a where %a match ".*@microsoft.com" 					
let claims = [Claim(fact=ActionFact(PrincipalVariable("p"),
                                    ActionVerbs.read,
                                    Resource(ResourceType.digitalContent,
                                             System.Uri(@"file://public/"))),
                    condition=PossessFact(PrincipalVariable("p"),
                                          AttributeVariable("a")),
                    constraint=AttributeMatchConstraint("a",AttributeType.rfc822Name, @".*@microsoft\.com"));
              // LA says STS canSay %p possesses %a where %a match ".*@microsoft.com" 					
              Claim(fact=CanSayFact(STS,
                                    fact=PossessFact(PrincipalVariable("p"),
                                                     AttributeVariable("a"))),
                    constraint=AttributeMatchConstraint("a",AttributeType.rfc822Name, @".*@microsoft\.com")) ]

let policy = Policy(PrincipalIssuer(ResourceGuard), claims)
let policies = [ policy ]

// Create a Token to identify our User with 
//		STS says User possesses rfc822Name:"jahogg@microsoft.com"
let token = Token(issuer=PrincipalIssuer(STS),
                  claims=[ Claim(fact=PossessFact(User, 
                                                  new SecPALAttribute(AttributeType.rfc822Name,@"jason@microsoft.com")))]) 

let tokens = [ token ]

// Create our Authorization Query 
//		LA says Jason can read file://public/foo.txt?

let query = AuthorizationQuery
               (expression=AssertionExpression
                   (assertion=AtomicAssertion
                       (principal=ResourceGuard, 
                        fact=ActionFact(User, ActionVerbs.read, 
                                        Resource(ResourceType.digitalContent, 
                                                 System.Uri(@"file://public/foo.txt"))))))

// Perform our Authorization Query using the Authorization Engine		
let answers = AuthorizationEngine.MakeAuthorizationDecision(ResourceGuard, tokens, policies, query) 
 
// Determine if access was granted
let results = (if (answers.Count &amp;lt; 1) then "Denied" else "Authorized") 

// Print out the results
printf "The result is %s \n" results
printf "Answer count = %i \n\n" answers.Count

// Iterate over the Proofs
for answer in answers do
    // Output variable substitutions
    let subs = answer.Substitution 
    for sub in subs do
        System.Console.WriteLine ("Name " + sub.Key.Name + " = " + sub.Value.ToString());
    // Output proof graphs
    let proofs = answer.ProofGraphs 
    for proof in proofs do
        System.Console.Write("Expression = ")
        System.Console.WriteLine(proof.Expression)
        System.Console.WriteLine("Graph = ")
        System.Console.WriteLine(proof.ProofRoot)

// Press any key to continue (Homer "Where's the any key?")
System.Console.ReadLine()

&lt;/PRE&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=3323346" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/thehoggblog/archive/tags/SecPAL/default.aspx">SecPAL</category><category domain="http://blogs.msdn.com/thehoggblog/archive/tags/Web+Service+Security/default.aspx">Web Service Security</category><category domain="http://blogs.msdn.com/thehoggblog/archive/tags/Security/default.aspx">Security</category><category domain="http://blogs.msdn.com/thehoggblog/archive/tags/Grid/default.aspx">Grid</category><category domain="http://blogs.msdn.com/thehoggblog/archive/tags/F_2300_/default.aspx">F#</category></item></channel></rss>