<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" oid="16191328-ca84-4feb-9156-0df552ea4628">
    <name>keycloak</name>
    <lifecycleState>active</lifecycleState>
    <connectorRef type="c:ConnectorType">
        <filter>
            <q:text>connectorType = 'jp.openstandia.connector.keycloak.KeycloakConnector' and connectorVersion = '1.1.8' and available = true</q:text>
        </filter>
    </connectorRef>
    <connectorConfiguration xmlns:icfc="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/connector-schema-3">
        <icfc:configurationProperties xmlns:cfg="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/bundle/jp.openstandia.connector.connector-keycloak/jp.openstandia.connector.keycloak.KeycloakConnector">
            <cfg:serverUrl xmlns="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/bundle/jp.openstandia.connector.connector-keycloak/jp.openstandia.connector.keycloak.KeycloakConnector">
                http://host.docker.internal:8082
            </cfg:serverUrl>
            <cfg:clientId>midPoint-connectionClient</cfg:clientId>
            <cfg:clientSecret>
                <t:encryptedData>
                    <t:encryptionMethod>
                        <t:algorithm xmlns="http://prism.evolveum.com/xml/ns/public/types-3">http://www.w3.org/2001/04/xmlenc#aes256-cbc</t:algorithm>
                    </t:encryptionMethod>
                    <t:keyInfo>
                        <t:keyName>ZktavQjlj2s7F2i8WAdIfdx8hBU=</t:keyName>
                    </t:keyInfo>
                    <t:cipherData>
                        <t:cipherValue>QWEiXSYkB7F8flrcYAxHEiXzNSO2S7CvUsQiavhpCp/A9qbvWYqeiYGbtNn9AjSlt/S7FG3YYhkbvcAFgGT0Sg==</t:cipherValue>
                    </t:cipherData>
                </t:encryptedData>
            </cfg:clientSecret>
            <cfg:realmName>midpoint</cfg:realmName>
            <cfg:targetRealmName>midpoint</cfg:targetRealmName>
        </icfc:configurationProperties>
    </connectorConfiguration>
    <schema>
        <generationConstraints>
            <generateObjectClass>ri:group</generateObjectClass>
            <generateObjectClass>ri:user</generateObjectClass>
            <generateObjectClass>ri:client</generateObjectClass>
            <generateObjectClass>ri:clientRole</generateObjectClass>
        </generationConstraints>
    </schema>
    <schemaHandling>
        <objectType id="5">
            <kind>account</kind>
            <intent>account</intent>
            <displayName>account</displayName>
            <delineation>
                <objectClass>ri:user</objectClass>
            </delineation>
            <focus>
                <type>c:UserType</type>
                <archetypeRef oid="00000000-0000-0000-0000-000000000702" relation="org:default" type="c:ArchetypeType"/>
            </focus>
            <attribute id="7">
                <ref>ri:username</ref>
                <outbound>
                    <name>username-out</name>
                    <strength>strong</strength>
                    <source>
                        <path>name</path>
                    </source>
                </outbound>
                <inbound id="8">
                    <name>username</name>
                    <strength>strong</strength>
                    <target>
                        <path>name</path>
                    </target>
                </inbound>
            </attribute>
            <attribute id="9">
                <ref>ri:firstName</ref>
                <outbound>
                    <name>firstName-out</name>
                    <strength>strong</strength>
                    <source>
                        <path>givenName</path>
                    </source>
                </outbound>
                <inbound id="10">
                    <name>firstname</name>
                    <strength>strong</strength>
                    <target>
                        <path>givenName</path>
                    </target>
                </inbound>
            </attribute>
            <attribute id="11">
                <ref>ri:lastName</ref>
                <outbound>
                    <name>lastName-out</name>
                    <strength>strong</strength>
                    <source>
                        <path>familyName</path>
                    </source>
                </outbound>
                <inbound id="12">
                    <name>lastname</name>
                    <strength>strong</strength>
                    <target>
                        <path>familyName</path>
                    </target>
                </inbound>
            </attribute>
            <attribute id="52">
                <ref>ri:groups</ref>
                <fetchStrategy>explicit</fetchStrategy>
            </attribute>
            <attribute id="259">
                <ref>ri:clientRoles</ref>
                <fetchStrategy>explicit</fetchStrategy>
            </attribute>
            <activation>
                <administrativeStatus>
                    <outbound id="85">
                        <expression>
                            <asIs/>
                        </expression>
                    </outbound>
                </administrativeStatus>
            </activation>
            <correlation>
                <correlators>
                    <items id="229">
                        <item id="230">
                            <ref>name</ref>
                        </item>
                    </items>
                </correlators>
            </correlation>
            <synchronization>
                <reaction id="14">
                    <name>linked-synchronize</name>
                    <situation>linked</situation>
                    <actions>
                        <synchronize id="15"/>
                    </actions>
                </reaction>
                <reaction id="16">
                    <name>unlinked-link</name>
                    <situation>unlinked</situation>
                    <actions>
                        <link id="17"/>
                    </actions>
                </reaction>
                <reaction id="18">
                    <name>unmatched-add</name>
                    <situation>unmatched</situation>
                    <actions>
                        <addFocus id="19"/>
                    </actions>
                </reaction>
            </synchronization>
        </objectType>
        <objectType id="23">
            <kind>entitlement</kind>
            <intent>group</intent>
            <displayName>group</displayName>
            <delineation>
                <objectClass>ri:group</objectClass>
            </delineation>
            <focus>
                <type>c:RoleType</type>
                <archetypeRef oid="257e9f0c-da2c-4599-87ee-133541739636" relation="org:default" type="c:ArchetypeType"/>
            </focus>
            <attribute id="25">
                <ref>ri:groupId</ref>
                <inbound id="26">
                    <name>groupId-to-name</name>
                    <strength>strong</strength>
                    <target>
                        <path>identifier</path>
                    </target>
                </inbound>
            </attribute>
            <attribute id="27">
                <ref>ri:name</ref>
                <inbound id="28">
                    <name>name-to-displayName</name>
                    <strength>strong</strength>
                    <target>
                        <path>displayName</path>
                    </target>
                </inbound>
            </attribute>
            <attribute id="29">
                <ref>ri:path</ref>
                <inbound id="30">
                    <name>path-to-identifier</name>
                    <strength>strong</strength>
                    <target>
                        <path>name</path>
                    </target>
                </inbound>
            </attribute>
            <attribute id="53">
                <ref>ri:parentGroup</ref>
                <fetchStrategy>explicit</fetchStrategy>
                <inbound id="54">
                    <name>parentGroup</name>
                    <strength>strong</strength>
                    <target>
                        <path>locale</path>
                    </target>
                </inbound>
            </attribute>
            <attribute id="260">
                <ref>ri:clientRoles</ref>
                <fetchStrategy>explicit</fetchStrategy>
            </attribute>
            <correlation>
                <correlators>
                    <items id="232">
                        <item id="233">
                            <ref>name</ref>
                        </item>
                    </items>
                </correlators>
            </correlation>
            <synchronization>
                <reaction id="32">
                    <name>linked-synchronize</name>
                    <situation>linked</situation>
                    <actions>
                        <synchronize id="33"/>
                    </actions>
                </reaction>
                <reaction id="34">
                    <name>unlinked-link</name>
                    <situation>unlinked</situation>
                    <actions>
                        <link id="35"/>
                    </actions>
                </reaction>
                <reaction id="36">
                    <name>unmatched-add</name>
                    <situation>unmatched</situation>
                    <actions>
                        <addFocus id="37"/>
                    </actions>
                </reaction>
            </synchronization>
        </objectType>
        <objectType id="111">
            <kind>entitlement</kind>
            <intent>clientRole</intent>
            <displayName>clientRole</displayName>
            <delineation>
                <objectClass>ri:clientRole</objectClass>
            </delineation>
            <focus>
                <type>c:RoleType</type>
                <archetypeRef oid="8b9ead03-bb29-4408-ad0f-c88db8a68878" relation="org:default" type="c:ArchetypeType"/>
            </focus>
            <attribute id="113">
                <ref>ri:name</ref>
                <inbound id="114">
                    <name>name-into name</name>
                    <description>The full name of the clientrole {clientId}/{roleName} is being used as name. because the role name is only unique within a client. Displayname is
                        set as only the roleName because the full name is not meaningfull for users
                    </description>
                    <strength>strong</strength>
                    <target>
                        <path>name</path>
                    </target>
                </inbound>
                <inbound id="115">
                    <name>clientRoleName-into-displayName</name>
                    <description>Setting display name to only be in the client role name not including the client identifier. As this name is only unique within a client this is
                        not a unique identifier.
                    </description>
                    <strength>strong</strength>
                    <expression>
                        <script>
                            <code>return input.split("/")[1]</code>
                        </script>
                    </expression>
                    <target>
                        <path>displayName</path>
                    </target>
                </inbound>
            </attribute>
            <attribute id="116">
                <ref>ri:clientRoleId</ref>
                <inbound id="117">
                    <name>roleId into identifier</name>
                    <strength>strong</strength>
                    <target>
                        <path>identifier</path>
                    </target>
                </inbound>
            </attribute>
            <attribute id="118">
                <ref>ri:description</ref>
                <inbound id="119">
                    <name>description</name>
                    <strength>strong</strength>
                    <target>
                        <path>description</path>
                    </target>
                </inbound>
            </attribute>
            <correlation>
                <correlators>
                    <items id="128">
                        <item id="129">
                            <ref>name</ref>
                        </item>
                    </items>
                </correlators>
            </correlation>
            <synchronization>
                <reaction id="121">
                    <name>unmatched-add</name>
                    <situation>unmatched</situation>
                    <actions>
                        <addFocus id="122"/>
                    </actions>
                </reaction>
                <reaction id="123">
                    <name>unlinked-link</name>
                    <situation>unlinked</situation>
                    <actions>
                        <link id="124"/>
                    </actions>
                </reaction>
                <reaction id="125">
                    <name>linked-sync</name>
                    <situation>linked</situation>
                    <actions>
                        <synchronize id="126"/>
                    </actions>
                </reaction>
            </synchronization>
        </objectType>
        <objectType id="274">
            <kind>generic</kind>
            <intent>client</intent>
            <displayName>client</displayName>
            <delineation>
                <objectClass>ri:client</objectClass>
            </delineation>
            <focus>
                <type>c:ServiceType</type>
                <archetypeRef oid="8275f772-2896-4eaf-8aa7-8a5c16877a80" relation="org:default" type="c:ArchetypeType"/>
            </focus>
            <attribute id="155">
                <ref>ri:name</ref>
                <inbound id="156">
                    <name>name-to-displayname</name>
                    <strength>strong</strength>
                    <target>
                        <path>displayName</path>
                    </target>
                </inbound>
            </attribute>
            <attribute id="157">
                <ref>ri:clientId</ref>
                <inbound id="158">
                    <name>clientId-to-name</name>
                    <strength>strong</strength>
                    <target>
                        <path>name</path>
                    </target>
                </inbound>
            </attribute>
            <synchronization>
                <reaction id="279">
                    <situation>unmatched</situation>
                    <actions>
                        <addFocus id="280"/>
                    </actions>
                </reaction>
                <reaction id="281">
                    <situation>unlinked</situation>
                    <actions>
                        <link id="282"/>
                    </actions>
                </reaction>
                <reaction id="283">
                    <situation>linked</situation>
                    <actions>
                        <synchronize id="284"/>
                    </actions>
                </reaction>
            </synchronization>
        </objectType>
        <associationType id="45">
            <name>groupMembershipsAssociation</name>
            <subject>
                <objectType id="46">
                    <kind>account</kind>
                    <intent>account</intent>
                </objectType>
                <association>
                    <ref>groupMemberships</ref>
                    <sourceAttributeRef>groupMemberships</sourceAttributeRef>
                    <outbound id="50">
                        <name>outboundGroupAssociation</name>
                        <expression>
                            <associationConstruction xsi:type="c:AssociationConstructionExpressionEvaluatorType"/>
                        </expression>
                    </outbound>
                    <inbound id="87">
                        <name>inbound association</name>
                        <expression>
                            <associationSynchronization xsi:type="c:AssociationSynchronizationExpressionEvaluatorType">
                                <objectRef id="89">
                                    <ref>groupMemberships</ref>
                                    <mapping id="90">
                                        <name>inbound-memberships</name>
                                        <strength>strong</strength>
                                        <expression>
                                            <shadowOwnerReferenceSearch/>
                                        </expression>
                                        <target>
                                            <path>targetRef</path>
                                        </target>
                                    </mapping>
                                </objectRef>
                                <correlation>
                                    <correlators>
                                        <items id="94">
                                            <name>correlate</name>
                                            <item id="95">
                                                <ref>targetRef</ref>
                                            </item>
                                        </items>
                                    </correlators>
                                </correlation>
                                <synchronization>
                                    <reaction id="97">
                                        <name>unmatched</name>
                                        <situation>unmatched</situation>
                                        <actions>
                                            <addFocusValue id="98"/>
                                        </actions>
                                    </reaction>
                                    <reaction id="99">
                                        <name>matched</name>
                                        <situation>matched</situation>
                                        <actions>
                                            <synchronize id="100"/>
                                        </actions>
                                    </reaction>
                                </synchronization>
                            </associationSynchronization>
                        </expression>
                    </inbound>
                    <tolerant>true</tolerant>
                </association>
            </subject>
            <object id="47">
                <objectType id="48">
                    <kind>entitlement</kind>
                    <intent>group</intent>
                </objectType>
            </object>
        </associationType>
        <associationType id="60">
            <name>parentGroupAssociation</name>
            <subject>
                <objectType id="61">
                    <kind>entitlement</kind>
                    <intent>group</intent>
                </objectType>
                <association>
                    <ref>parentRef</ref>
                    <sourceAttributeRef>parentRef</sourceAttributeRef>
                    <inbound id="71">
                        <name>groupsIn</name>
                        <expression>
                            <associationSynchronization xsi:type="c:AssociationSynchronizationExpressionEvaluatorType">
                                <objectRef id="73">
                                    <ref>parentRef</ref>
                                    <mapping id="74">
                                        <name>targetRef-inbound</name>
                                        <strength>strong</strength>
                                        <expression>
                                            <shadowOwnerReferenceSearch/>
                                        </expression>
                                        <target>
                                            <path>targetRef</path>
                                        </target>
                                    </mapping>
                                </objectRef>
                                <correlation>
                                    <correlators>
                                        <items id="107">
                                            <name>correlate</name>
                                            <item id="108">
                                                <ref>targetRef</ref>
                                            </item>
                                        </items>
                                    </correlators>
                                </correlation>
                                <synchronization>
                                    <reaction id="102">
                                        <name>matched</name>
                                        <situation>matched</situation>
                                        <actions>
                                            <synchronize id="103"/>
                                        </actions>
                                    </reaction>
                                    <reaction id="104">
                                        <name>unmatched</name>
                                        <situation>unmatched</situation>
                                        <actions>
                                            <addFocusValue id="105"/>
                                        </actions>
                                    </reaction>
                                </synchronization>
                            </associationSynchronization>
                        </expression>
                    </inbound>
                </association>
            </subject>
            <object id="62">
                <objectType id="63">
                    <kind>entitlement</kind>
                    <intent>group</intent>
                </objectType>
            </object>
        </associationType>
        <associationType id="206">
            <name>user-clientRole-Association</name>
            <subject>
                <objectType id="207">
                    <kind>account</kind>
                    <intent>account</intent>
                </objectType>
                <association>
                    <ref>clientRoleAssignments</ref>
                    <sourceAttributeRef>clientRoleAssignments</sourceAttributeRef>
                    <outbound id="224">
                        <name>outbound association</name>
                        <expression>
                            <associationConstruction xsi:type="c:AssociationConstructionExpressionEvaluatorType">
                                <objectRef id="226">
                                    <ref>clientRoleAssignments</ref>
                                    <mapping id="227">
                                        <name>associationFromLink</name>
                                        <strength>strong</strength>
                                        <expression>
                                            <associationFromLink/>
                                        </expression>
                                    </mapping>
                                </objectRef>
                            </associationConstruction>
                        </expression>
                    </outbound>
                    <inbound id="211">
                        <name>inbound association</name>
                        <expression>
                            <associationSynchronization xsi:type="c:AssociationSynchronizationExpressionEvaluatorType">
                                <objectRef id="213">
                                    <ref>clientRoleAssignments</ref>
                                    <mapping id="214">
                                        <name>targetRef-in</name>
                                        <strength>strong</strength>
                                        <expression>
                                            <shadowOwnerReferenceSearch/>
                                        </expression>
                                        <target>
                                            <path>targetRef</path>
                                        </target>
                                    </mapping>
                                </objectRef>
                                <correlation>
                                    <correlators>
                                        <items id="221">
                                            <item id="222">
                                                <ref>targetRef</ref>
                                            </item>
                                        </items>
                                    </correlators>
                                </correlation>
                                <synchronization>
                                    <reaction id="216">
                                        <situation>unmatched</situation>
                                        <actions>
                                            <addFocusValue id="217"/>
                                        </actions>
                                    </reaction>
                                    <reaction id="218">
                                        <situation>matched</situation>
                                        <actions>
                                            <synchronize id="219"/>
                                        </actions>
                                    </reaction>
                                </synchronization>
                            </associationSynchronization>
                        </expression>
                    </inbound>
                </association>
            </subject>
            <object id="208">
                <objectType id="209">
                    <kind>entitlement</kind>
                    <intent>clientRole</intent>
                </objectType>
            </object>
        </associationType>
        <associationType id="235">
            <name>group-clientRole-Association</name>
            <subject>
                <objectType id="236">
                    <kind>entitlement</kind>
                    <intent>group</intent>
                </objectType>
                <association>
                    <ref>clientRoleAssignment</ref>
                    <sourceAttributeRef>clientRoleAssignment</sourceAttributeRef>
                    <outbound id="253">
                        <name>outbound association</name>
                        <expression>
                            <associationConstruction xsi:type="c:AssociationConstructionExpressionEvaluatorType">
                                <objectRef id="255">
                                    <ref>clientRoleAssignment</ref>
                                    <mapping id="256">
                                        <name>associationFromLink</name>
                                        <strength>strong</strength>
                                        <expression>
                                            <associationFromLink/>
                                        </expression>
                                    </mapping>
                                </objectRef>
                            </associationConstruction>
                        </expression>
                    </outbound>
                    <inbound id="240">
                        <name>inbound association</name>
                        <expression>
                            <associationSynchronization xsi:type="c:AssociationSynchronizationExpressionEvaluatorType">
                                <objectRef id="242">
                                    <ref>clientRoleAssignment</ref>
                                    <mapping id="243">
                                        <name>targetRef-in</name>
                                        <strength>strong</strength>
                                        <expression>
                                            <shadowOwnerReferenceSearch/>
                                        </expression>
                                        <target>
                                            <path>targetRef</path>
                                        </target>
                                    </mapping>
                                </objectRef>
                                <correlation>
                                    <correlators>
                                        <items id="250">
                                            <item id="251">
                                                <ref>targetRef</ref>
                                            </item>
                                        </items>
                                    </correlators>
                                </correlation>
                                <synchronization>
                                    <reaction id="245">
                                        <situation>matched</situation>
                                        <actions>
                                            <synchronize id="246"/>
                                        </actions>
                                    </reaction>
                                    <reaction id="247">
                                        <situation>unmatched</situation>
                                        <actions>
                                            <addFocusValue id="248"/>
                                        </actions>
                                    </reaction>
                                </synchronization>
                            </associationSynchronization>
                        </expression>
                    </inbound>
                </association>
            </subject>
            <object id="237">
                <objectType id="238">
                    <kind>entitlement</kind>
                    <intent>clientRole</intent>
                </objectType>
            </object>
        </associationType>
    </schemaHandling>
    <capabilities>
        <configured xmlns:cap="http://midpoint.evolveum.com/xml/ns/public/resource/capabilities-3">
            <cap:activation>
                <cap:status>
                    <cap:enabled>true</cap:enabled>
                    <cap:returnedByDefault>true</cap:returnedByDefault>
                </cap:status>
            </cap:activation>
            <cap:references>
                <cap:type id="41">
                    <cap:name>groupMembership</cap:name>
                    <cap:subject>
                        <cap:delineation id="42">
                            <cap:objectClass>ri:user</cap:objectClass>
                        </cap:delineation>
                        <cap:primaryBindingAttributeRef>groups</cap:primaryBindingAttributeRef>
                        <cap:localItemName>groupMemberships</cap:localItemName>
                    </cap:subject>
                    <cap:object>
                        <cap:delineation id="43">
                            <cap:objectClass>ri:group</cap:objectClass>
                        </cap:delineation>
                        <cap:primaryBindingAttributeRef>groupId</cap:primaryBindingAttributeRef>
                    </cap:object>
                    <cap:direction>subjectToObject</cap:direction>
                </cap:type>
                <cap:type id="56">
                    <cap:name>parentGroupReference</cap:name>
                    <cap:subject>
                        <cap:delineation id="57">
                            <cap:objectClass>ri:group</cap:objectClass>
                        </cap:delineation>
                        <cap:primaryBindingAttributeRef>parentGroup</cap:primaryBindingAttributeRef>
                        <cap:localItemName>parentRef</cap:localItemName>
                    </cap:subject>
                    <cap:object>
                        <cap:delineation id="58">
                            <cap:objectClass>ri:group</cap:objectClass>
                        </cap:delineation>
                        <cap:primaryBindingAttributeRef>groupId</cap:primaryBindingAttributeRef>
                    </cap:object>
                    <cap:direction>objectToSubject</cap:direction>
                </cap:type>
                <cap:type id="131">
                    <cap:name>userClientRoleReference</cap:name>
                    <cap:subject>
                        <cap:delineation id="113">
                            <cap:objectClass>ri:user</cap:objectClass>
                        </cap:delineation>
                        <cap:primaryBindingAttributeRef>clientRoles</cap:primaryBindingAttributeRef>
                        <cap:localItemName>clientRoleAssignments</cap:localItemName>
                    </cap:subject>
                    <cap:object>
                        <cap:delineation id="114">
                            <cap:objectClass>ri:clientRole</cap:objectClass>
                        </cap:delineation>
                        <cap:primaryBindingAttributeRef>name</cap:primaryBindingAttributeRef>
                    </cap:object>
                    <cap:direction>subjectToObject</cap:direction>
                </cap:type>
                <cap:type id="200">
                    <cap:name>groupClientRoleReference</cap:name>
                    <cap:subject>
                        <cap:delineation id="135">
                            <cap:objectClass>ri:group</cap:objectClass>
                        </cap:delineation>
                        <cap:primaryBindingAttributeRef>clientRoles</cap:primaryBindingAttributeRef>
                        <cap:localItemName>clientRoleAssignment</cap:localItemName>
                    </cap:subject>
                    <cap:object>
                        <cap:delineation id="139">
                            <cap:objectClass>ri:clientRole</cap:objectClass>
                        </cap:delineation>
                        <cap:primaryBindingAttributeRef>name</cap:primaryBindingAttributeRef>
                    </cap:object>
                    <cap:direction>subjectToObject</cap:direction>
                </cap:type>
            </cap:references>
        </configured>
    </capabilities>
</resource>
