Documentation for Crowd 1.0. Documentation for other versions of Crowd is available too.

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

  1. Open a Microsoft Visual Studio .NET Command Prompt.
  1. 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)
  2. 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.

関連トピック  

Crowd 1.0 Documentation  

  • ラベルなし

2 Comments

  1. Jean Verger

    (info)

    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 (big grin)

    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 ValidationFactor2;
    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;

  2. SarahA

    There's a useful guest blog post on the Atlassian blog, from Catch Limited, who've integrated a .Net application with Crowd: Integrating Enterprise Tester with Crowd.