7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel/**
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel *
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel * Copyright (c) 2014 ForgeRock AS. All rights reserved.
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel *
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel * The contents of this file are subject to the terms
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel * of the Common Development and Distribution License
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel * (the License). You may not use this file except in
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel * compliance with the License.
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel *
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel * You can obtain a copy of the License at
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel * http://forgerock.org/license/CDDLv1.0.html
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel * See the License for the specific language governing
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel * permission and limitations under the License.
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel *
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel * When distributing Covered Code, include this CDDL
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel * Header Notice in each file and include the License file
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel * at http://forgerock.org/license/CDDLv1.0.html
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel * If applicable, add the following below the CDDL Header,
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel * with the fields enclosed by brackets [] replaced by
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel * your own identifying information:
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel * "Portions Copyrighted [year] [name of copyright owner]"
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel */
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel
5b2431f08066ce8301da5def5496903740abbfa9Mark CraigSample 7 - Scripting a SCIM-like Schema
5b2431f08066ce8301da5def5496903740abbfa9Mark Craig---------------------------------------
3b70a3e7bfc7ae8aa755080c981dfc939e8a259eMatthias Tristl
5b2431f08066ce8301da5def5496903740abbfa9Mark CraigThis sample demonstrates using scripting to expose users according to a
5b2431f08066ce8301da5def5496903740abbfa9Mark CraigSCIM-like schema.
3b70a3e7bfc7ae8aa755080c981dfc939e8a259eMatthias Tristl
5b2431f08066ce8301da5def5496903740abbfa9Mark CraigFor documentation pertaining to this example see:
17ac9740889daa3a239caefc6fb8615c60b5a6d1Lana Frosthttp://openidm.forgerock.org/doc/bootstrap/samples-guide/#more-sample-7
3b70a3e7bfc7ae8aa755080c981dfc939e8a259eMatthias Tristl
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake FeaselNote that this sample does not work with the OpenIDM UI, due to the fact
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feaselthat the managed/user schema does not match the default.
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel
5b2431f08066ce8301da5def5496903740abbfa9Mark CraigTo try the sample, follow these steps.
a61a3a6b1e649d1809550caf6f5c0ccab10f0d3aMatthias Tristl
4b4c3a2028eea921136be5b4717c69c074b4982eLana 1. Start OpenIDM with the configuration for sample 7.
3b70a3e7bfc7ae8aa755080c981dfc939e8a259eMatthias Tristl
5b2431f08066ce8301da5def5496903740abbfa9Mark Craig $ cd /path/to/openidm
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel $ ./startup.sh -p samples/sample7
3b70a3e7bfc7ae8aa755080c981dfc939e8a259eMatthias Tristl
4b4c3a2028eea921136be5b4717c69c074b4982eLana 2. Run reconciliation to copy the user from the XML file under data/ to
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel the OpenIDM internal repository. The scripts configured within sync.json
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel transform the user data to fit the SCIM-like schema.
3b70a3e7bfc7ae8aa755080c981dfc939e8a259eMatthias Tristl
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel $ curl -k -H "Content-type: application/json" -u "openidm-admin:openidm-admin" -X POST "https://localhost:8443/openidm/recon?_action=recon&mapping=systemXmlfileAccounts_managedUser"
5b2431f08066ce8301da5def5496903740abbfa9Mark Craig
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel 3. Retrieve the user from the repository.
5b2431f08066ce8301da5def5496903740abbfa9Mark Craig
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel $ curl -k -u "openidm-admin:openidm-admin" -X GET "https://localhost:8443/openidm/managed/user/DDOE1?_prettyPrint=true"
5b2431f08066ce8301da5def5496903740abbfa9Mark Craig {
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "_id" : "DDOE1",
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "_rev" : "1",
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "schemas" : "['urn:scim:schemas:core:1.0']",
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "ims" : [ {
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "type" : "aim",
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "value" : "jonyOnAim"
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel }, {
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "type" : "skype",
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "value" : "skyperHiasl"
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel } ],
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "locale" : null,
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "phoneNumbers" : [ {
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "type" : "work",
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "value" : "1234567"
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel }, {
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "type" : "home",
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "value" : "1234568"
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel } ],
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "emails" : [ {
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "type" : "work",
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "value" : "hallo@example.com",
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "primary" : true
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel }, {
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "type" : "home",
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "value" : "jdoe@forgerock.com"
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel } ],
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "externalId" : "DDOE1",
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "preferredLanguage" : "en_US",
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "meta" : {
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "lastModified" : "Fri Apr 18 2014 15:15:33 GMT-0700 (PDT)",
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "created" : "Fri Apr 18 2014 15:15:33 GMT-0700 (PDT)"
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel },
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "userType" : "permanent",
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "photos" : [ {
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "type" : "photo",
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "value" : "https://photos.example.com/profilephoto/72930000000Ccne/F"
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel }, {
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "type" : "thumbnail",
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "value" : "https://photos.example.com/profilephoto/72930000000Ccne/T"
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel } ],
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "title" : "Mr.Universe",
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "timezone" : "America/Denver",
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "profileUrl" : "https://login.example.com/DDOE1",
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "nickName" : "Jonny",
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "name" : {
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "familyName" : "Doe",
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "middleName" : "Hias",
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "formatted" : "Dr. John H Doe III",
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "givenName" : "John",
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "honorificSuffix" : "III",
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "honorificPrefix" : "Dr."
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel },
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "userName" : "DDOE1",
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "displayName" : "John Doe",
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "addresses" : [ {
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "streetAddress" : "100 Universal City Plaza",
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "region" : "CA",
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "formatted" : "100 Universal City Plaza\nHollywood, CA 91608 USA",
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "postalCode" : "91608",
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "primary" : "true",
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "locality" : "Hollywood",
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "type" : "work",
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "country" : "USA"
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel }, {
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "streetAddress" : "222 Universal City Plaza",
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "region" : "CA",
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "formatted" : "222 Universal City Plaza\nHollywood, CA 91622 USA",
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "postalCode" : "91622",
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "primary" : "false",
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "locality" : "Hollywood",
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "type" : "home",
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "country" : "USA"
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel } ],
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "groups" : [ {
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "value" : "usemploys",
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "display" : "US Employees"
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel }, {
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "value" : "euemploys",
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "display" : "EU Employees"
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel } ]
5b2431f08066ce8301da5def5496903740abbfa9Mark Craig }