for(Key prop : authData.getProperties()){
auth.getProperties().put(prop.getName(), prop.getValue());
}
AuthDetail authDetail = new AuthDetail();
auth.setAuthDetail (authDetail);
authDetail.setType (toDataModel(authData.getType()));
switch(authData.getType()) {
case AUTHKEY:
authDetail.setAuthKeyValue(authData.getAuthKeyAuth().getKeyValue());
break;
case BASIC:
authDetail.setUsername(authData.getBasicAuth().getUsername());
authDetail.setPassword(authData.getBasicAuth().getPassword());
break;
case IP_WHITE_LIST:
authDetail.getWhiteListedIps().addAll(authData.getIpWhiteListAuth().getIp());
break;
case NO_AUTH:
break;
case OAUTH:
authDetail.setClientId(authData.getOAuth().getClientId());
authDetail.setClientSecret(authData.getOAuth().getClientSecret());
break;
case WSSE:
authDetail.setUsername(authData.getWsseAuth().getUsername());
auth.setWssePassword(authData.getWsseAuth().getPassword());
break;
default:
throw new IllegalArgumentException("Unknown authType specified");
}