
Documentation for Crowd 1.3. Documentation for other versions of Crowd is available too.
Crowd provides centralised authentication and single sign-on connectors for the web security framework Acegi. Acegi provides a modular and highly configurable approach to authentication and authorisation for J2EE applications.
The connectors are available with Crowd 1.2 and later and have been developed and tested with Acegi 1.0.5.
Please consult the Acegi quick start guide or reference guide for a thorough insight into the Acegi framework. You might also find useful information in our Crowd-Acegi integration tutorial.
This guide assumes developer-level knowledge
This guide assumes you have Crowd 1.3 or later installed and that you want to integrate your Acegi-based web application with Crowd's security server. This guide is more for developers than administrators.
CROWD.Crowd needs to be aware that AcegiApp will be making authentication requests to Crowd. In brief, you will need to do the following:
Please see 3.2 Adding an Application for a detailed guide.
You will need to add the Crowd Acegi connector library and its associated dependencies to your Acegi application. You can do this manually by copying over the JAR files to your Acegi application or, if your Acegi application is a Maven project, you can add the Crowd Acegi connector as a project dependency.
Follow either 2.1.1 or 2.1.2 (not both).
Copy the Crowd integration libraries and configuration files. This is described in the Client Configuration documentation. You will need to at least copy across the following file to your Acegi application:
Copy From |
Copy To |
|---|---|
CROWD/client/crowd-integration-client-X.X.X.jar |
AcegiApp/WEB-INF/lib |
CROWD/client/lib/*.jar |
AcegiApp/WEB-INF/lib |
Follow either 2.1.1 or 2.1.2 (not both).
To integrate Crowd with your Maven 2 project, you will need to include the following dependency in your pom.xml:
<dependency>
<groupId>com.atlassian.crowd</groupId>
<artifactId>crowd-integration-client</artifactId>
<version>X.X</version>
<type>pom</type>
</dependency>
Because the Crowd libraries are not published to the standard Maven repository, you will need to add Atlassian's public repository:
<repositories> <repository> <id>central</id> <url>https://m2proxy.atlassian.com/repository/public</url> <snapshots> <enabled>true</enabled> <updatePolicy>always</updatePolicy> </snapshots> <releases> <enabled>true</enabled> </releases> </repository> </repositories>
See more information on Maven 2 integration.
The Crowd Acegi connector needs to be configured with the details of the Crowd server.
crowd.properties file to the classpath of your Acegi application:
Copy From |
Copy To |
|---|---|
CROWD/client/conf/crowd.properties |
AcegiApp/WEB-INF/classes |
crowd.properties and populate the following fields appropriately:
キー |
値 |
|---|---|
application.name |
Same as application name defined when adding the application to Crowd in Step 1. |
application.password |
Same as application password defined when adding the application to Crowd in Step 1. |
crowd.server.url |
|
session.validationinterval |
This is the time interval between requests which validate whether the user is logged in or out of the Crowd SSO server. Set to 0, if you want authentication checks to occur on each request. Otherwise set to the number of minutes you wish to wait between requests. Setting this value to 1 or higher will increase the performance of Crowd's integration. |
Passing crowd.properties as an environment variable
You can pass the location of a client application's crowd.properties file to the client application as an environment variable when starting the client application. This means that you can choose a suitable location for the crowd.properties file, instead of putting it in the client application's WEB-INF/classes directory.
This applies to the Crowd Administration Console's crowd.properties file too. You may find this particularly useful when integrating with a WAR deployment of an integrated application.
例:
-Dcrowd.properties={FILE-PATH}/crowd.properties
There are two ways you can integrate your application with Crowd:
First, you will need to add the Crowd client application context to wire up the Crowd beans that manage the communication to Crowd. You can do this by including the applicationContext-CrowdClient.xml Spring configuration file, found in crowd-integration-client.jar. For example, if you are configuring Spring using a context listener, you can add the following parameter in your WEB-INF/web.xml:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
...
classpath:/applicationContext-CrowdClient.xml
...
</param-value>
</context-param>
Next, open the applicationContext.xml file relevant to your application, which contains the Acegi configuration. You are likely to have a bean configuration similar to this snippet:
<bean id="filterChainProxy" class="org.acegisecurity.util.FilterChainProxy">
<property name="filterInvocationDefinitionSource">
<value>
CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
PATTERN_TYPE_APACHE_ANT
/images/**=#NONE#
/scripts/**=#NONE#
/styles/**=#NONE#
/**=httpSessionContextIntegrationFilter,logoutFilter,authenticationProcessingFilter,securityContextHolderAwareRequestFilter,rememberMeProcessingFilter,anonymousProcessingFilter,exceptionTranslationFilter,filterInvocationInterceptor
</value>
</property>
</bean>
Perform the following updates to your Acegi Spring configuration:
<bean id="crowdUserDetailsService" class="com.atlassian.crowd.integration.acegi.CrowdUserDetailsService">
<property name="securityServerClient" ref="securityServerClient"/>
</bean>
<bean id="crowdAuthenticationProvider" class="com.atlassian.crowd.integration.acegi.CrowdAuthenticationProvider">
<property name="userDetailsService" ref="crowdUserDetailsService"/>
<property name="httpAuthenticator" ref="httpAuthenticator"/>
<property name="securityServerClient" ref="securityServerClient"/>
</bean>
<bean id="authenticationManager" class="org.acegisecurity.providers.ProviderManager">
<property name="providers">
<list>
<ref local="crowdAuthenticationProvider"/>
...
</list>
</property>
</bean>
Further extensions
Crowd's remote API
We recommend that applications do not store the Crowd users locally. Rather, applications should query users via Crowd's remote API.
SSO is optional and requires centralised user management
Single sign-on is optional. If you wish to configure SSO you must first configure centralised user management as described in step 3.1 above.
Perform the following additional updates to your Acegi Spring configuration:
<bean id="authenticationProcessingFilter" class="com.atlassian.crowd.integration.acegi.CrowdAuthenticationProcessingFilter">
<property name="httpAuthenticator" ref="httpAuthenticator"/>
<property name="authenticationManager" ref="authenticationManager"/>
<property name="authenticationFailureUrl" value="/login.jsp?error=true"/>
<property name="defaultTargetUrl" value="/"/>
<property name="filterProcessesUrl" value="/j_security_check"/>
...
</bean>
<bean id="logoutFilter" class="org.acegisecurity.ui.logout.LogoutFilter">
<constructor-arg value="/index.jsp"/>
<constructor-arg>
<list>
...
<ref bean="crowdLogoutHandler"/>
<bean class="org.acegisecurity.ui.logout.SecurityContextLogoutHandler"/>
</list>
</constructor-arg>
<property name="filterProcessesUrl" value="/logout.jsp"/>
</bean>
Bounce your application. You should now have centralised authentication and single sign-on with Crowd.
For the purposes of Crowd integration with Acegi, you should map Acegi's roles to Crowd's groups. To put it another way: in order to use Acegi's authorisation features, users in Crowd will have their Acegi roles specified by their group names.
For example if user 'admin' is in the 'crowd-admin' group, then the user 'admin' will be authorised to view pages restricted to the 'crowd-admin' role in Acegi.