Skip to content

Example configuration

Hiroyuki Wada edited this page May 27, 2022 · 2 revisions

Complex example (user and team)

Resource

<?xml version="1.0" encoding="UTF-8"?>
<resource xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
          xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
          xmlns:icfs="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3"
          xmlns:org="http://midpoint.evolveum.com/xml/ns/public/common/org-3"
          xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3"
          xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3"
          xmlns:t="http://prism.evolveum.com/xml/ns/public/types-3"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <name>GitHub</name>
    <connectorRef relation="org:default" type="c:ConnectorType">
        <filter>
            <q:and>
                <q:equal>
                    <q:path>c:connectorType</q:path>
                    <q:value>jp.openstandia.connector.github.GitHubConnector</q:value>
                </q:equal>
            </q:and>
        </filter>
    </connectorRef>
    <connectorConfiguration xmlns:icfc="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/connector-schema-3">
        <icfc:connectorPoolConfiguration>
            <icfc:minEvictableIdleTimeMillis>15000</icfc:minEvictableIdleTimeMillis>
            <icfc:minIdle>1</icfc:minIdle>
            <icfc:maxIdle>5</icfc:maxIdle>
            <icfc:maxObjects>10</icfc:maxObjects>
        </icfc:connectorPoolConfiguration>
        <icfc:resultsHandlerConfiguration>
            <icfc:enableNormalizingResultsHandler>false</icfc:enableNormalizingResultsHandler>
            <icfc:enableFilteredResultsHandler>false</icfc:enableFilteredResultsHandler>
            <icfc:enableAttributesToGetSearchResultsHandler>false</icfc:enableAttributesToGetSearchResultsHandler>
        </icfc:resultsHandlerConfiguration>
        <icfc:configurationProperties xmlns:gen500="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/bundle/jp.openstandia.connector.connector-github/jp.openstandia.connector.github.GitHubConnector">
            <gen500:privateKey>(GitHub Private Key with PEM format)</gen500:privateKey>
            <gen500:appId>(GitHub App ID)</gen500:appId>
            <gen500:installationId>(GitHub Installation ID)</gen500:installationId>
            <gen500:organizationName>(Organization Name</gen500:organizationName>
        </icfc:configurationProperties>
    </connectorConfiguration>
    <schemaHandling>
        <objectType>
            <kind>account</kind>
            <intent>default</intent>
            <displayName>User</displayName>
            <default>true</default>
            <objectClass>ri:user</objectClass>
            <attribute>
                <c:ref>ri:userName</c:ref>
                <outbound>
                    <strength>strong</strength>
                    <source>
                        <c:path>$focus/emailAddress</c:path>
                    </source>
                    <source>
                        <c:path>$projection/attributes/ri:login</c:path>
                    </source>
                    <expression>
                        <script>
                            <code>
                                // "login" is fetched only when the reconciliation task is executed
                                // after the invitation process is completed and the linking has been
                                // established by SAML login.
                                // After fetching, the value is updated as the userName prefix.
                                // This setting allows for association with GitHub Teams.
                                if (login != null) {
                                    return login + ":" + emailAddress
                                }
                                return "_unknown_:" + emailAddress
                            </code>
                        </script>
                    </expression>
                </outbound>
            </attribute>
            <attribute>
                <c:ref>ri:scimEmail</c:ref>
                <outbound>
                    <strength>strong</strength>
                    <source>
                        <c:path>$focus/emailAddress</c:path>
                    </source>
                </outbound>
            </attribute>
            <attribute>
                <c:ref>ri:scimGivenName</c:ref>
                <outbound>
                    <strength>strong</strength>
                    <source>
                        <c:path>$focus/givenName</c:path>
                    </source>
                </outbound>
            </attribute>
            <attribute>
                <c:ref>ri:scimFamilyName</c:ref>
                <outbound>
                    <strength>strong</strength>
                    <source>
                        <c:path>$focus/familyName</c:path>
                    </source>
                </outbound>
            </attribute>
            <!--
                Necessary if you want to set up Organization Owner
            -->
            <attribute>
                <c:ref>ri:organizationRole</c:ref>
                <fetchStrategy>explicit</fetchStrategy>
            </attribute>
            <!--
                Necessary if you want to do team assignment
            -->
            <attribute>
                <c:ref>ri:teams</c:ref>
                <fetchStrategy>explicit</fetchStrategy>
            </attribute>
            <!--
                Necessary if you want to do team assignment as a Maintainer
            -->
            <attribute>
                <c:ref>ri:maintainerTeams</c:ref>
                <fetchStrategy>explicit</fetchStrategy>
            </attribute>
            <association>
                <c:ref>ri:team</c:ref>
                <tolerant>false</tolerant>
                <displayName>Team Membership</displayName>
                <kind>entitlement</kind>
                <intent>team</intent>
                <direction>subjectToObject</direction>
                <associationAttribute>ri:teams</associationAttribute>
                <valueAttribute>ri:teamId</valueAttribute>
            </association>
            <association>
                <c:ref>ri:maintainerTeam</c:ref>
                <tolerant>false</tolerant>
                <displayName>Maintainer Team Membership</displayName>
                <kind>entitlement</kind>
                <intent>team</intent>
                <direction>subjectToObject</direction>
                <associationAttribute>ri:maintainerTeams</associationAttribute>
                <valueAttribute>ri:teamId</valueAttribute>
            </association>
        </objectType>
        <objectType>
            <kind>entitlement</kind>
            <intent>team</intent>
            <displayName>Team</displayName>
            <default>true</default>
            <objectClass>ri:team</objectClass>
            <attribute>
                <c:ref>ri:name</c:ref>
                <outbound>
                    <strength>strong</strength>
                    <source>
                        <c:path>$focus/name</c:path>
                    </source>
                </outbound>
            </attribute>
            <attribute>
                <c:ref>ri:description</c:ref>
                <outbound>
                    <strength>strong</strength>
                    <source>
                        <c:path>$focus/description</c:path>
                    </source>
                </outbound>
            </attribute>
            <attribute>
                <c:ref>ri:privacy</c:ref>
                <outbound>
                    <strength>strong</strength>
                    <source>
                        <c:path>$focus/costCenter</c:path>
                    </source>
                </outbound>
            </attribute>
            <association>
                <c:ref>ri:team</c:ref>
                <tolerant>false</tolerant>
                <displayName>Team Membership</displayName>
                <kind>entitlement</kind>
                <intent>team</intent>
                <direction>subjectToObject</direction>
                <associationAttribute>ri:parentTeamId</associationAttribute>
                <valueAttribute>ri:teamId</valueAttribute>
            </association>
        </objectType>
    </schemaHandling>

    <synchronization>
        <objectSynchronization>
            <name>user sync</name>
            <objectClass>ri:user</objectClass>
            <kind>account</kind>
            <intent>default</intent>
            <focusType>c:UserType</focusType>
            <enabled>true</enabled>
            <correlation>
                <q:equal>
                    <q:path>c:emailAddress</q:path>
                    <expression>
                        <path>$projection/attributes/ri:scimUserName</path>
                    </expression>
                </q:equal>
            </correlation>
            <reconcile>false</reconcile>
            <reaction>
                <situation>linked</situation>
                <synchronize>true</synchronize>
            </reaction>
            <reaction>
                <situation>deleted</situation>
                <action>
                    <handlerUri>http://midpoint.evolveum.com/xml/ns/public/model/action-3#unlink</handlerUri>
                    <!-- <handlerUri>http://midpoint.evolveum.com/xml/ns/public/model/action-3#deleteFocus</handlerUri> -->
                </action>
            </reaction>
            <reaction>
                <situation>unlinked</situation>
                <action>
                    <handlerUri>http://midpoint.evolveum.com/xml/ns/public/model/action-3#link</handlerUri>
                </action>
            </reaction>
        </objectSynchronization>
        <objectSynchronization>
            <name>team sync</name>
            <objectClass>ri:team</objectClass>
            <kind>entitlement</kind>
            <intent>team</intent>
            <focusType>c:RoleType</focusType>
            <enabled>true</enabled>
            <correlation>
                <q:equal>
                    <q:path>c:name</q:path>
                    <expression>
                        <path>$projection/attributes/ri:name</path>
                    </expression>
                </q:equal>
            </correlation>
            <reconcile>false</reconcile>
            <reaction>
                <situation>linked</situation>
                <synchronize>true</synchronize>
            </reaction>
            <reaction>
                <situation>deleted</situation>
                <action>
                    <handlerUri>http://midpoint.evolveum.com/xml/ns/public/model/action-3#unlink</handlerUri>
                    <!-- <handlerUri>http://midpoint.evolveum.com/xml/ns/public/model/action-3#deleteFocus</handlerUri> -->
                </action>
            </reaction>
            <reaction>
                <situation>unlinked</situation>
                <action>
                    <handlerUri>http://midpoint.evolveum.com/xml/ns/public/model/action-3#link</handlerUri>
                </action>
            </reaction>
        </objectSynchronization>
    </synchronization>
</resource>

Clone this wiki locally