-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
927 additions
and
74 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
55 changes: 55 additions & 0 deletions
55
sugoi-api-core/src/main/java/fr/insee/sugoi/core/event/model/SugoiEvent.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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package fr.insee.sugoi.core.event.model; | ||
|
||
import java.util.Map; | ||
import org.springframework.context.ApplicationEvent; | ||
|
||
public class SugoiEvent extends ApplicationEvent { | ||
|
||
private static final long serialVersionUID = 1L; | ||
|
||
private SugoiEventTypeEnum eventType; | ||
|
||
private String realm; | ||
|
||
private String userStorage; | ||
|
||
private Map<String, Object> properties; | ||
|
||
public SugoiEvent( | ||
String realm, String storage, SugoiEventTypeEnum eventType, Map<String, Object> properties) { | ||
super(eventType); | ||
this.realm = realm; | ||
this.userStorage = storage; | ||
this.eventType = eventType; | ||
this.properties = properties; | ||
} | ||
|
||
public SugoiEventTypeEnum getEventType() { | ||
return eventType; | ||
} | ||
|
||
public String getRealm() { | ||
return realm; | ||
} | ||
|
||
public String getUserStorage() { | ||
return userStorage; | ||
} | ||
|
||
public Map<String, Object> getProperties() { | ||
return properties; | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
sugoi-api-core/src/main/java/fr/insee/sugoi/core/event/model/SugoiEventTypeEnum.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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package fr.insee.sugoi.core.event.model; | ||
|
||
public enum SugoiEventTypeEnum { | ||
CHANGE_PASSWORD, | ||
REINIT_PASSWORD, | ||
SEND_LOGIN, | ||
} |
35 changes: 35 additions & 0 deletions
35
sugoi-api-core/src/main/java/fr/insee/sugoi/core/event/publisher/SugoiEventPublisher.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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package fr.insee.sugoi.core.event.publisher; | ||
|
||
import fr.insee.sugoi.core.event.model.SugoiEvent; | ||
import fr.insee.sugoi.core.event.model.SugoiEventTypeEnum; | ||
import java.util.Map; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.context.ApplicationEventPublisher; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class SugoiEventPublisher { | ||
@Autowired private ApplicationEventPublisher applicationEventPublisher; | ||
|
||
public void publishCustomEvent( | ||
final String realm, | ||
final String storage, | ||
final SugoiEventTypeEnum eventType, | ||
final Map<String, Object> properties) { | ||
SugoiEvent sugoiEvent = new SugoiEvent(realm, storage, eventType, properties); | ||
applicationEventPublisher.publishEvent(sugoiEvent); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>fr.insee.sugoi</groupId> | ||
<artifactId>sugoi-api-parent</artifactId> | ||
<version>2.1.0-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
<artifactId>sugoi-api-event-webhook</artifactId> | ||
<name>sugoi-api-event-webhook</name> | ||
<description>event listener which produce webhook</description> | ||
|
||
<dependencies> | ||
|
||
<dependency> | ||
<groupId>fr.insee.sugoi</groupId> | ||
<artifactId>sugoi-api-core</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.apache.commons</groupId> | ||
<artifactId>commons-text</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.freemarker</groupId> | ||
<artifactId>freemarker</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>commons-io</groupId> | ||
<artifactId>commons-io</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-test</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
Oops, something went wrong.