Skip to content

Commit

Permalink
refactor externalUser model to match kafka model
Browse files Browse the repository at this point in the history
  • Loading branch information
Erling Jahr committed Nov 20, 2023
1 parent 6644d50 commit 6a74268
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
14 changes: 10 additions & 4 deletions src/main/java/no/fintlabs/externalUser/ExternalUser.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,29 @@ public class ExternalUser {
private String lastName;
private String userType;
private String userName;
private UUID identityProviderUserObjectId;
private UUID idpUserObjectId;
private String mainOrganisationUnitName;
private String mainOrganisationUnitId;
private String mobilePhone;
private String email;
private String userPrincipalName;


public boolean isValid(){
return this.getUserType().equals("EXTERNAL");
}

public User toUser(){

return User
.builder()
.id(id)
.firstName(firstName)
.lastName(lastName)
.userType(userType)
.resourceId(String.valueOf(identityProviderUserObjectId))
.userType("EXTERNAL")
.resourceId(String.valueOf(idpUserObjectId))
.userName(userName)
.identityProviderUserObjectId(identityProviderUserObjectId)
.identityProviderUserObjectId(idpUserObjectId)
.mainOrganisationUnitName(mainOrganisationUnitName)
.mainOrganisationUnitId(mainOrganisationUnitId)
.email(email)
Expand All @@ -51,6 +54,9 @@ public User toUser(){
}





public SimpelExternalUser toSimpleExternalUser() {
return SimpelExternalUser
.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public ConcurrentMessageListenerContainer<String, ExternalUser> externalUserCons
){
EntityTopicNameParameters entityTopicNameParameters = EntityTopicNameParameters
.builder()
.resource("externaluser")
.resource("azureuserexternal")
.build();

return entityConsumerFactoryService.createFactory(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public void shouldReturnUser() {
ExternalUser externalUser = ExternalUser
.builder()
.userName("titten@tei.no")
.identityProviderUserObjectId(UUID.fromString("f37f3048-637a-11ee-8c99-0242ac120002"))
.idpUserObjectId(UUID.fromString("f37f3048-637a-11ee-8c99-0242ac120002"))
.userType("EXTERNAL")
.build();

Expand Down

0 comments on commit 6a74268

Please sign in to comment.