Introduction

Google Apps for Crowd is a plugin for Atlassian Crowd, which makes it possible to reuse your user database from Google Apps domain in any application which can connect to Atlassian Crowd user database.

Internally, versions before 1.0 used Provisioning API to get user and group list and ClientLogin to get access token to Provisioning API and validate user passwords. Since Google has deprecated that APIs, in version 1.0 we moved from Provisioning API to Directory API to get user and group list, and in version 1.1 we moved from ClientLogin to GMail's IMAP to validate user passwords, and to service accounts to get access token to Directory API.

Because of introduction of the service accounts, unfortunately the administrator of your Crowd server needs to do some extra configuration during upgrade to 1.1 version; but thanks to this the authentication process to Google APIs is safer: you don't have to give real password to Google Apps domain to get user and group list, just a 'per-application' password (JSON key) for this service account is enough. From end user perspective nothing changes - they can still login using their Google Apps login and password as they did before.

Just like 'per-application passwords' for service accounts, the plugin also supports Google 'per-application' passwords for end-users to improve security. More information on that is provided here.

Google Apps domain configuration

Service account for Directory API

The plugin needs to use Google Directory API; one thing required to access it is a service account with proper access rights:

 

https://www.googleapis.com/auth/admin.directory.group.member.readonly, https://www.googleapis.com/auth/admin.directory.group.readonly, https://www.googleapis.com/auth/admin.directory.user.readonly

 

Administrator e-mail

Additionally, the service account needs an e-mail of an administrator user which has access rights to read user and group information from the Google Apps domain.
The final access rights to the domain given the plugin are logical AND of the access rights of the service account you set above, and the access rights of the administrator user you'll use with this service account. You can just use the default Google Apps administrator account (it's available at Company profile > Primary administrator account) - it's still secure because of this AND-ing of access rights you can always revoke access rights for the service account. Alternatively you can create a dedicated user and assign it an administrator role with rights to read user and group information.

IMAP for authorization of users

 

Allow less secure apps: ON

To allow IMAP authethication with password, account in google domain must have "Allow less secure apps" enabled. 

 

2-step verification (optional)

To improve security, the plugin partially supports 2-step verification for end users: things like SMS codes won't work with applications that use Crowd for authentication, because those applications display their own login window instead of using the one provided by Google. However instead of that, your end users can use per-application passwords. To use them each user should follow these steps:

Crowd directory configuration


plugin.license

 license for the plugin (you can get 30-day trial license for free)

google.apps.domain

 name of your Google Apps domain (like example.com)

google.apps.admin.email

 the e-mail of the user from Administrator e-mail step

google.apps.serviceaccount.jsonkey

 contents of the JSON key file downloaded in Service account for Directory API step

google.apps.admin.password, google.api.key (unused)

 unused keys from previous versions from this plugin, you may delete them; now the JSON key does the same in much more secure way

google.apps.group (optional)

 Name of Google group, used to filter users. If provided then only users from that group will be shown in the directory. If blank, then all users will be displayed

plugin.sync.withDomain (optional)

 Determines whether domain name will be appended to user and group names returned by the directory. If set to true, domain name will be appended (e.g. user@example.com), if false or empty, it won't be (e.g. user). 

google.apps.batchRequestReadTimeout (optional)

 Timeout in milliseconds for Google batch requests (for fetching user and group details). Default value if not provided is 5 minutes = 300000 milliseconds. If you'll ever get java.net.SocketTimeoutException: Read timed out, increasing this value may help.

google.apps.maxBatchRequestSize (optional)

 Maximum size of Google batch requests. Tweaking this value may increase (or decrease) directory speed. Valid values are 1 - 1000, and 100 is the default.

directory.cache.synchronise.interval (optional, since 1.2.0)

 CPGA4C directory is prefetched and cached from time to time (Crowd calls this process 'synchronization'). This value is specified in seconds - the default is 3600 (1 hour). If synchronization of your directory takes too long or you exceed Google Admin SDK daily quota, you can increase this value eg to 2 hours (7200). If you think your directory is synchronized too rarely, you ma try decreasing it eg to 30 minutes (1800).

com.atlassian.crowd.directory.sync.laststartsynctime 

 Remove this property (if exists) to apply your changes immediately during next directory action, without waiting for next directory.cache.synchronise.interval

Crowd logging configuration

Crowd logging can be changed as described here.

All logs from this add-on and libraries it uses reside in the file atlassian-crowd.log. By default INFO log level is enabled, sometimes when there's a problem with the plugin it's too little to find the reason and you have to to increase log level of some logger, or when some logger produces too much data, you have to decrease its log level. The most interesting loggers are:

 
 
The configuration happens in log4j.properties file. For example, to disable logging of slow HTTP requests, add the following line to log4j.properties:
  

 

log4j.logger.pl.craftware.shaded.org.perf4j.TimingLogger=OFF
For the exact locations of atlassian-crowd.log or log4j.properties, and for more details on logging in Crowd, see here in Crowd documentation.