Thursday, October 20, 2011

Crowd and WSDL

Need the latest copy of the Crowd WSDL file?

1. Visit http://www.atlassian.com/software/crowd/CrowdDownloadCenter.jspa

2. Download a copy.

3. Unpack the .jar files, and go into the atlassian-x.x.x directory.

4. vi crowd-webapp/WEB-INF/classes/crowd-init.properties

crowd.home=/home/myuser/projects/atlassian-crowd/data

5. ./start_crowd.sh

6. Go to http://localhost:8095 (or your dev server IP).

7. You should be able to connect and setup the Crowd service.

8. Go through the setup flow, and get a license key from Atlassian .

9. wget http://yourhost.com:8095/crowd/services/SecurityServer?wsdl

Need to get the WSDL working in Python? Either use ZSI (which is Google App Engine compatible) or the Python suds library:

https://jira.atlassian.com/browse/CWD-159

The instructions below will show you how to do Crowd authentication using ZSI:

http://tearsoffire.org/twiki/bin/view/Projects/CrowdSoapApi

from SecurityServer_services import SecurityServerLocator, SecurityServerHttpBindingSOAP
import SecurityServer_services as sss
from SecurityServer_services_types import ns0

loc = SecurityServerLocator()
server = loc.getSecurityServerPortType()

#build up the application authentication token
r = ns0.ApplicationAuthenticationContext_Def('ApplicationAuthenticationContext')
cred = ns0.PasswordCredential_Def('_credential').pyclass()
req = sss.authenticateApplicationRequest()
r._name='soaptest'
cred._credential = 'passwordGoesHere'
r._credential=cred
req._in0 = r
token = server.authenticateApplication( req )

#Look up a principle from the 'soaptest' application
prin = sss.findPrincipalByNameRequest()
prin._in0 = token._out
prin._in1 = 'cpepe'
me = server.findPrincipalByName( prin )
for i in me._out._attributes._SOAPAttribute:
    print '%s: %s' % (str(i._name), str(i._values.__dict__))

No comments:

Post a Comment