Skip to content

Commit

Permalink
AYS-509 | Javadocs of AysMaskUtil Has Been Fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
agitrubard committed Jan 5, 2025
1 parent 90b8fd6 commit 7bb7736
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/main/java/org/ays/common/util/AysMaskUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* It is designed to handle common sensitive fields such as tokens, passwords, email addresses, and more.
* </p>
*
* <p><strong>Example Usage:</strong></p>
* <p><strong>Unmasked JSON:</strong></p>
* <pre>
* {
Expand All @@ -33,9 +34,9 @@
* "emailAddress": "tes******com",
* "password": "******",
* "lineNumber": "******7890",
* "address": "123 Main ******field",
* "firstName": "Joh******ohn",
* "lastName": "Doe******oe"
* "address": "123 M******ield",
* "firstName": "J******",
* "lastName": "D******"
* }
* </pre>
*/
Expand All @@ -47,8 +48,9 @@ public class AysMaskUtil {
/**
* Masks sensitive fields in the given {@link JsonNode}.
* <p>
* This method recursively iterates through the fields in the JSON object or array,
* and applies masking to fields identified as sensitive.
* This method recursively processes the fields in the JSON object or array,
* applying masking to sensitive fields based on their names. The masking logic
* is determined by the field name and uses predefined rules for known sensitive fields.
* </p>
*
* @param jsonNode the JSON node to process for masking
Expand Down Expand Up @@ -88,8 +90,8 @@ public static void mask(final JsonNode jsonNode) {
/**
* Masks the value of a specific field based on its name.
* <p>
* This method identifies sensitive fields by their names and applies the appropriate
* masking strategy. Fields not recognized as sensitive are returned without modification.
* Sensitive fields such as "Authorization", "accessToken", and "password" are masked using specific
* rules. Fields not recognized as sensitive remain unchanged.
* </p>
*
* @param field the name of the field
Expand All @@ -114,7 +116,7 @@ public static String mask(final String field, final String value) {
}

/**
* Masks token fields such as "Authorization", "accessToken", or "refreshToken".
* Masks token fields such as "Authorization", "authorization", "accessToken", or "refreshToken".
*
* @param value the token value to mask
* @return the masked token
Expand Down Expand Up @@ -157,7 +159,7 @@ private static String maskEmailAddress(String value) {
}

/**
* Masks address fields by revealing the first ten and last ten characters,
* Masks address fields by revealing the first five and last five characters,
* replacing the middle part with asterisks.
*
* @param value the address to mask
Expand Down Expand Up @@ -188,8 +190,8 @@ private static String maskLineNumber(String value) {
}

/**
* Masks name fields such as "firstName", "lastName", or similar by revealing the first three
* and last three characters, replacing the middle part with asterisks.
* Masks name fields by revealing the first character,
* replacing the remaining part with asterisks.
*
* @param value the name to mask
* @return the masked name
Expand Down

0 comments on commit 7bb7736

Please sign in to comment.