Add Email Field on Principal

This commit is contained in:
George Kalampokis 2020-07-17 13:15:44 +03:00
parent 182c215069
commit 4127a05da4
5 changed files with 23 additions and 2 deletions

View File

@ -17,6 +17,7 @@ public class PrincipalBuilder extends Builder<Principal> {
private UUID id; private UUID id;
private UUID token; private UUID token;
private String name; private String name;
private String email;
private Date expiresAt; private Date expiresAt;
private String avatarUrl; private String avatarUrl;
private Set<Authorities> authorities; private Set<Authorities> authorities;
@ -43,6 +44,11 @@ public class PrincipalBuilder extends Builder<Principal> {
return this; return this;
} }
public PrincipalBuilder email(String email) {
this.email = email;
return this;
}
public PrincipalBuilder expiresAt(Date expiresAt) { public PrincipalBuilder expiresAt(Date expiresAt) {
this.expiresAt = expiresAt; this.expiresAt = expiresAt;
return this; return this;
@ -98,6 +104,7 @@ public class PrincipalBuilder extends Builder<Principal> {
Principal principal = new Principal(); Principal principal = new Principal();
principal.setAuthorities(authorities); principal.setAuthorities(authorities);
principal.setName(name); principal.setName(name);
principal.setEmail(email);
principal.setExpiresAt(expiresAt); principal.setExpiresAt(expiresAt);
principal.setToken(token); principal.setToken(token);
principal.setId(id); principal.setId(id);

View File

@ -78,7 +78,9 @@ public class NonVerifiedUserEmailAuthenticationService extends AbstractAuthentic
} }
Principal principal = this.apiContext.getOperationsContext().getBuilderFactory().getBuilder(PrincipalBuilder.class) Principal principal = this.apiContext.getOperationsContext().getBuilderFactory().getBuilder(PrincipalBuilder.class)
.id(user.getId()).token(token.getToken()) .id(user.getId()).token(token.getToken())
.expiresAt(token.getExpiresAt()).name(user.getName()) .expiresAt(token.getExpiresAt())
.name(user.getName())
.email(user.getEmail())
.avatarUrl(avatarUrl) .avatarUrl(avatarUrl)
.culture(culture) .culture(culture)
.language(language) .language(language)

View File

@ -87,7 +87,9 @@ public class VerifiedUserAuthenticationService extends AbstractAuthenticationSer
} }
Principal principal = this.apiContext.getOperationsContext().getBuilderFactory().getBuilder(PrincipalBuilder.class) Principal principal = this.apiContext.getOperationsContext().getBuilderFactory().getBuilder(PrincipalBuilder.class)
.id(user.getId()).token(token.getToken()) .id(user.getId()).token(token.getToken())
.expiresAt(token.getExpiresAt()).name(user.getName()) .expiresAt(token.getExpiresAt())
.name(user.getName())
.email(user.getEmail())
.avatarUrl(avatarUrl) .avatarUrl(avatarUrl)
.culture(culture) .culture(culture)
.language(language) .language(language)

View File

@ -12,6 +12,7 @@ public class Principal {
private UUID id; private UUID id;
private UUID token; private UUID token;
private String name; private String name;
private String email;
private Date expiresAt; private Date expiresAt;
private String avatarUrl; private String avatarUrl;
private Set<Authorities> authorities; private Set<Authorities> authorities;
@ -47,6 +48,14 @@ public class Principal {
this.name = name; this.name = name;
} }
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public Date getExpiresAt() { public Date getExpiresAt() {
return expiresAt; return expiresAt;
} }

View File

@ -4,6 +4,7 @@ export interface Principal {
id: string; id: string;
token: string; token: string;
name: string; name: string;
email: string;
expiresAt: Date; expiresAt: Date;
authorities: AppRole[]; authorities: AppRole[];
avatarUrl: string; avatarUrl: string;