Geoffrey DeFilippi

SPS 2003 Web Services and Authentication - II

March 30, 2007 @ 10:13 am by Geoff | Programming

Okay I’ve created the testing application and it seems to work to a fashion, but not the way I intended. Here is what I’ve done:

1) Created a small Test Application using Visual Studio 2005 (C#)
2) Referenced the Sharepoint Portal Area Usergroup.asmx (Web Service) by adding a Web Reference
3) Using the default.aspx code behind page in the page load function:

protected void Page_Load(object sender, EventArgs e) 
{ 
     UserGroup.UserGroup usrgrp = new UserGroup.UserGroup(); 
     usrgrp.Credentials = System.Net.CredentialCache.DefaultCredentials; 
     try 
     { 
          XmlNode lnode = usrgrp.GetAllUserCollectionFromWeb(); 
     } 
     catch (Exception ex) 
     { 
          Response.Redirect("notallowed.aspx"); 
     } 
 
     Response.Redirect("allowed.aspx"); 
}

The intent here is that if you aren’t authorized to read from the web service with your security credentials then an error gets thrown which is correct and you get redirected to a not authorized page.

We’ve created a GPO that pushes local users accessing the site into the Trusted Security Zone so that they automatically pass their credentials. What seems to be happening is that any logged in user has the ability to access this web service, so this is obviously not the correct method to call to obtain membership information the way I intend to use it.

I’ll post some results later if I find a method that allows only reader level users access to the web service (it thinking the get urls web service might be correct as this portal area is restricted to certain active directory groups and certain other users [a domain trust is in place]). I’m thinking the web service that lists subsites might be the way to go.

Stay posted!!!

SPS 2003 Web Services and Authentication

March 20, 2007 @ 1:19 pm by Geoff | Programming

So here is the scenario:

  1. I’ve got a pretty mature installation of MS Sharepoint Portal 2003
  2. I’ve got a pretty useful web application running on the same server using the .NET 2.0 framework (C#)

Now wouldn’t it be great if there was an easy way to use the permissions and roles from a Sharepoint Site to determine if a user should be able to access the application, after all its pretty easy to manage permission using the portal and why re-invent the wheel.

So I’ve got a couple of options I could use.

  1. Put the application into a WSS site in a sub directory - Not how I want to do it because the link is going to be confusing and the potential of having to reinstall something in a sub - sub directory is scary to me. I also need this to branch out of a portal area which won’t support .NET 2.0
  2. Write a Web Part - Opps I’ve upgraded to .NET 2.0 and I really really want to use the rich feature set. I also can’t stand messing with the GAC and strong typing and web part security.
  3. Find a way to use the web services inside the .NET web app - Now were talking

Before you get excited or tell me how to do this: This is part 1 - description of the problem. I believe I’ve got a cheap and easy solution using the web service authentication wrapped in a try catch block, but so far no dice.

Look for an update soon.