Skip to content

Commit

Permalink
fix(FSADT1-1694): change obfuscation to BCSC value (#1387)
Browse files Browse the repository at this point in the history
* fix(FSADT1-1694): change obfuscation to BCSC value

* chore: Made code reviews

---------

Co-authored-by: Maria Martinez <maria.martinez@gov.bc.ca>
  • Loading branch information
paulushcgcj and mamartinezmejia authored Jan 15, 2025
1 parent 11f54e5 commit 555559e
Showing 1 changed file with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import java.io.IOException;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Set;
Expand Down Expand Up @@ -88,20 +87,29 @@ public void serialize(
private String obfuscate(String propName, String propType, Object value) {
Set<String> roles = toRoles(MDC.get(ApplicationConstant.MDC_USERROLES));

// Admins and Editors can see with no restrictions
// Admins can see the BCSC
if (
roles.contains(ApplicationConstant.ROLE_EDITOR)
|| roles.contains(ApplicationConstant.ROLE_ADMIN)
|| roles.contains(ApplicationConstant.ROLE_SUSPEND)
CLIENT_IDENTIFICATION.equals(propName)
&& "BCSC".equals(propType)
&& roles.contains(ApplicationConstant.ROLE_ADMIN)
) {
return value.toString();
}

// BC Services card uses a UUID, so we just say it is verified
if (CLIENT_IDENTIFICATION.equals(propName) && "BCSC".equals(propType)) {
return "BC Service card verified";
}

// Admins and Editors can see with no restrictions
if (
roles.contains(ApplicationConstant.ROLE_EDITOR)
|| roles.contains(ApplicationConstant.ROLE_ADMIN)
|| roles.contains(ApplicationConstant.ROLE_SUSPEND)
) {
return value.toString();
}

if (CLIENT_IDENTIFICATION.equals(propName) && "BCRE".equals(propType)) {
return value.toString();
}
Expand Down

0 comments on commit 555559e

Please sign in to comment.