<?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 : LoginManager and server side</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : LoginManager and server side</description>
  <pubDate>Wed, 29 Jul 2026 21:36:04 -700</pubDate>
  <lastBuildDate>Thu, 09 Jun 2011 11:50:07 -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=2746</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>LoginManager and server side :   midnit,I could not verify...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2746&amp;PID=10922#10922</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=892" rel="nofollow">sbelini</a><br /><strong>Subject:</strong> 2746<br /><strong>Posted:</strong> 09-Jun-2011 at 11:50am<br /><br />midnit,<div>&nbsp;</div><div>I could not verify the behavior you described.</div><div>&nbsp;</div><div>In an Interceptor, if I try:</div><div>&nbsp;</div><div><font color="#0000ff" size="2" face="C&#111;nsolas"><font color="#0000ff" size="2" face="C&#111;nsolas"><font color="#0000ff" size="2" face="C&#111;nsolas">var</font></font></font><font size="2" face="C&#111;nsolas"><font size="2" face="C&#111;nsolas"> newEm = </font></font><font color="#0000ff" size="2" face="C&#111;nsolas"><font color="#0000ff" size="2" face="C&#111;nsolas"><font color="#0000ff" size="2" face="C&#111;nsolas">new</font></font></font><font size="2" face="C&#111;nsolas"><font size="2" face="C&#111;nsolas"> </font></font><font color="#2b91af" size="2" face="C&#111;nsolas"><font color="#2b91af" size="2" face="C&#111;nsolas"><font color="#2b91af" size="2" face="C&#111;nsolas">EntityManager</font></font></font><font size="2" face="C&#111;nsolas"><font size="2" face="C&#111;nsolas">(EntityManager);</font></font></div><div><font color="#0000ff" size="2" face="C&#111;nsolas"><font color="#0000ff" size="2" face="C&#111;nsolas"><font color="#0000ff" size="2" face="C&#111;nsolas">var</font></font></font><font size="2" face="C&#111;nsolas"><font size="2" face="C&#111;nsolas"> employees = newEm.GetQuery&lt;</font></font><font color="#2b91af" size="2" face="C&#111;nsolas"><font color="#2b91af" size="2" face="C&#111;nsolas"><font color="#2b91af" size="2" face="C&#111;nsolas">Employee</font></font></font><font size="2" face="C&#111;nsolas"><font size="2" face="C&#111;nsolas">&gt;().ToList();</font></font></div><div>&nbsp;</div><div>newEm will be logged in and it will <u>not</u> trigger the LoginManager. </div><div>However, if I try:</div><div>&nbsp;</div><div><div><font color="#0000ff" size="2" face="C&#111;nsolas"><font color="#0000ff" size="2" face="C&#111;nsolas"><font color="#0000ff" size="2" face="C&#111;nsolas">var</font></font></font><font size="2" face="C&#111;nsolas"><font size="2" face="C&#111;nsolas"> newEm = </font></font><font color="#0000ff" size="2" face="C&#111;nsolas"><font color="#0000ff" size="2" face="C&#111;nsolas"><font color="#0000ff" size="2" face="C&#111;nsolas">new</font></font></font><font size="2" face="C&#111;nsolas"><font size="2" face="C&#111;nsolas"> </font></font><font color="#2b91af" size="2" face="C&#111;nsolas"><font color="#2b91af" size="2" face="C&#111;nsolas"><font color="#2b91af" size="2" face="C&#111;nsolas">EntityManager</font></font></font><font size="2" face="C&#111;nsolas"><font size="2" face="C&#111;nsolas">();</font></font></div><div><font color="#0000ff" size="2" face="C&#111;nsolas"><font color="#0000ff" size="2" face="C&#111;nsolas"><font color="#0000ff" size="2" face="C&#111;nsolas">var</font></font></font><font size="2" face="C&#111;nsolas"><font size="2" face="C&#111;nsolas"> employees = newEm.GetQuery&lt;</font></font><font color="#2b91af" size="2" face="C&#111;nsolas"><font color="#2b91af" size="2" face="C&#111;nsolas"><font color="#2b91af" size="2" face="C&#111;nsolas">Employee</font></font></font><font size="2" face="C&#111;nsolas"><font size="2" face="C&#111;nsolas">&gt;().ToList();</font></font></div></div><div>&nbsp;</div><div>newEm will <u>not</u> be logged in and the LoginManager will be triggered when the query is executed. (expected behavior)</div><div>&nbsp;</div><div>Can you provide a simple solution reproducing your issue?</div><div>&nbsp;</div><div>Silvio.</div><div>&nbsp;</div><div>&nbsp;</div><div>&nbsp;</div>]]>
   </description>
   <pubDate>Thu, 09 Jun 2011 11:50:07 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2746&amp;PID=10922#10922</guid>
  </item> 
  <item>
   <title>LoginManager and server side : In my case, the newEm says its...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2746&amp;PID=10917#10917</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=531" rel="nofollow">midnit</a><br /><strong>Subject:</strong> 2746<br /><strong>Posted:</strong> 09-Jun-2011 at 3:28am<br /><br />In my case, the newEm says its logged in, but if you query or something it hits my LoginManager - at which point I don't have any credentials to use...which leads to using the .Login(sessionkey).<span style="font-size:10px"><br /><br />Edited by midnit - 09-Jun-2011 at 3:31am</span>]]>
   </description>
   <pubDate>Thu, 09 Jun 2011 03:28:55 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2746&amp;PID=10917#10917</guid>
  </item> 
  <item>
   <title>LoginManager and server side :    Regarding linking an EM...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2746&amp;PID=10914#10914</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=892" rel="nofollow">sbelini</a><br /><strong>Subject:</strong> 2746<br /><strong>Posted:</strong> 08-Jun-2011 at 11:48am<br /><br />Regarding linking an EM to the EntityManager in the SaveInterceptor, <div></div><em>var newEm = new SomeEntityManager(this.EntityManager);</em><div>&nbsp;</div><div>the newEm will be logged in as well.</div><div>&nbsp;</div><div>&nbsp;</div><div>As for using <em>Login(Guid SessionKey)</em>, it takes a "different route" (i.e. internal route) than <em>Login(ILoginCredential credential) </em>and doesn't actually go thru your login manager.</div><div>&nbsp;</div><div>I can't think of a way of detecting where the login is coming from. I will double check with our senior engineer.</div><div>However, since the LoginManager is only triggered when using <em>Login(ILoginCredential credential)</em>, the common case would be it being triggered by the client. That's unless you are passing credentials to a RSMC,&nbsp;have it hardcoded in the interceptors, or simply is logging in with null credentials.</div><div>&nbsp;</div><div>Silvio.</div><span style="font-size:10px"><br /><br />Edited by sbelini - 08-Jun-2011 at 11:51am</span>]]>
   </description>
   <pubDate>Wed, 08 Jun 2011 11:48:03 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2746&amp;PID=10914#10914</guid>
  </item> 
  <item>
   <title>LoginManager and server side : Indeed. I did not mean to imply...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2746&amp;PID=10912#10912</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=531" rel="nofollow">midnit</a><br /><strong>Subject:</strong> 2746<br /><strong>Posted:</strong> 08-Jun-2011 at 6:27am<br /><br />Indeed. I did not mean to imply that I was unable to work around the inconsistency (missing&nbsp;Principal)&nbsp;- if I write enough code. I have started this work but it could be avoided if the entitymanager.principal was populated as elsewhere.<DIV>&nbsp;</DIV><DIV>What of linking an entitymanager to the entitymanager in a saveinterceptor? I presume the one is logged in, but when you use it to link a new entitymanager the new one is not logged in. Something like...</DIV><DIV><table width="99%"><tr><td class="BBquote"></DIV><DIV><DIV>class SaveStuffInterceptor : EntityServerSaveInterceptor</DIV><DIV>{</DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp; protected override bool ExecuteSave() {</DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var newEm = new&nbsp;SomeEntityManager(this.EntityManager);</DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp; }</DIV><DIV>}</DIV><DIV></td></tr></table></DIV><DIV><DIV>Anything done with newEm will trigger log in...but isn't this.EntityManager logged in? If you use the sessionkey the loginmanager is avoided.</DIV><DIV><table width="99%"><tr><td class="BBquote"></DIV><DIV><DIV><DIV>class SaveStuffInterceptor : EntityServerSaveInterceptor</DIV><DIV>{</DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp; protected override bool ExecuteSave() {</DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var newEm = new SomeEntityManager();</DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; newEm.Login(this.EntityManager.SessionKey);</DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp; }</DIV><DIV>}</DIV><DIV></td></tr></table></DIV><DIV>I had just assumed if one worked the other would - or vice versa. Obviously I was wrong, just wondering why.</DIV><DIV>&nbsp;</DIV><DIV>&nbsp;</DIV></DIV></DIV></DIV></DIV><DIV>Per the IsClient. I was meaning that in the LoginManager I saw no way to detect if the login was triggered via the client or server (ie. serverside I create an entitymanager and log it in vs create one on the client and log it in). Is there a way?</DIV>]]>
   </description>
   <pubDate>Wed, 08 Jun 2011 06:27:55 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2746&amp;PID=10912#10912</guid>
  </item> 
  <item>
   <title>LoginManager and server side :   Hi midnit, When you create...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2746&amp;PID=10910#10910</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=892" rel="nofollow">sbelini</a><br /><strong>Subject:</strong> 2746<br /><strong>Posted:</strong> 07-Jun-2011 at 5:27pm<br /><br />Hi midnit,<div> </div><div>When you create an Entity Manager in the client, it's not logged in.</div><div>If you don't explicitly login, but tries to perform and operation (i.e. query/save) the Entity Manager will automatically login as a Guest (assuming you allow guest users - in your app.config). Logged in, but not authenticated. </div><div> </div><div>In the server the base type EntityManager will be logged in and, if the client is authenicated, authenticated as well. Even though you cannot access the Principal via EntityManager.Principal, you can do so via the Save/QueryInterceptor (i.e. this.Principal) with all the information would find in the client's EM.Principal.</div><div> </div><div>Regarding your second post, wouldn't passing the Principal from the Interceptor (i.e. this.Principal) to the audit code resolve the issue? (if you wanted the code to be the same in the client and server, couldn't you pass mgr.Principal from the client as well?)</div><div> </div><div>As for your last post, in my tests my local (i.e. in the client) mgr.IsClient will return true while my SaveInterceptor's EntityManager.IsClient will return false. Can you provide a simple test case reproducing the issue?</div><div> </div><div>Regards, </div><div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sbelini.</div>]]>
   </description>
   <pubDate>Tue, 07 Jun 2011 17:27:34 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2746&amp;PID=10910#10910</guid>
  </item> 
  <item>
   <title>LoginManager and server side : Is there any way to test in the...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2746&amp;PID=10906#10906</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=531" rel="nofollow">midnit</a><br /><strong>Subject:</strong> 2746<br /><strong>Posted:</strong> 07-Jun-2011 at 9:07am<br /><br /><P>Is there any way to test in the LoginManager if this is coming from the server? </P><DIV>I tried EntityManager.IsClient when our app initially logs in and it returns false. Testing when triggered in the saveinterceptor and it returns false also.</DIV><DIV>&nbsp;</DIV><DIV>Please answer everything, not just this last post.</DIV>]]>
   </description>
   <pubDate>Tue, 07 Jun 2011 09:07:33 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2746&amp;PID=10906#10906</guid>
  </item> 
  <item>
   <title>LoginManager and server side : A bit more info...  We have...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2746&amp;PID=10905#10905</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=531" rel="nofollow">midnit</a><br /><strong>Subject:</strong> 2746<br /><strong>Posted:</strong> 07-Jun-2011 at 8:59am<br /><br />A bit more info...<DIV>&nbsp;</DIV><DIV>We have some audit code that tracks who edited what. When an entity is touched (add, edit, delete) it uses...or was trying to use...the Principal of the EntityManager to attached these actions to the user in question.</DIV><DIV>&nbsp;</DIV><DIV>Once we improved our security so every action must be truely logged in this no longer works. It works fine when edits are triggered from the client, but from the server, as in the saveinterceptor, Principal is null so though I can confirm( kinda) that the EntityManager is logged in (has a session key) I can't rely on the Principal existing. If I create an entity in the saveinterceptor when the audit code checks entity.EntityAspect.EntityManager.Principal it cries profusely. This code doesn't know its triggered in a saveinterceptor and has no access to the this.Principal. This would work if the Principal wasn't null.</DIV><DIV>&nbsp;</DIV><DIV>In the previous thread it was mentioned that populating the Principal should be possible...where did that end up?</DIV><DIV>&nbsp;</DIV><DIV>Also, if you create a new EntityManager and pass in the EntityManager from the save interceptor to link it...it does nothing. Any reason this couldn't be made to work too?</DIV><DIV>&nbsp;</DIV><DIV>Am I beating a red-headed step child (SaveInterceptor)? I have considered moving this around but thats not a quick fix.</DIV>]]>
   </description>
   <pubDate>Tue, 07 Jun 2011 08:59:49 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2746&amp;PID=10905#10905</guid>
  </item> 
  <item>
   <title>LoginManager and server side : My first question, which isn&amp;#039;t...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2746&amp;PID=10904#10904</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=531" rel="nofollow">midnit</a><br /><strong>Subject:</strong> 2746<br /><strong>Posted:</strong> 07-Jun-2011 at 8:34am<br /><br />My first question, which isn't causing me an issue...I just didnt understand it: Why does the entityManager in the Login always show IsLoggedIn=true? This is in an IEntityLoginManager, the entityManager passed in always shows IsLoggedIn=true - at least in my case.&nbsp; The one in a saveinterceptor is always true too.<DIV></DIV><DIV></DIV><DIV></DIV><DIV></DIV><DIV></DIV><DIV></DIV>&nbsp; <DIV>What can I use to test that an EntityManager is logged in? Its not the IsLoggedIn, its not the Principal. Maybe SessionKey? What can I use that will work 100% of the time and not depend on what EntityManager is handling the Entity?</DIV><DIV>&nbsp;</DIV><DIV>Also this goes back to a thread I started a while ago about the Principal being null on the EntityManager. Its causing me big headaches right now. I am assuming an EntityManager will be logged in and I need to use the Principal for context of the update - or I have to figure a different way to pass around who&nbsp;is logged in which seems I shouldn't have to do since the EntityManager is handling logging me in and in most cases has the Principal and in some cases the IsLoggedIn is accurate.</DIV><DIV>&nbsp;</DIV><DIV><a href="http://www.ideablade.com/forum/forum_posts.asp?TID=2479&amp;title=losing-principal" target="_blank">http://www.ideablade.com/forum/forum_posts.asp?TID=2479&amp;title=losing-principal</A></DIV><DIV>&nbsp;</DIV><DIV>&nbsp;</DIV><span style="font-size:10px"><br /><br />Edited by midnit - 07-Jun-2011 at 8:45am</span>]]>
   </description>
   <pubDate>Tue, 07 Jun 2011 08:34:29 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2746&amp;PID=10904#10904</guid>
  </item> 
 </channel>
</rss>