Microsoft .NET Client

All Versions
Click for all versions
Crowd 1.5 Documentation

Index

An updated version of this library has been made available through the Atlassian Codegeist competition.

You will need to create a .NET proxy to the SOAP API, as follows:

  1. Open a Microsoft Visual Studio .NET Command Prompt.
  2. Run the following command to generate a proxy class (change the location of the WSDL according to your installation):
    wsdl /l:CS /protocol:SOAP http://localhost:8080/crowd/services/SecurityServer?wsdl
    

    (Note: Ignore any schema validation warnings returned here.)

  3. Compile the generated class with the following references:
    csc /t:library /r:System.Web.Services.dll /r:System.Xml.dll SecurityServer.cs
    

    This should generate a .NET assembly called SecurityServer.DLL.

When creating your .NET client application, remember to add a reference to this proxy. You will also need to add a reference to System.Web.Services.DLL.

The sample code calls methods from the proxy to perform authentication in a sample Crowd application. Change the constants at the top of the code relevant to any application you have previously set up in Crowd.

Related Topics  

Crowd Documentation  

Labels:

microsoft microsoft Delete
Enter labels to add to this page:
Wait Image 
Looking for a label? Just start typing.
  1. Mar 14, 2007

    Jean Verger says:

    (i) Validation Factors and Unitque Tokens\\ The example provided in the code w...
    Validation Factors and Unitque Tokens

    The example provided in the code works great.

    However, it misses pointing out about ValidationFactors which, as far as I am understanting, allows CROWD to provide unique tokens based on those Factors.

    Here the C# to add validation factors as well as the code to retrieve the IP and User Agent of the client.

    Hope it helps

    Adding Validation Factors


    ValidationFactor fIP = new ValidationFactor();
    fIP.name = "REMOTE_ADDRESS";
    fIP.value = ip;

    ValidationFactor fBrowser = new ValidationFactor();
    fBrowser.name = "USER_AGENT";
    fBrowser.value = browser;

    ValidationFactor[] vFactor = new ValidationFactor[2];
    vFactor.SetValue(fIP, 0);
    vFactor.SetValue(fBrowser, 1);
    Your_Principal_Context.validationFactors = vfactor,
    _securityServer.authenticatePrincipal(appToken,  Your_Principal_Context);

    Retrieving IP and User Agent from the Client

    HttpContext context = HttpContext.Current;
    HttpResponse response = context.Response;
    HttpRequest request = context.Request;
    string sUseragent = request.Headers["User-Agent"];
    string sIP1 = request.ServerVariables["REMOTE_ADDR"].ToString();
    string sIP2 = "";
    string sIP = "";
    if (request.ServerVariables["HTTP_X_FORWARDED_FOR"] != null)
    {
    sIP2 = request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString();
    }
    sIP = (sIP2 != "") ? sIP2 : sIP1;

Add Comment