2

Following from my previous question regarding OpenRasta authentication, I'd like to know if NTLM authentication can be configured for OpenRasta service that is running as executable outside IIS.

Cheers.

Community
  • 1
  • 1
KlsLondon
  • 1,160
  • 1
  • 9
  • 18

1 Answers1

3

Sorry, I didn't read the question carefully enough. Unfortunately, I don't believe you can do this out-of-the-box. There is an HttpListenerHost provided by OpenRasta which encapsulates a System.Net.HttpListener instance as a private variable. See the code in this forum thread to see how to use the HttpListenerHost in a Console app. If the HttpListener variable were public or at least protected it should be a simple matter of setting the AuthenticationSchemes property along the lines of this code:

var host = new HttpListenerHost();
host.Listener.AuthenticationSchemes = AuthenticationSchemes.Ntlm;

If you really need this capability, you can get the source for OpenRasta and update it to expose the underlying HttpListener variable so you can configure it to your heart's content.

===================>> ORIGINAL ANSWER FOR IIS:

First you create a standard WebForms or MVC project configured for OpenRasta as shown in the Getting Start wiki page. Next, configure the project as described in this Wrox article to support Windows authentication. Supporting Windows authentication will enable both NTLM & Kerberos authentication.

Sixto Saez
  • 12,610
  • 5
  • 43
  • 51
  • 1
    On the IIS bit, how do you then retrieve the security context in your app, would it be available on ICommunicationContext? Thanks – KlsLondon Mar 14 '12 at 17:12
  • 2
    I think I can point you in the right direction on accessing the ICommunicationContext but I don't have right now to check it out. This [blog post](http://codebetter.com/sebastienlambla/2011/09/14/extending-configuration-in-openrasta-2-1/) shows extension points in OpenRasta 2.1 where the ICommunicationContext can be accessed in the pipeline. – Sixto Saez Mar 14 '12 at 17:50
  • Thanks Sixto, I know how to get ICommunicationContext, my question is rather if user credentials are available on it and if not how can I get them? – KlsLondon Mar 14 '12 at 18:25
  • 2
    The HttpListenerCommunicationContext has a User property which has the credentials but I don't know which implementation of ICommunicationObject exists under ASP.NET when OpenRasta spins up. You could check in debug mode to dig into the ICommunicationContext instance for a similar property. – Sixto Saez Mar 14 '12 at 19:01
  • 2
    In both HttpListener and asp.net, the ICommunicationContext.User property is set to whatever flows from the hosting environment, and the same happens with the authentication modules. – SerialSeb Mar 17 '12 at 08:14