Using Worksite Web authentication for my own page ?

Options
Hello

I have already asked this question to the worksite-devsupport (sorry if that's a disturbance to the people answering my silly questions, **** bless them).

I would like to benefit from the worksite web authentication method in a page that I would be designing myself. Is that possible ?
Does it require to host the page in the same web site than WSW (that wouldn't be a problem at all) ?

I need this because we are doing some specific development with asp.net pages, for which we require to have a kerberos authentication, based on a trusted login mode. This is something I have no knowledge about, and my colleague got the idea: if we could use the authentication from worksite it would be far simpler than doing it ourself (the worksite web authentication will be configured to what we exactly need, and it will be simpler in terms of maintenance as well).

thanks in advance

Comments

  • In theory, you should be able to do this. ASSUMPTIONS: You are using Visual Studio to complete these tasks. You already have WorkSite Web configured to use Kerberos.
    • Create an HttpHandler. Put some code in to write out a response. This is just a class file. You can use VB.Net or C#.
    • Inside your project, add references to iManage.Worksite.Web, iManage.WorkSite.Web.UI, Interop.iManage.dll and Interop.iManadmin.dll. These are the assemblies that run WorkSite Web.
    • Inside your handler, inherit from iManage.WorkSite.Web.UI.AutenticatedHttpHandler. This is the WorkSite Web class that inidcates authentication is required.
    • Compile your project into an assembly.
    • Drop your assembly into <worksite_install_directory>/bin.
    • Add a reference in WorkSite Web's web.config to your handler. Search for httpHandlers to find the list of all handlers and how your entry should be configured.
    • Your handler will now be accessed via the WorkSite URL: http://server/worksite/myHandler.aspx.
    • When you go to that page, you should not get a 401, but rather, you should see the response text.
    For more information on httpHandlers refer to the MSDN documentation.

    Regards,
    dabird
  • Thanks a lot dabird

    I'll try that

    Regards
  • I gave a try but no luck so far. Calling my url does call the worksite web autentication but the page I'm trying to reach is not shown after identifying through worksite web.

    Here is the detail of what I've done :

    below the C# code inheriting the AutenticatedHttpHandler

    namespace testasp
    {

    public class HelloWorldHandler : iManage.WorkSite.Web.UI.AutenticatedHttpHandler
    {
    public override void ProcessRequest()
    {
    Context.Response.Write("html");
    Context.Response.Write("body");
    Context.Response.Write("h1 Hello from Synchronous custom handler. ");
    Context.Response.Write("/body");
    Context.Response.Write("/html");

    }
    }
    }
    I compiled the dll and put it on the server in :
    C:\Program Files\Interwoven\WorkSite\Web\bin
    In the web.config file of the worksite web, I added :

    httpHandlers
    ....
    add verb="*" path="scripts/Test.asp" type="testasp.HelloWorldHandler" validate="true"/
    /httpHandlers
    (I removed all the < and > around the html and xml code for the forum but they're all present in reality).

    So when I call the url :
    localhost/worksite/scripts/Test.asp
    I get first the login page of worksite web, I login, then I get what looks like a regular worksite web page (with banner, frame etc.. all like in the worksite web), and the browser is trying to load/access the resource (I can see that from the status bar at bottom) but it keeps loading and loading without displaying anything.

    Any idea of what I've done wrong or what's missing ?
    I have doubt about the fact that no phisycal file corresponds to the url I'm typing and also what I added in the config file could be wrong.. I'll double check that

    thanks in advance
  • In your web.config change your entry to:

    add verb="*" path="scripts/Test.asp*" type="testasp.HelloWorldHandler, testasp" validate="true"/

    and make a call to http://localhost/worksite/scripts/Test.aspx

    See if this works.
  • thanks for your answer

    unfortunately, it does the same..

    IE hangs trying to load the page, no error message and no error page...

    Smiley Sad
  • Hello again...

    I'm trying another approach for doing this, which is a bit different but still very interesting for our needs.

    What I'm trying to do is :
    - restrict the access to a page to user that are already authenticated in worksite web (instead of forcing authentication with worksite for someone who is trying to access my page, it's slightly different approach).

    To do so, I created a very simple aspx page.

    In the page_load method, I write :
    protected void Page_Load(object sender, EventArgs e)
    {
    if (!IsPostBack)
    {
    IManSession oSession;
    IManDMS oDMS = new IManage.ManDMSClass();
    oSession = oDMS.Sessions.Add("MyDMSServer");
    IntPtr UToken = ((HttpWorkerRequest)((IServiceProvider)Context).GetService(typeof(HttpWorkerRequest))).GetUserToken();
    int UT = UToken.ToInt32();
    try
    {
    oSession.TrustedLogin2(UT);
    }
    catch (Exception ex)
    { }

    if (oSession.Connected)
    {
    //the access to the page is ok
    }
    else
    {
    //access not ok, redirect to some other page
    Response.Redirect("http://www.google.com");
    }
    }
    else
    {
    }
    }
    When testing this page directly from outside the worksite web, it does what it is supposed to do, in other words, it redirects me to google.

    Now I wanted to test it "within" the worksite web. So I tried the following steps:

    - I copied my .aspx to the worksite web scripts directory (\web\scripts)
    - I copied my dll containing the codebehind in the bin directory (\web\bin)
    - I tried to access my page by url : \worksite\scripts\MyPage.aspx

    As a result, I'm getting an error page with error :
    Could not load file or assembly 'Interop.IManage, Version=8.2.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
    Just to mention that in my visual studio project, I added the reference to the interop.IManage.dll that is located in the \web\bin directory of the worksite web... So it should be the same dll.

    My only doubt is that I compiled my aspx page with visual studio 2008, framework 3.5, maybe that's what causing this problem... otherwise, I'm clueless.

    Any ideas ?
    I didn't touch the web.config file (as I'm a complete newbie about that), maybe it's necessary as well.
  • I tried your first solution and was able to get it to work with the exact steps that "dabird" had mentioned and the code that you have used. (see attached images)
  • ok.. I'll try better then Smiley Wink

    thanks a lot for spending time testing and letting me know
  • thanks for your answer

    unfortunately, it does the same..

    IE hangs trying to load the page, no error message and no error page...

    Smiley Sad
    Hi egauthier,

    Have you tried debugging this in Visual Studio? You can debug your w3wp process and set a breakpoint at your ProcessRequest method. You can also use Fiddler to see if you are getting a response from the server, the HTTP status code, and the page content.

    Also, I'd like to point out that our authentication architecture is designed so that anytime a user requests a page and is not logged in, he must first attempt to login, which is why we redirect to the login page. It might be possible to redirect the non-validated users to a different page other than our login screen, but I will have to look at the code a bit more closely. What version of WorkSite Web are you using?

    Regards,
    dabird
  • Hi Dabird

    Thanks for your input, I'll try to debug if I'm still stuck with this.

    Anyway, if, as shown in hks message, this method inplies to have the worksite usual frames displayed around my page, this will not fit my requirement.

    Actually, my real problem is that I'm a newbie with all the web development, that's why asp.net with codebehind is nice for me, because it doesn't involve many html/jscript handling (and I'm not sure I can do that if I create a httpHandler, since I'm writing my code in a subclass of Page, which is already implementing the IHttpHandler interface, and I don't feel like rewriting all the code defined in the Page class Smiley Very Happy)

    Apart from that, my actual problem can completely be solved without using the worksite web authentication, it will be a bit more difficult, but I'll definitely find how to work with trustedlogin/kerberos authentication to validate my own page aspx pages, I found reliable links over the web, I just need time to review them (and understand them).

    Thanks again to both of you Dabird and hks, for your time and your help.
  • I have HP ProBook x360 laptop and i wonder how can i download its graphics driver update utility sooftware. Can anyone help?

TeamSite Developer Resources

  • Docker Automation

  • LiveSite Content Services (LSCS) REST API

  • Single Page Application (SPA) Modules

  • TeamSite Add-ons

If you are interested in gaining full access to the content, you can register for a My Support account here.
image
OpenText CE Products
TeamSite
APIs