<?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>Safe Impersonation With Whidbey</title><link>http://blogs.msdn.com/shawnfa/archive/2005/03/24/401905.aspx</link><description>Over the last couple of days we've talked about how to impersonate another user , and some security issues to keep in mind while impersonating . Now I'd like to take a look at some new features available in Whidbey which can make the whole process much</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>OdeToCode Links For March 27</title><link>http://blogs.msdn.com/shawnfa/archive/2005/03/24/401905.aspx#402788</link><pubDate>Mon, 28 Mar 2005 04:03:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:402788</guid><dc:creator>OdeToCode Links</dc:creator><description /></item><item><title>More on First Pass Exception Issues</title><link>http://blogs.msdn.com/shawnfa/archive/2005/03/24/401905.aspx#404322</link><pubDate>Thu, 31 Mar 2005 23:43:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:404322</guid><dc:creator>.Net Security Blog</dc:creator><description /></item><item><title>re: Safe Impersonation With Whidbey</title><link>http://blogs.msdn.com/shawnfa/archive/2005/03/24/401905.aspx#404503</link><pubDate>Fri, 01 Apr 2005 12:01:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:404503</guid><dc:creator>Nicole Calinoiu</dc:creator><description>While the use of a delegate is certainly convenient for this sort of thing, it's potentially quite dangerous given that there's no guarantee that the caller actually chose the delegate implementation.  (See &lt;a target="_new" href="http://blogs.msdn.com/ptorr/archive/2005/01/16/353816.aspx"&gt;http://blogs.msdn.com/ptorr/archive/2005/01/16/353816.aspx&lt;/a&gt; for a discussion by Peter Torr of a somewhat similar problem.)  Since it's not possible to place a demand for SecurityPermission\UnmanagedCode on the delegate itself, this is more than a little tricky.  Providing a wrapper that enables a demand when setting the delegate could help, but a naive caller would still be creating a security hole if it fails to use the wrapper as intended.&lt;br&gt;&lt;br&gt;Constraining the delegate actions via use of PermitOnly would also be potentially helpful, but one would need to receive the accepted permission set from the caller in order to allow adequate flexibility, and the same &amp;quot;naive caller&amp;quot; problem rears its ugly head again.  In addition, this approach would be completely useless when resources used by a particular implementation of the delegate are not protected by CAS.&lt;br&gt;&lt;br&gt;Unfortunately, I just can't see any way to make this sort of thing safe for potentially naive callers.  Unless there's some wonderful technique I'm missing, it would seem prudent to make this functionality accessible by only one's own code.</description></item><item><title>re: Safe Impersonation With Whidbey</title><link>http://blogs.msdn.com/shawnfa/archive/2005/03/24/401905.aspx#406011</link><pubDate>Thu, 07 Apr 2005 01:04:46 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:406011</guid><dc:creator>shawnfa</dc:creator><description>Well, there's really no good way to ensure that the caller uses the class library as intended.  The goal of the code isn't to allow arbitrary delegates to run in the impersonation context, but rather to be a wrapper around the high trust code which ensures that the impersonation is undone when the work completes.&lt;br&gt;&lt;br&gt;-Shawn</description></item><item><title>re: Safe Impersonation With Whidbey</title><link>http://blogs.msdn.com/shawnfa/archive/2005/03/24/401905.aspx#692202</link><pubDate>Tue, 08 Aug 2006 18:05:57 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:692202</guid><dc:creator>Gavin</dc:creator><description>Hey,&lt;br&gt;&lt;br&gt;I'm writing an application that requires me to authenticate as windows user account user to perform part of a process before resetting back to it's original context.&lt;br&gt;&lt;br&gt;Unfortunately I have no choice but to use C# exclusively. Your code uses some language specific classes that and so I am unable to directly translate into C#.&lt;br&gt;&lt;br&gt;Is there a C# version available?&lt;br&gt;&lt;br&gt;Many Thanks</description></item></channel></rss>