Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added audit event publishing for IdP creation
- Loading branch information
Showing
10 changed files
with
203 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
common/src/main/java/org/cloudfoundry/identity/uaa/zone/IdentityProviderModifiedEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,42 @@ | |||
/******************************************************************************* | |||
* Cloud Foundry | |||
* Copyright (c) [2009-2015] Pivotal Software, Inc. All Rights Reserved. | |||
* | |||
* This product is licensed to you under the Apache License, Version 2.0 (the "License"). | |||
* You may not use this product except in compliance with the License. | |||
* | |||
* This product includes a number of subcomponents with | |||
* separate copyright notices and license terms. Your use of these | |||
* subcomponents is subject to the terms and conditions of the | |||
* subcomponent's license, as noted in the LICENSE file. | |||
*******************************************************************************/ | |||
package org.cloudfoundry.identity.uaa.zone; | |||
|
|||
|
|||
import org.cloudfoundry.identity.uaa.audit.AuditEvent; | |||
import org.cloudfoundry.identity.uaa.audit.AuditEventType; | |||
import org.cloudfoundry.identity.uaa.audit.event.AbstractUaaEvent; | |||
import org.cloudfoundry.identity.uaa.util.JsonUtils; | |||
import org.springframework.security.core.Authentication; | |||
|
|||
public class IdentityProviderModifiedEvent extends AbstractUaaEvent { | |||
|
|||
private static final long serialVersionUID = -4559543713244231262L; | |||
|
|||
private AuditEventType eventType; | |||
|
|||
public IdentityProviderModifiedEvent(IdentityProvider identityProvider, Authentication authentication, AuditEventType type) { | |||
super(identityProvider, authentication); | |||
eventType = type; | |||
} | |||
|
|||
@Override | |||
public AuditEvent getAuditEvent() { | |||
return createAuditRecord(getSource().toString(), eventType, getOrigin(getAuthentication()), JsonUtils.writeValueAsString(source)); | |||
} | |||
|
|||
public static IdentityProviderModifiedEvent identityProviderCreated(IdentityProvider identityProvider) { | |||
return new IdentityProviderModifiedEvent(identityProvider, getContextAuthentication(), AuditEventType.IdentityProviderCreatedEvent); | |||
} | |||
|
|||
} |
2 changes: 1 addition & 1 deletion
2
common/src/main/java/org/cloudfoundry/identity/uaa/zone/IdentityProviderProvisioning.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...rc/main/java/org/cloudfoundry/identity/uaa/zone/event/IdentityProviderEventPublisher.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,37 @@ | |||
/******************************************************************************* | |||
* Cloud Foundry | |||
* Copyright (c) [2009-2015] Pivotal Software, Inc. All Rights Reserved. | |||
* | |||
* This product is licensed to you under the Apache License, Version 2.0 (the "License"). | |||
* You may not use this product except in compliance with the License. | |||
* | |||
* This product includes a number of subcomponents with | |||
* separate copyright notices and license terms. Your use of these | |||
* subcomponents is subject to the terms and conditions of the | |||
* subcomponent's license, as noted in the LICENSE file. | |||
*******************************************************************************/ | |||
package org.cloudfoundry.identity.uaa.zone.event; | |||
|
|||
import org.cloudfoundry.identity.uaa.zone.IdentityProvider; | |||
import org.cloudfoundry.identity.uaa.zone.IdentityProviderModifiedEvent; | |||
import org.springframework.context.ApplicationEvent; | |||
import org.springframework.context.ApplicationEventPublisher; | |||
import org.springframework.context.ApplicationEventPublisherAware; | |||
|
|||
public class IdentityProviderEventPublisher implements ApplicationEventPublisherAware { | |||
private ApplicationEventPublisher publisher; | |||
@Override | |||
public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) { | |||
this.publisher = applicationEventPublisher; | |||
} | |||
|
|||
public void idpCreated(IdentityProvider identityProvider) { | |||
publish(IdentityProviderModifiedEvent.identityProviderCreated(identityProvider)); | |||
} | |||
|
|||
public void publish(ApplicationEvent event) { | |||
if (publisher!=null) { | |||
publisher.publishEvent(event); | |||
} | |||
} | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.