mirror of
https://github.com/apache/activemq-artemis.git
synced 2025-02-20 17:05:51 +00:00
ARTEMIS-4273 mask command not using codec props
This commit is contained in:
parent
c9c819aa88
commit
5320bd03b3
@ -65,8 +65,8 @@ public class Mask extends ActionAbstract {
|
||||
codec = PasswordMaskingUtil.getCodec(brokerConfiguration.getPasswordCodec());
|
||||
} else {
|
||||
codec = PasswordMaskingUtil.getDefaultCodec();
|
||||
codec.init(params);
|
||||
}
|
||||
codec.init(params);
|
||||
|
||||
String masked = codec.encode(password);
|
||||
context.out.println("result: " + masked);
|
||||
|
@ -1259,7 +1259,9 @@ public class ArtemisTest extends CliTestBase {
|
||||
mask.setPasswordCodec(true);
|
||||
result = (String) mask.execute(context);
|
||||
assertEquals(TestPasswordCodec.class, mask.getCodec().getClass());
|
||||
assertEquals(result, result);
|
||||
assertEquals(((TestPasswordCodec) mask.getCodec()).getPropertyOne(), "1234");
|
||||
assertEquals(((TestPasswordCodec) mask.getCodec()).getPropertyTwo(), "9876");
|
||||
assertEquals(password, result);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -2285,6 +2287,19 @@ public class ArtemisTest extends CliTestBase {
|
||||
}
|
||||
|
||||
public static class TestPasswordCodec implements SensitiveDataCodec<String> {
|
||||
public String PROP_NAME_ONE = "propertyNameOne";
|
||||
public String PROP_NAME_TWO = "propertyNameTwo";
|
||||
|
||||
private String propertyOne;
|
||||
private String propertyTwo;
|
||||
|
||||
@Override
|
||||
public void init(Map<String, String> params) throws Exception {
|
||||
if (params != null) {
|
||||
propertyOne = params.get(PROP_NAME_ONE);
|
||||
propertyTwo = params.get(PROP_NAME_TWO);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String decode(Object mask) throws Exception {
|
||||
@ -2295,6 +2310,14 @@ public class ArtemisTest extends CliTestBase {
|
||||
public String encode(Object secret) throws Exception {
|
||||
return secret.toString();
|
||||
}
|
||||
|
||||
public String getPropertyOne() {
|
||||
return propertyOne;
|
||||
}
|
||||
|
||||
public String getPropertyTwo() {
|
||||
return propertyTwo;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ under the License.
|
||||
|
||||
<large-messages-directory>./target/large-messages</large-messages-directory>
|
||||
|
||||
<password-codec>org.apache.activemq.cli.test.ArtemisTest$TestPasswordCodec</password-codec>
|
||||
<password-codec>org.apache.activemq.cli.test.ArtemisTest$TestPasswordCodec;propertyNameOne=1234;propertyNameTwo=9876</password-codec>
|
||||
|
||||
<connectors>
|
||||
<!-- Default Connector. Returned to clients during broadcast and distributed around cluster. See broadcast and discovery-groups -->
|
||||
|
Loading…
x
Reference in New Issue
Block a user