use of com.evolveum.midpoint.xml.ns._public.common.common_3.PasswordType in project midpoint by Evolveum.
the class TestOpenDjReadablePassword method assertShadowPassword.
@Override
protected void assertShadowPassword(ShadowType provisioningShadow) throws Exception {
CredentialsType credentials = provisioningShadow.getCredentials();
if (credentials == null) {
return;
}
PasswordType passwordType = credentials.getPassword();
if (passwordType == null) {
return;
}
ProtectedStringType passwordValue = passwordType.getValue();
assertNotNull("Missing password value in " + provisioningShadow, passwordValue);
assertFalse("Empty password value in " + provisioningShadow, passwordValue.isEmpty());
String clearPassword = protector.decryptString(passwordValue);
display("Clear password of " + provisioningShadow + ": " + clearPassword);
PrismContainerValue<PasswordType> passwordContainer = passwordType.asPrismContainerValue();
PrismProperty<ProtectedStringType> valueProp = passwordContainer.findProperty(PasswordType.F_VALUE);
assertFalse("Incomplete password value in " + provisioningShadow, valueProp.isIncomplete());
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.PasswordType in project midpoint by Evolveum.
the class TestOpenDjIncompletePassword method assertShadowPassword.
@Override
protected void assertShadowPassword(ShadowType provisioningShadow) {
CredentialsType credentials = provisioningShadow.getCredentials();
if (credentials == null) {
return;
}
PasswordType passwordType = credentials.getPassword();
if (passwordType == null) {
return;
}
ProtectedStringType passwordValue = passwordType.getValue();
assertNull("Unexpected password value in " + provisioningShadow + ": " + passwordValue, passwordValue);
PrismContainerValue<PasswordType> passwordContainer = passwordType.asPrismContainerValue();
PrismProperty<ProtectedStringType> valueProp = passwordContainer.findProperty(PasswordType.F_VALUE);
assertTrue("Incomplete flag is NOT set for password value in " + provisioningShadow, valueProp.isIncomplete());
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.PasswordType in project midpoint by Evolveum.
the class ModelClientUtil method createPasswordType.
public static PasswordType createPasswordType(String password) {
PasswordType passwordType = new PasswordType();
passwordType.setValue(createProtectedString(password));
return passwordType;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.PasswordType in project midpoint by Evolveum.
the class AbstractWebserviceTest method createModelPort.
/**
* Creates webservice client connecting to midpoint
* */
protected static ModelPortType createModelPort(String username, String password, String passwordType) {
String endpoint = ENDPOINT;
if (System.getProperty("midpoint.endpoint") != null) {
endpoint = System.getProperty("midpoint.endpoint");
}
LOGGER.info("Creating model client endpoint: {} , username={}, password={}", new Object[] { endpoint, username, password });
ModelService modelService = new ModelService();
ModelPortType modelPort = modelService.getModelPort();
BindingProvider bp = (BindingProvider) modelPort;
Map<String, Object> requestContext = bp.getRequestContext();
requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpoint);
org.apache.cxf.endpoint.Client client = ClientProxy.getClient(modelPort);
org.apache.cxf.endpoint.Endpoint cxfEndpoint = client.getEndpoint();
Map<String, Object> outProps = new HashMap<String, Object>();
if (username != null) {
outProps.put(WSHandlerConstants.ACTION, WSHandlerConstants.USERNAME_TOKEN);
outProps.put(WSHandlerConstants.USER, username);
outProps.put(WSHandlerConstants.PASSWORD_TYPE, passwordType);
ClientPasswordHandler.setPassword(password);
outProps.put(WSHandlerConstants.PW_CALLBACK_CLASS, ClientPasswordHandler.class.getName());
WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(outProps);
cxfEndpoint.getOutInterceptors().add(wssOut);
}
cxfEndpoint.getInInterceptors().add(new LoggingInInterceptor());
cxfEndpoint.getOutInterceptors().add(new LoggingOutInterceptor());
return modelPort;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.PasswordType in project midpoint by Evolveum.
the class TestWSSecurity method test162ChangeDarthAdderPasswordViolatesPolicy.
@Test
public void test162ChangeDarthAdderPasswordViolatesPolicy() throws Exception {
final String TEST_NAME = "test162ChangeDarthAdderPasswordViolatesPolicy";
displayTestTitle(TEST_NAME);
LogfileTestTailer tailer = createLogTailer();
ProtectedStringType protectedString = ModelClientUtil.createProtectedString("x");
ObjectDeltaListType deltaList = ModelClientUtil.createModificationDeltaList(UserType.class, USER_DARTHADDER_OID, "credentials/password/value", ModificationTypeType.REPLACE, protectedString);
try {
// WHEN
modelPort.executeChanges(deltaList, null);
AssertJUnit.fail("Unexpected success");
} catch (FaultMessage e) {
assertFaultMessage(e, PolicyViolationFaultType.class, "password does not satisfy password policies");
}
// THEN
tailer.tail();
displayAudit(tailer);
assertAuditLoginLogout(tailer);
assertAuditIds(tailer);
assertAuditOperation(tailer, "MODIFY_OBJECT", OperationResultStatusType.FATAL_ERROR, "password does not satisfy password policies");
tailer.assertAudit(4);
UserType user = getObject(UserType.class, USER_DARTHADDER_OID);
display(user);
PasswordType dartAdderPassword = user.getCredentials().getPassword();
assertEquals("Password of DarthAdder has changed", ModelClientUtil.marshallToSting(new QName("http://whatever/", "fake"), dartAdderLastPassword, false), ModelClientUtil.marshallToSting(new QName("http://whatever/", "fake"), dartAdderPassword, false));
assertPasswordModifyMetadata(user, USER_DARTHADDER_OID, dartAdderLastPasswordChangeStartTs, dartAdderLastPasswordChangeEndTs);
}
Aggregations