use of com.mercedesbenz.sechub.sharedkernel.messaging.UserMessage in project sechub by mercedes-benz.
the class UserCreationService method informUserAboutSignupAccepted.
@IsSendingAsyncMessage(MessageID.USER_NEW_API_TOKEN_REQUESTED)
private void informUserAboutSignupAccepted(User user) {
/* we just send info about new api token */
DomainMessage infoRequest = new DomainMessage(MessageID.USER_NEW_API_TOKEN_REQUESTED);
UserMessage userMessage = new UserMessage();
userMessage.setEmailAdress(user.getEmailAdress());
/*
* Security: we do NOT use userid inside this link - if some body got
* information about the link he/she is not able to use fetched api token
* because not knowing which userid...
*/
String linkWithOneTimeToken = environment.getServerBaseUrl() + AdministrationAPIConstants.API_FETCH_NEW_API_TOKEN_BY_ONE_WAY_TOKEN + "/" + user.getOneTimeToken();
userMessage.setLinkWithOneTimeToken(linkWithOneTimeToken);
userMessage.setSubject("SecHub user account created");
infoRequest.set(MessageDataKeys.USER_ONE_TIME_TOKEN_INFO, userMessage);
eventBusService.sendAsynchron(infoRequest);
}
use of com.mercedesbenz.sechub.sharedkernel.messaging.UserMessage in project sechub by mercedes-benz.
the class UserCreationService method createInitialUserAuthData.
private UserMessage createInitialUserAuthData(User user) {
UserMessage authDataHashed = new UserMessage();
authDataHashed.setUserId(user.getName());
authDataHashed.setEmailAdress(user.getEmailAdress());
return authDataHashed;
}
use of com.mercedesbenz.sechub.sharedkernel.messaging.UserMessage in project sechub by mercedes-benz.
the class UserCreationService method informUserCreated.
@IsSendingAsyncMessage(MessageID.USER_CREATED)
private void informUserCreated(User user) {
DomainMessage infoRequest = new DomainMessage(MessageID.USER_CREATED);
UserMessage message = createInitialUserAuthData(user);
infoRequest.set(MessageDataKeys.USER_CREATION_DATA, message);
eventBusService.sendAsynchron(infoRequest);
}
use of com.mercedesbenz.sechub.sharedkernel.messaging.UserMessage in project sechub by mercedes-benz.
the class UserDeleteService method deleteUser.
/* @formatter:off */
@Validated
@UseCaseAdminDeletesUser(@Step(number = 2, name = "Service deletes user.", next = { 3, 4 }, description = "The service will delete the user with dependencies and triggers asynchronous events"))
/* @formatter:on */
@Transactional
public void deleteUser(String userId) {
auditLogService.log("Triggers delete of user {}", logSanitizer.sanitize(userId, 30));
assertion.assertIsValidUserId(userId);
if (userId.contentEquals(userContext.getUserId())) {
throw new NotAcceptableException("You are not allowed to delete yourself!");
}
User user = userRepository.findOrFailUser(userId);
/* create message containing data before user is deleted */
UserMessage message = new UserMessage();
message.setUserId(user.getName());
message.setEmailAdress(user.getEmailAdress());
userRepository.deleteUserWithAssociations(user.getName());
informUserDeleted(message);
}
use of com.mercedesbenz.sechub.sharedkernel.messaging.UserMessage in project sechub by mercedes-benz.
the class AnonymousSignupCreateService method informAboutSignupRequest.
@IsSendingAsyncMessage(MessageID.USER_SIGNUP_REQUESTED)
private void informAboutSignupRequest(Signup signup) {
DomainMessage infoRequest = new DomainMessage(MessageID.USER_SIGNUP_REQUESTED);
UserMessage userMessage = new UserMessage();
userMessage.setEmailAdress(signup.getEmailAdress());
userMessage.setUserId(signup.getUserId());
infoRequest.set(MessageDataKeys.USER_SIGNUP_DATA, userMessage);
eventBusService.sendAsynchron(infoRequest);
}
Aggregations