Name | Date | Size | |
---|---|---|---|
.. | 2015-12-09 23:39:20 | 41 | |
conf | 2015-12-09 23:39:20 | 3 | |
README | 2014-11-03 16:24:12 | 19.3 KiB |
README
/**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2014 ForgeRock AS. All rights reserved.
*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the License at
* See the License for the specific language governing
* permission and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*/
-------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------
Before we begin to use the googleapps-connector, we will need to obtain a refresh token from google.
You will need a google apps account so that you can obtain a client_secret.json file which will have
{
"clientId" : "example-client-Id.apps.googleusercontent.com",
"clientSecret" : "generated-sample-token",
"refreshToken" : "generated-refresh-token"
}
------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------
Before we start the sample, we have to set the domain, clientId, clientSecret, and refreshToken in our
...
"configurationProperties": {
"domain": "YOUR_DOMAIN",
"clientId": "YOUR_CLIENT_ID",
"clientSecret": "YOUR_CLIENT_SECRET",
"refreshToken": "YOUR_CLIENT_REFRESH_TOKEN"
},
...
Once those properties are set, the connector needs to be enabled by switching the following property
...
"name": "google",
"enabled": true,
...
--header "X-OpenIDM-Password: openidm-admin"
--header "Content-Type: application/json"
{
"name":"google",
"enabled":true,
"config":"config/provisioner.openicf/google",
"connectorRef":
{
"connectorName":"org.forgerock.openicf.connectors.googleapps.GoogleAppsConnector",
"bundleName":"org.forgerock.openicf.connectors.googleapps-connector",
"bundleVersion":"1.4.0.0-SNAPSHOT"
},
"ok":true
}
------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------
--header "X-OpenIDM-Password: openidm-admin"
--header "Content-Type: application/json"
--data
"{
}"
{
"phones":null,
"givenName":"Sam",
"familyName":"Carter",
"thumbnailPhotoUrl":null,
"addresses":null,
"__NAME__":"samcarter@yourdomain.com",
"changePasswordAtNextLogin":false,
"suspensionReason":null,
"aliases":null,
"customerId":"Cwev45or",
"isDelegatedAdmin":false,
"lastLoginTime":["1970-01-01T00:00:00.000Z"],
"agreedToTerms":true,
"deletionTime":null,
"isAdmin":false,
"creationTime":["2014-09-23T18:54:19.000Z"],
"ims":null,
"organizations":null,
"ipWhitelisted":false,
"fullName":"Sam Carter",
"includeInGlobalAddressList":true,
"isMailboxSetup":false,
"externalIds":null,
"suspended":false,
"nonEditableAliases":null,
"orgUnitPath":"/",
"relations":null,
"emails":
[
{
"address":"samcarter@yourdomain.com",
"primary":true
}
],
"_id":"101643010677712061243",
"_rev":"\"SHoRIPAZisvsSqsLJr3m3XS9Uw4/RfZOwrjqrpRsO6PCGNfEp2H00Ds\""
}
Note the complex data structure for the "emails" attribute. Google uses complex data structure for some attributes
like email, addresses, phone numbers, etc., which will also appear in some of the queries and result sets below.
--header "X-OpenIDM-Password: openidm-admin"
--header "Content-Type: application/json"
--data
'{
"__NAME__": "samcarter@yourdomain.com",
"__PASSWORD__" : "password",
"givenName" : "Sam",
"familyName": "Carter",
"agreedToTerms": true,
"changePasswordAtNextLogin" : false
"phones" :
[
{
"value": "1234567890",
"type": "home"
},
{
"value": "0987654321",
"type":"work"
}
]
}'
--header "X-OpenIDM-Password: openidm-admin"
--header "Content-Type: application/json"
{
"phones":
[
{"value":"1234567890","type":"home"},
{"value":"0987654321","type":"work"}
],
"givenName":"Sam",
"familyName":"Carter",
"thumbnailPhotoUrl":null,
"addresses":null,
"__NAME__":"samcarter@yourdomain.com",
"changePasswordAtNextLogin":false,
"suspensionReason":null,
"aliases":null,
"customerId":"Cwev45or",
"isDelegatedAdmin":false,
"lastLoginTime":["1970-01-01T00:00:00.000Z"],
"agreedToTerms":true,
"deletionTime":null,
"isAdmin":false,
"creationTime":["2014-09-23T18:54:19.000Z"],
"ims":null,
"organizations":null,
"ipWhitelisted":false,
"fullName":"Sam Carter",
"includeInGlobalAddressList":true,
"isMailboxSetup":false,
"externalIds":null,
"suspended":false,
"nonEditableAliases":null,
"orgUnitPath":"/",
"relations":null,
"emails":
[
{
"address":"samcarter@yourdomain.com",
"primary":true
}
],
"_id":"101643010677712061243",
"_rev":"\"SHoRIPAZisvsSqsLJr3m3XS9Uw4/RfZOwrjqrpRsO6PCGNfEp2H00Ds\""
}
--header "X-OpenIDM-Password: openidm-admin"
--header "Content-Type: application/json"
--data
'{
"__NAME__": "googleAppsTestGroup@yourdomain.com",
"__DESCRIPTION__": "Group used for google-connector sample.",
"name": "TestGroup"
}'
{
"__DESCRIPTION__": "Group used for google-connector sample.",
"directMembersCount": 0,
"nonEditableAliases": null,
"aliases": null,
"adminCreated": true,
"name": "TestGroup",
"__NAME__": "googleappstestgroup@yourdomain.com",
"_id": "03oy7u291s3qw1i",
"_rev": "\"SHoRIPAZisvsSqsLJr3m3XS9Uw4/8JZsrHGxtdaH4sF8vgzLiPmPqFs\""
}
You will need the _id created in step 1 to pass in as part of the request URL, 101643010677712061243.
--header "X-OpenIDM-Password: openidm-admin"
--header "Content-Type: application/json"
--data
'{
"groupKey" : "03oy7u291s3qw1i",
"role": "MEMBER",
"__NAME__": "samcarter@yourdomain.com",
"email": "samcarter@yourdomain.com",
"type": "MEMBER"
}'
{
"role": "MEMBER",
"type": "USER",
"email": "samcarter@yourdomain.com",
"__NAME__": "03oy7u291s3qw1i/samcarter@yourdomain.com",
"groupKey": "109384837631312225274",
"_id": "014ykbeg40r6x06/samcarter@yourdomain.com",
"_rev": "\"SHoRIPAZisvsSqsLJr3m3XS9Uw4/GiZLiMKb3U62M58IabSzPKAVIOE\""
}
--header "X-OpenIDM-Password: openidm-admin"
--header "Content-Type: application/json"
{
"__DESCRIPTION__": "Group used for google-connector sample.",
"directMembersCount": 1,
"nonEditableAliases": [
"googleAppsTestGroup@yourdomain.com.test-google-a.com"
],
"aliases": null,
"adminCreated": true,
"name": "TestGroup",
"__NAME__": "googleappstestgroup@yourdomain.com",
"_id": "03oy7u291s3qw1i",
"_rev": "\"SHoRIPAZisvsSqsLJr3m3XS9Uw4/WcZC54etzuPtruE7uByf9NQ82Ow\""
}
--header "X-OpenIDM-Password: openidm-admin"
--header "Content-Type: application/json"
{
"_id": "03oy7u291s3qw1i"
}
--header "X-OpenIDM-Password: openidm-admin"
--header "Content-Type: application/json"
{
"_id":"101643010677712061243"
}
------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------
A sync.json is included with this sample which maps some user attributes from Google to Managed User entries.
Request :
--header "X-OpenIDM-Password: openidm-admin"
--header "Content-Type: application/json"
--request POST "http://localhost:8080/openidm/recon?_action=recon&mapping=sourceGoogle__ACCOUNT___managedUser"
Response :
{"_id":"efefd951-9153-46f6-9446-894805d85173","state":"ACTIVE"}
A quick look at the reconciliation entry will tell us what happened during the reconciliation process :
Request :
--header "X-OpenIDM-Password: openidm-admin"
--header "Content-Type: application/json"
Response :
{
"_id" : "efefd951-9153-46f6-9446-894805d85173",
"mapping" : "sourceGoogle__ACCOUNT___managedUser",
"state" : "SUCCESS",
"stage" : "COMPLETED_SUCCESS",
"stageDescription" : "reconciliation completed.",
"progress" : {
"source" : {
"existing" : {
"processed" : 9,
"total" : "9"
}
},
"target" : {
"existing" : {
"processed" : 8,
"total" : "8"
},
"created" : 0
},
"links" : {
"existing" : {
"processed" : 8,
"total" : "8"
},
"created" : 0
}
},
"situationSummary" : {
"SOURCE_IGNORED" : 1,
"MISSING" : 0,
"FOUND" : 0,
"AMBIGUOUS" : 0,
"UNQUALIFIED" : 0,
"CONFIRMED" : 8,
"SOURCE_MISSING" : 0,
"ABSENT" : 0,
"TARGET_IGNORED" : 0,
"UNASSIGNED" : 0,
"FOUND_ALREADY_LINKED" : 0
},
"statusSummary" : {
"FAILURE" : 0,
"SUCCESS" : 9
},
"parameters" : {
"object" : {
"sourceQuery" : {
"_queryId" : "query-all-ids"
},
"targetQuery" : {
"_queryId" : "query-all-ids"
}
},
"pointer" : {
"empty" : true
},
"transformers" : [ ],
"set" : false,
"collection" : false,
"map" : true,
"string" : false,
"wrappedObject" : {
"sourceQuery" : {
"_queryId" : "query-all-ids"
},
"targetQuery" : {
"_queryId" : "query-all-ids",
}
},
"list" : false,
"number" : false,
"boolean" : false,
"null" : false
},
"started" : "2014-10-31T14:16:34.721Z",
"ended" : "2014-10-31T14:16:35.509Z",
"duration" : 788
}