Skip to content

Commit

Permalink
Modify getMaskedValue method to always mask the given value.
Browse files Browse the repository at this point in the history
  • Loading branch information
dhaura committed Jun 12, 2024
1 parent 6e7ae15 commit a723747
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
package org.wso2.carbon.identity.conditional.auth.functions.utils;

/**
* Function to mask the given value if log masking is enabled.
* Function to mask the given value.
*/
@FunctionalInterface
public interface GetMaskedValueFunction {

/**
* Masks the given value if log masking is enabled.
* Masks the given value.
*
* @param value The value to be masked.
* @return The masked value.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ public class GetMaskedValueFunctionImpl implements GetMaskedValueFunction {
@HostAccess.Export
public String getMaskedValue(String value) {

return LoggerUtils.isLogMaskingEnable ? LoggerUtils.getMaskedContent(value) : value;
return LoggerUtils.getMaskedContent(value);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,13 @@ public void testGetMaskedValue(boolean isLogMaskingEnabled, String username, Str
@DataProvider(name = "maskableValueProvider")
public Object[][] maskableValueProvider() {

/*
The "getMaskedValue" method should always mask the passed in value
irrespective of the server-wide 'isLogMaskingEnable' configuration.
*/
return new Object[][]{
{true, "johndoe", "j*****e"},
{false, "johndoe", "johndoe"},
{false, "johndoe", "j*****e"},
};
}
}

0 comments on commit a723747

Please sign in to comment.