use of com.mercedesbenz.sechub.sharedkernel.messaging.UserMessage in project sechub by mercedes-benz.
the class AnonymousUserGetAPITokenByOneTimeTokenService method sendUserAPITokenChanged.
@IsSendingAsyncMessage(MessageID.USER_API_TOKEN_CHANGED)
private void sendUserAPITokenChanged(User user) {
DomainMessage request = new DomainMessage(MessageID.USER_API_TOKEN_CHANGED);
UserMessage message = new UserMessage();
message.setEmailAdress(user.getEmailAdress());
message.setUserId(user.getName());
message.setHashedApiToken(user.getHashedApiToken());
request.set(MessageDataKeys.USER_API_TOKEN_DATA, message);
eventBusService.sendAsynchron(request);
}
use of com.mercedesbenz.sechub.sharedkernel.messaging.UserMessage in project sechub by mercedes-benz.
the class ScheduleMessageHandlerTest method when_sending_message_id_USER_DELETED_the_revokeUserService_is_called.
@Test
void when_sending_message_id_USER_DELETED_the_revokeUserService_is_called() {
/* prepare */
DomainMessage request = new DomainMessage(MessageID.USER_DELETED);
UserMessage content = new UserMessage();
content.setUserId("userId1");
request.set(MessageDataKeys.USER_DELETE_DATA, content);
/* execute */
simulateEventSend(request, scheduleHandlerToTest);
/* test */
verify(scheduleHandlerToTest.revokeUserService).revokeUserAccess("userId1");
}
use of com.mercedesbenz.sechub.sharedkernel.messaging.UserMessage in project sechub by mercedes-benz.
the class ScheduleMessageHandlerTest method when_sending_message_id_USER_REMOVED_FROM_PROJECT_the_revokeUserFromProjectService_is_called.
@Test
void when_sending_message_id_USER_REMOVED_FROM_PROJECT_the_revokeUserFromProjectService_is_called() {
/* prepare */
DomainMessage request = new DomainMessage(MessageID.USER_REMOVED_FROM_PROJECT);
UserMessage content = new UserMessage();
content.setProjectId("projectId1");
content.setUserId("userId1");
request.set(MessageDataKeys.PROJECT_TO_USER_DATA, content);
/* execute */
simulateEventSend(request, scheduleHandlerToTest);
/* test */
verify(scheduleHandlerToTest.revokeUserFromProjectService).revokeUserAccessFromProject("userId1", "projectId1");
}
use of com.mercedesbenz.sechub.sharedkernel.messaging.UserMessage in project sechub by mercedes-benz.
the class ScheduleMessageHandler method handleUserDeleted.
@IsReceivingAsyncMessage(MessageID.USER_DELETED)
private void handleUserDeleted(DomainMessage request) {
UserMessage data = request.get(MessageDataKeys.USER_DELETE_DATA);
revokeUserService.revokeUserAccess(data.getUserId());
}
use of com.mercedesbenz.sechub.sharedkernel.messaging.UserMessage in project sechub by mercedes-benz.
the class ScheduleMessageHandler method handleUserRemovedFromProject.
@IsReceivingAsyncMessage(MessageID.USER_REMOVED_FROM_PROJECT)
private void handleUserRemovedFromProject(DomainMessage request) {
UserMessage data = request.get(MessageDataKeys.PROJECT_TO_USER_DATA);
revokeUserFromProjectService.revokeUserAccessFromProject(data.getUserId(), data.getProjectId());
}
Aggregations