Révision bf9c3717
Ajouté par Remy Menard il y a environ 11 ans
OMeGa/OMeGa/src/main/java/fr/unicaen/iota/application/soap/BaseOMeGa.java | ||
---|---|---|
import java.util.HashMap;
|
||
import java.util.List;
|
||
import java.util.Map;
|
||
import java.util.Map.Entry;
|
||
import javax.annotation.Resource;
|
||
import javax.xml.ws.WebServiceContext;
|
||
import org.apache.commons.logging.Log;
|
||
... | ... | |
@Resource
|
||
private WebServiceContext wsContext;
|
||
private final EPCISPEP xiclient;
|
||
private final Identity anonymous;
|
||
|
||
public BaseOMeGa() {
|
||
anonymous = new Identity();
|
||
anonymous.setAsString(Configuration.DEFAULT_IDENTITY);
|
||
xiclient = new EPCISPEP(Configuration.XI_URL, Configuration.PKS_FILENAME, Configuration.PKS_PASSWORD, Configuration.TRUST_PKS_FILENAME, Configuration.TRUST_PKS_PASSWORD);
|
||
}
|
||
|
||
... | ... | |
|
||
private void checkAuth(Identity id) throws IoTaException {
|
||
Principal authId = wsContext.getUserPrincipal();
|
||
String tlsId = authId == null ? null : authId.getName();
|
||
int chk = xiclient.canBe(tlsId, id.getAsString());
|
||
if (authId == null && id == anonymous) {
|
||
return;
|
||
}
|
||
if (authId == null) {
|
||
throw new IoTaException("No authentication", IoTaFault.tau.getCode());
|
||
}
|
||
if (id == null || id.getAsString().isEmpty()) {
|
||
throw new IoTaException("No identity to use", IoTaFault.tau.getCode());
|
||
}
|
||
String tlsId = fr.unicaen.iota.mu.Utils.formatId(authId.getName());
|
||
String idToPass = fr.unicaen.iota.mu.Utils.formatId(id.getAsString());
|
||
int chk = xiclient.canBe(tlsId, idToPass);
|
||
if (!Utils.responseIsPermit(chk)) {
|
||
throw new IoTaException(tlsId + " isn't allowed to pass as " + id.getAsString(), IoTaFault.tau.getCode());
|
||
}
|
||
... | ... | |
return response;
|
||
}
|
||
|
||
@Override
|
||
public TraceEPCByEPCISResponse traceEPCByEPCIS(TraceEPCByEPCISRequest traceEPCByEPCISRequest) throws IoTaException {
|
||
checkAuth(traceEPCByEPCISRequest.getIdentity());
|
||
AccessInterface controler = getAI();
|
||
Map<String, List<EPCISEventType>> map;
|
||
try {
|
||
if (traceEPCByEPCISRequest.getFilters() == null) {
|
||
map = controler.traceEPCByEPCIS(traceEPCByEPCISRequest.getIdentity(), traceEPCByEPCISRequest.getEpc().getValue());
|
||
} else {
|
||
map = controler.traceEPCByEPCIS(traceEPCByEPCISRequest.getIdentity(), traceEPCByEPCISRequest.getEpc().getValue(), filters(traceEPCByEPCISRequest.getFilters().getParam()));
|
||
}
|
||
} catch (RemoteException ex) {
|
||
log.warn("A problem occurred while executing traceEPCByEPCIS!", ex);
|
||
throw new IoTaException("Error while traceEPCByEPCIS", IoTaFault.alfa.getCode(), ex);
|
||
}
|
||
TraceEPCByEPCISResponse response = new TraceEPCByEPCISResponse();
|
||
for (Entry<String, List<EPCISEventType>> entry : map.entrySet()) {
|
||
EventsByEPCIS eventsByEPCIS = new EventsByEPCIS();
|
||
eventsByEPCIS.setEpcisAddress(entry.getKey());
|
||
EventListType evtList = new EventListType();
|
||
evtList.getObjectEventOrAggregationEventOrQuantityEvent().addAll(entry.getValue());
|
||
eventsByEPCIS.setEventList(evtList);
|
||
response.getEventsByEPCIS().add(eventsByEPCIS);
|
||
}
|
||
return response;
|
||
}
|
||
|
||
@Override
|
||
public GetReferentDSResponse getReferentDS(GetReferentDSRequest getReferentDSRequest) throws IoTaException {
|
||
AccessInterface controler = getAI();
|
Formats disponibles : Unified diff
Version 1.99
- a few bugs fixed!
- new testing application to capture events
- new options to the command line to configure the public/private keys
for TLS and for signature
- new method more accurate than "traceEPC": the events are sorted by
EPCIS
- New options added to the command line
- user can be identified by alias, if the DN of his certificate is
incompatible with the LDAP directory
- new shell script to configure the LDAP directory (same
functionnalities as IoTa-Installer)
- installs and configures LaMBDa
- finer certificate mangagement
- EpcILoN correctly subscribe with TLS to ETa
- new figure for LaMBDa
- shows data flows between PHI and YPSilon
- sets DS and DSeTa in different schemas