When creating a new credential assign the user's email

This commit is contained in:
George Kalampokis 2020-10-27 18:08:16 +02:00
parent ff169ae806
commit 4c60b2bb06
3 changed files with 18 additions and 0 deletions

View File

@ -30,6 +30,8 @@ public class CredentialBuilder extends Builder<Credential> {
private String externalId;
private String email;
public CredentialBuilder id(UUID id) {
this.id = id;
return this;
@ -75,6 +77,11 @@ public class CredentialBuilder extends Builder<Credential> {
return this;
}
public CredentialBuilder email(String email) {
this.email = email;
return this;
}
public Credential build() {
Credential credential = new Credential();
credential.setStatus(status);
@ -86,6 +93,7 @@ public class CredentialBuilder extends Builder<Credential> {
credential.setUserInfo(userInfo);
credential.setId(id);
credential.setExternalId(externalId);
credential.setEmail(email);
return credential;
}
}

View File

@ -135,6 +135,7 @@ public abstract class AbstractAuthenticationService implements AuthenticationSer
.provider(profile.getProvider().getValue())
.secret(profile.getSecret())
.externalId(profile.getId())
.email(profile.getEmail())
.build();
if (userInfo == null) {
@ -188,6 +189,7 @@ public abstract class AbstractAuthenticationService implements AuthenticationSer
credential.setUserInfo(userInfo);
credential.setId(UUID.randomUUID());
credential.setPublicValue(userInfo.getName());
credential.setEmail(userInfo.getEmail());
apiContext.getOperationsContext().getDatabaseRepository().getCredentialDao().createOrUpdate(credential);
userInfo.getCredentials().add(credential);
}

View File

@ -5,6 +5,7 @@ import java.util.UUID;
public class UserMergeRequestModel {
private UUID userId;
private String email;
private Integer provider;
public UUID getUserId() {
return userId;
}
@ -18,4 +19,11 @@ public class UserMergeRequestModel {
this.email = email;
}
public Integer getProvider() {
return provider;
}
public void setProvider(Integer provider) {
this.provider = provider;
}
}