Search in sources :

Example 31 with ClientDetailsModification

use of org.cloudfoundry.identity.uaa.oauth.client.ClientDetailsModification in project uaa by cloudfoundry.

the class ClientAdminEventPublisher method modifyTx.

public void modifyTx(ClientDetailsModification[] clients) {
    for (ClientDetailsModification client : clients) {
        if (ClientDetailsModification.ADD.equals(client.getAction())) {
            publish(new ClientCreateEvent(client, getPrincipal(), identityZoneManager.getCurrentIdentityZoneId()));
        } else if (ClientDetailsModification.UPDATE.equals(client.getAction())) {
            publish(new ClientUpdateEvent(client, getPrincipal(), identityZoneManager.getCurrentIdentityZoneId()));
        } else if (ClientDetailsModification.DELETE.equals(client.getAction())) {
            publish(new ClientDeleteEvent(client, getPrincipal(), identityZoneManager.getCurrentIdentityZoneId()));
        } else if (ClientDetailsModification.UPDATE_SECRET.equals(client.getAction())) {
            publish(new ClientUpdateEvent(client, getPrincipal(), identityZoneManager.getCurrentIdentityZoneId()));
            if (client.isApprovalsDeleted()) {
                publish(new SecretChangeEvent(client, getPrincipal(), identityZoneManager.getCurrentIdentityZoneId()));
                publish(new ClientApprovalsDeletedEvent(client, getPrincipal(), identityZoneManager.getCurrentIdentityZoneId()));
            }
        } else if (ClientDetailsModification.SECRET.equals(client.getAction())) {
            if (client.isApprovalsDeleted()) {
                publish(new SecretChangeEvent(client, getPrincipal(), identityZoneManager.getCurrentIdentityZoneId()));
                publish(new ClientApprovalsDeletedEvent(client, getPrincipal(), identityZoneManager.getCurrentIdentityZoneId()));
            }
        }
    }
}
Also used : ClientDetailsModification(org.cloudfoundry.identity.uaa.oauth.client.ClientDetailsModification)

Aggregations

ClientDetailsModification (org.cloudfoundry.identity.uaa.oauth.client.ClientDetailsModification)31 BaseClientDetails (org.springframework.security.oauth2.provider.client.BaseClientDetails)20 Test (org.junit.jupiter.api.Test)16 ClientDetailsHelper.clientFromString (org.cloudfoundry.identity.uaa.mock.util.ClientDetailsHelper.clientFromString)15 ClientDetails (org.springframework.security.oauth2.provider.ClientDetails)15 ResultActions (org.springframework.test.web.servlet.ResultActions)15 ClientDetailsHelper.arrayFromString (org.cloudfoundry.identity.uaa.mock.util.ClientDetailsHelper.arrayFromString)14 ClientDetailsHelper.clientArrayFromString (org.cloudfoundry.identity.uaa.mock.util.ClientDetailsHelper.clientArrayFromString)14 MockHttpServletRequestBuilder (org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder)14 RandomValueStringGenerator (org.springframework.security.oauth2.common.util.RandomValueStringGenerator)8 Approval (org.cloudfoundry.identity.uaa.approval.Approval)4 HashMap (java.util.HashMap)3 AbstractUaaEvent (org.cloudfoundry.identity.uaa.audit.event.AbstractUaaEvent)2 Test (org.junit.Test)2 Transactional (org.springframework.transaction.annotation.Transactional)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)2 ResponseStatus (org.springframework.web.bind.annotation.ResponseStatus)2 HashSet (java.util.HashSet)1 ApprovalStore (org.cloudfoundry.identity.uaa.approval.ApprovalStore)1