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:
wsdl /l:CS /protocol:SOAP http://localhost:8080/crowd/services/SecurityServer?wsdl
csc /t:library /r:System.Web.Services.dll /r:System.Xml.dll SecurityServer.cs
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.
2 Comments
Jean Verger
Mar 14, 2007Validation 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 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;
SarahA
Jul 09, 2010There'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.