<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="http://syndication.webwiz.co.uk/rss_namespace/">
 <channel>
  <title>DevForce Community Forum : Implementing Role-Based Security in a DevForce App</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce Classic : Implementing Role-Based Security in a DevForce App</description>
  <pubDate>Fri, 12 Jun 2026 10:00:13 -700</pubDate>
  <lastBuildDate>Wed, 06 Jun 2007 15:50:58 -700</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 9.69</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>www.ideablade.com/forum/RSS_post_feed.asp?TID=69</WebWizForums:feedURL>
  <image>
   <title>DevForce Community Forum</title>
   <url>http://www.ideablade.com/forum/forum_images/IdeaBlade_logo_tm.png</url>
   <link>http://www.ideablade.com/forum/</link>
  </image>
  <item>
   <title>Implementing Role-Based Security in a DevForce App :  Answer: The tutorial for Role-Based...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=69&amp;PID=144#144</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=21" rel="nofollow">IdeaBlade</a><br /><strong>Subject:</strong> 69<br /><strong>Posted:</strong> 06-Jun-2007 at 3:50pm<br /><br /><DIV ="Secti&#111;n1"><P style="MARGIN: 0in 0in 0pt" ="Questi&#111;n"><strong><EM><FONT face="Times New Roman" size=3>Answer:</FONT></EM></strong></P><P style="MARGIN: 8pt 0in 0pt" ="Ms&#111;normal"><SPAN ="e"><SPAN style="mso-bidi-font-size: 10.0pt"><FONT face="Times New Roman" size=2>The tutorial for Role-Based Security can be found in the Advanced rutorials under the name of "Role-Based Authorization". </P><DIV></FONT></SPAN></SPAN><SPAN ="e"><SPAN style="mso-bidi-font-size: 10.0pt"><FONT face="Times New Roman" size=2></FONT></SPAN></SPAN>&nbsp;</DIV><DIV><SPAN ="e"><SPAN style="mso-bidi-font-size: 10.0pt"><FONT face="Times New Roman" size=2>The authentication methodology elucidated there provides the scaffolding upon which a role-based security implementation would be based.&nbsp; When you implement authentication in DevForce you provide a class that implements our IPersistenceLoginManager interface. That interface mandates a Login() method that is called by DevForce when your code invokes the Login() method on a PersistenceManager.</FONT></SPAN></SPAN></DIV><P style="MARGIN: 8pt 0in 0pt" ="Ms&#111;normal"><FONT size=2><FONT face="Times New Roman"><SPAN ="e"><SPAN style="mso-bidi-font-size: 10.0pt">The Login() method you provide in your </SPAN></SPAN><strong><SPAN style="FONT-WEIGHT: normal; mso-bidi-font-size: 10.0pt; mso-bidi-font-weight: bold">IPersistence</SPAN></strong><SPAN ="e"><SPAN style="mso-bidi-font-size: 10.0pt">LoginManager class takes as parameters an ILoginCredential and a&nbsp;PersistenceManager; it returns an IPrinciple object.&nbsp; The&nbsp;IPrinciple&nbsp;interface mandates an Identity property and a&nbsp;boolean IsInRole() method that takes a string parameter containing a role name (e.g., "Admin").&nbsp; IsInRole() must return true if the user identified in the IPrinciple object's Identity property&nbsp;is in the specified role; your code can then react in an appropriate manner.&nbsp; IsInRole() could, for example,&nbsp;do a database lookup to determine if its Identity user participates in the specified role.</SPAN></SPAN></FONT></FONT></P><P style="MARGIN: 8pt 0in 0pt" ="Ms&#111;normal"><SPAN ="e"><SPAN style="mso-bidi-font-size: 10.0pt"><FONT face="Times New Roman" size=2>In the implementation of the IPersistenceLoginManager.Login() method in the Security_Authentication solution, an IIdentity object is created by passing in a username and other items. IIdentity mandates a Name property which can be used for the UserName, which could be the mechanism to look up the user in the database. At that point it's just a matter of getting a Roles collection for the user, and seeing if the specified role is in it.</FONT></SPAN></SPAN><a href="http://www.ideablade.com/Forum/RTE_&#116;extarea.asp?mode=reply&amp;POID=143&amp;ID=1558#_ftn1" target="_blank"><SPAN ="MsoFootnoteReference"><SPAN style="mso-bidi-font-size: 10.0pt"><SPAN style="mso-special-character: footnote"><SPAN ="MsoFootnoteReference"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Times New Roman'; mso-fareast-font-family: 'Times New Roman'; mso-ansi-: EN-US; mso-fareast-: EN-US; mso-bidi-: AR-SA">&#091;1&#093;</SPAN></SPAN></SPAN></SPAN></SPAN></A></P><P style="MARGIN: 8pt 0in 0pt" ="Ms&#111;normal"><FONT size=2><FONT face="Times New Roman"><SPAN ="e"><SPAN style="mso-bidi-font-size: 10.0pt">Your (IPersistenceManagerLogin) Login() method returns an IPrinciple to the PersistenceManager.Login() method; the PersistenceManager.Login() returns a SessionBundle object.&nbsp; The SessionBundle object contains the IPrinciple object that was returned by your Login method.&nbsp;&nbsp; You can see this in the DoLogin() method in the LoginClientCore class in the Security_Authentication implementation.&nbsp; In that DoLogin() method, the SessionBundle object is passed to a SetLoggedInUser() method which ultimately sets the value of a static property of a CommonUser class that is available client-side.&nbsp; But that's just one example of what you can do with the SessionBundle object. The point is that it contains the identity of the logged in user for that PM; specifically, it contains an IPrincipal that represents that logged in user, </SPAN></SPAN><EM><SPAN style="mso-bidi-font-size: 10.0pt">and </SPAN></EM><SPAN ="e"><SPAN style="mso-bidi-font-size: 10.0pt">knows how to answer questions about role participation.</SPAN></SPAN></FONT><SPAN ="e"><SPAN style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New Roman'">&nbsp;</SPAN><?:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><O:P></O:P></SPAN></FONT></P></DIV><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Times New Roman'; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 'Times New Roman'; mso-ansi-: EN-US; mso-fareast-: EN-US; mso-bidi-: AR-SA"><BR style="PAGE-BREAK-BEFORE: always; mso-break-: secti&#111;n-break" clear=all></SPAN><P style="MARGIN: 8pt 0in 0pt" ="Ms&#111;normal"><O:P><FONT face="Times New Roman" size=2>&nbsp;</FONT></O:P></P><DIV style="mso-element: footnote-list"><BR clear=all><FONT face="Times New Roman" size=2><HR align=left width="33%" SIZE=1></FONT><DIV id=ftn1 style="mso-element: footnote"><P style="MARGIN: 6pt 0in 0pt 0.2in" ="MsoFootnoteText"><a href="http://www.ideablade.com/Forum/RTE_&#116;extarea.asp?mode=reply&amp;POID=143&amp;ID=1558#_ftnref1" target="_blank"><SPAN ="MsoFootnoteReference"><SPAN style="mso-special-character: footnote"><SPAN ="MsoFootnoteReference"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Times New Roman'; mso-bidi-font-size: 10.0pt; mso-fareast-font-family: 'Times New Roman'; mso-ansi-: EN-US; mso-fareast-: EN-US; mso-bidi-: AR-SA">&#091;1&#093;</SPAN></SPAN></SPAN></SPAN></A><FONT face="Times New Roman"> </FONT><SPAN ="e"><SPAN style="FONT-FAMILY: Arial; mso-bidi-font-family: 'Times New Roman'">The IIdentity object in the Security_Authentication implementation (called AppIdentity) also contains a UserId property distinct from the Name property, so that's an option for the database lookup as well.</SPAN></SPAN></P></DIV></DIV><span style="font-size:10px"><br /><br />Edited by IdeaBlade - 13-Jul-2007 at 12:26pm</span>]]>
   </description>
   <pubDate>Wed, 06 Jun 2007 15:50:58 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=69&amp;PID=144#144</guid>
  </item> 
  <item>
   <title>Implementing Role-Based Security in a DevForce App : Question:  Do you have a tutorial...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=69&amp;PID=143#143</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=20" rel="nofollow">Customer</a><br /><strong>Subject:</strong> 69<br /><strong>Posted:</strong> 06-Jun-2007 at 3:49pm<br /><br /><P =Questi&#111;n style="MARGIN: 0in 0in 0pt"><strong><EM><FONT face="Times New Roman" size=3>Question: </FONT></EM></strong></P><P =Ms&#111;normal style="MARGIN: 8pt 0in 0pt"><FONT face="Times New Roman" size=2>Do you have a tutorial that illustrates the implementation of role-based security in a DevForce app? <BR>Also, how do I get the UserId of the current logged in user; or any other relevant information about the user?</FONT></P>]]>
   </description>
   <pubDate>Wed, 06 Jun 2007 15:49:35 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=69&amp;PID=143#143</guid>
  </item> 
 </channel>
</rss>