«
Previous
|
Next
»
Revision 675e977d
Added by Remy Menard about 11 years ago
- ID 675e977d6baa946d508d77b8721408cbe9155a8e
- Parent 8fd1d584
ALfA/ALfA-PI/pom.xml | ||
---|---|---|
|
||
<groupId>fr.unicaen.iota</groupId>
|
||
<artifactId>alfa-pi</artifactId>
|
||
<version>2.0</version>
|
||
<version>2.1</version>
|
||
<packaging>jar</packaging>
|
||
|
||
<name>ALfA-PI</name>
|
ALfA/ALfA-RMI/pom.xml | ||
---|---|---|
|
||
<groupId>fr.unicaen.iota</groupId>
|
||
<artifactId>alfa-rmi</artifactId>
|
||
<version>2.0</version>
|
||
<version>2.1</version>
|
||
<packaging>jar</packaging>
|
||
|
||
<name>ALfA-RMI</name>
|
ALfA/ALfA/pom.xml | ||
---|---|---|
|
||
<groupId>fr.unicaen.iota</groupId>
|
||
<artifactId>alfa</artifactId>
|
||
<version>2.0</version>
|
||
<version>2.1</version>
|
||
<packaging>jar</packaging>
|
||
|
||
<name>ALfA</name>
|
BETa/pom.xml | ||
---|---|---|
|
||
<groupId>fr.unicaen.iota</groupId>
|
||
<artifactId>beta</artifactId>
|
||
<version>2.0</version>
|
||
<version>2.1</version>
|
||
<packaging>jar</packaging>
|
||
|
||
<name>BETa</name>
|
CaPPa/DS-Xi-Client/pom.xml | ||
---|---|---|
|
||
<groupId>fr.unicaen.iota</groupId>
|
||
<artifactId>ds-xi-client</artifactId>
|
||
<version>2.0</version>
|
||
<version>2.1</version>
|
||
<packaging>jar</packaging>
|
||
|
||
<name>DS-Xi-Client</name>
|
CaPPa/EPCIS-Xi-Client/pom.xml | ||
---|---|---|
|
||
<groupId>fr.unicaen.iota</groupId>
|
||
<artifactId>epcis-xi-client</artifactId>
|
||
<version>2.0</version>
|
||
<version>2.1</version>
|
||
<packaging>jar</packaging>
|
||
|
||
<name>EPCIS-Xi-Client</name>
|
CaPPa/EPCIS-Xi-Client/src/main/java/fr/unicaen/iota/xi/client/UserPEP.java | ||
---|---|---|
/*
|
||
* This program is a part of the IoTa project.
|
||
*
|
||
* Copyright © 2008-2013 Université de Caen Basse-Normandie, GREYC
|
||
* Copyright © 2008-2012 Orange Labs
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation, either version 3 of the License, or
|
||
* (at your option) any later version.
|
||
*
|
||
* This program is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
* <http://www.gnu.org/licenses/>
|
||
*
|
||
* See AUTHORS for a list of contributors.
|
||
*/
|
||
package fr.unicaen.iota.xi.client;
|
||
|
||
import com.sun.xacml.ctx.Result;
|
||
import fr.unicaen.iota.xacml.policy.Module;
|
||
import fr.unicaen.iota.xacml.request.EventRequest;
|
||
import org.apache.commons.logging.Log;
|
||
import org.apache.commons.logging.LogFactory;
|
||
|
||
public class UserPEP extends PEP {
|
||
|
||
private static final Log log = LogFactory.getLog(UserPEP.class);
|
||
|
||
public UserPEP(String url, String pksFilename, String pksPassword, String trustPksFilename, String trustPksPassword) {
|
||
super(url, pksFilename, pksPassword, trustPksFilename, trustPksPassword);
|
||
}
|
||
|
||
public int userLookup(String userId, String partner) {
|
||
log.debug("process userLookup policy for user: " + userId);
|
||
EventRequest eventRequest = new EventRequest(userId, "userLookup", partner, Module.administrationModule.getValue());
|
||
return processXACMLRequest(eventRequest);
|
||
}
|
||
|
||
public int userCreate(String userId, String partner) {
|
||
log.debug("process userCreate policy for user: " + userId);
|
||
EventRequest eventRequest = new EventRequest(userId, "userCreate", partner, Module.administrationModule.getValue());
|
||
return processXACMLRequest(eventRequest);
|
||
}
|
||
|
||
public int userInfo(String userId, String partner) {
|
||
log.debug("process userInfo policy for user: " + userId);
|
||
EventRequest eventRequest = new EventRequest(userId, "userInfo", partner, Module.administrationModule.getValue());
|
||
return processXACMLRequest(eventRequest);
|
||
}
|
||
|
||
public int userUpdate(String userId, String partner) {
|
||
log.debug("process userUpdate policy for user: " + userId);
|
||
EventRequest eventRequest = new EventRequest(userId, "userUpdate", partner, Module.administrationModule.getValue());
|
||
return processXACMLRequest(eventRequest);
|
||
}
|
||
|
||
public int userDelete(String userId, String partner) {
|
||
log.debug("process userDelete policy for user: " + userId);
|
||
EventRequest eventRequest = new EventRequest(userId, "userDelete", partner, Module.administrationModule.getValue());
|
||
return processXACMLRequest(eventRequest);
|
||
}
|
||
|
||
public int partnerUpdate(String userId, String partner) {
|
||
log.debug("process partnerUpdate policy for user: " + userId);
|
||
EventRequest eventRequest = new EventRequest(userId, "partnerUpdate", partner, Module.administrationModule.getValue());
|
||
return processXACMLRequest(eventRequest);
|
||
}
|
||
|
||
public int partnerLookup(String userId, String partner) {
|
||
log.debug("process partnerLookup policy for user: " + userId);
|
||
EventRequest eventRequest = new EventRequest(userId, "partnerLookup", partner, Module.administrationModule.getValue());
|
||
return processXACMLRequest(eventRequest);
|
||
}
|
||
|
||
public int partnerDelete(String userId, String partner) {
|
||
log.debug("process partnerDelete policy for user: " + userId);
|
||
EventRequest eventRequest = new EventRequest(userId, "partnerDelete", partner, Module.administrationModule.getValue());
|
||
return processXACMLRequest(eventRequest);
|
||
}
|
||
|
||
public int partnerCreate(String userId, String partner) {
|
||
log.debug("process partnerCreate policy for user: " + userId);
|
||
EventRequest eventRequest = new EventRequest(userId, "partnerCreate", partner, Module.administrationModule.getValue());
|
||
return processXACMLRequest(eventRequest);
|
||
}
|
||
|
||
public boolean isRootAccess(String userId, String partnerId) {
|
||
log.trace("process checkRootAccess policy for user: " + userId);
|
||
EventRequest eventRequest = new EventRequest(userId, "superadmin", partnerId, Module.administrationModule.getValue());
|
||
return processXACMLRequest(eventRequest) == Result.DECISION_PERMIT;
|
||
}
|
||
|
||
}
|
DELTa/pom.xml | ||
---|---|---|
|
||
<groupId>fr.unicaen.iota</groupId>
|
||
<artifactId>delta</artifactId>
|
||
<version>2.0</version>
|
||
<version>2.1</version>
|
||
<packaging>jar</packaging>
|
||
|
||
<name>DELTa</name>
|
||
... | ... | |
|
||
</build>
|
||
|
||
<!--
|
||
<repositories>
|
||
<repository>
|
||
<id>fosstrak</id>
|
||
... | ... | |
<url>https://oss.sonatype.org/content/repositories/public</url>
|
||
</repository>
|
||
</repositories>
|
||
-->
|
||
|
||
</project>
|
DELTa/src/main/java/fr/unicaen/iota/validator/AnalyserResult.java | ||
---|---|---|
/*
|
||
* This program is a part of the IoTa project.
|
||
*
|
||
* Copyright © 2008-2012 Université de Caen Basse-Normandie, GREYC
|
||
* Copyright © 2008-2013 Université de Caen Basse-Normandie, GREYC
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
... | ... | |
*/
|
||
package fr.unicaen.iota.validator;
|
||
|
||
import fr.unicaen.iota.application.model.DSEvent;
|
||
import fr.unicaen.iota.ds.model.DSEvent;
|
||
import fr.unicaen.iota.validator.listener.AnalyserListener;
|
||
import fr.unicaen.iota.validator.model.BaseEvent;
|
||
import fr.unicaen.iota.validator.model.EPC;
|
DELTa/src/main/java/fr/unicaen/iota/validator/ResultRaw.java | ||
---|---|---|
/*
|
||
* This program is a part of the IoTa project.
|
||
*
|
||
* Copyright © 2008-2012 Université de Caen Basse-Normandie, GREYC
|
||
* Copyright © 2008-2013 Université de Caen Basse-Normandie, GREYC
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
... | ... | |
*/
|
||
package fr.unicaen.iota.validator;
|
||
|
||
import fr.unicaen.iota.application.model.DSEvent;
|
||
import fr.unicaen.iota.ds.model.DSEvent;
|
||
import fr.unicaen.iota.validator.model.BaseEvent;
|
||
import fr.unicaen.iota.validator.model.EPC;
|
||
import java.util.ArrayList;
|
DELTa/src/main/java/fr/unicaen/iota/validator/gui/DetailsDialog.form | ||
---|---|---|
<Component id="jLabel4" min="-2" max="-2" attributes="0"/>
|
||
<EmptySpace max="-2" attributes="0"/>
|
||
<Component id="jLabel5" min="-2" max="-2" attributes="0"/>
|
||
<EmptySpace pref="353" max="32767" attributes="0"/>
|
||
<EmptySpace pref="374" max="32767" attributes="0"/>
|
||
<Component id="jButton6" min="-2" max="-2" attributes="0"/>
|
||
</Group>
|
||
</Group>
|
||
... | ... | |
<Component id="jLabel8" min="-2" pref="13" max="-2" attributes="0"/>
|
||
<EmptySpace max="-2" attributes="0"/>
|
||
<Component id="jLabel9" min="-2" max="-2" attributes="0"/>
|
||
<EmptySpace max="32767" attributes="0"/>
|
||
<EmptySpace pref="33" max="32767" attributes="0"/>
|
||
<Component id="jButton5" min="-2" max="-2" attributes="0"/>
|
||
<EmptySpace max="-2" attributes="0"/>
|
||
<Component id="jButton1" min="-2" max="-2" attributes="0"/>
|
||
... | ... | |
<DimensionLayout dim="1">
|
||
<Group type="103" groupAlignment="0" attributes="0">
|
||
<Group type="102" alignment="1" attributes="0">
|
||
<EmptySpace pref="19" max="32767" attributes="0"/>
|
||
<EmptySpace pref="14" max="32767" attributes="0"/>
|
||
<Group type="103" groupAlignment="3" attributes="0">
|
||
<Component id="jButton1" alignment="3" min="-2" max="-2" attributes="0"/>
|
||
<Component id="jButton5" alignment="3" min="-2" max="-2" attributes="0"/>
|
||
... | ... | |
<Layout>
|
||
<DimensionLayout dim="0">
|
||
<Group type="103" groupAlignment="0" attributes="0">
|
||
<Component id="jTabbedPane1" alignment="1" max="32767" attributes="0"/>
|
||
<Component id="jTabbedPane1" alignment="1" pref="678" max="32767" attributes="0"/>
|
||
</Group>
|
||
</DimensionLayout>
|
||
<DimensionLayout dim="1">
|
||
<Group type="103" groupAlignment="0" attributes="0">
|
||
<Component id="jTabbedPane1" alignment="0" max="32767" attributes="0"/>
|
||
<Component id="jTabbedPane1" alignment="0" pref="314" max="32767" attributes="0"/>
|
||
</Group>
|
||
</DimensionLayout>
|
||
</Layout>
|
||
... | ... | |
<Group type="102" alignment="1" attributes="0">
|
||
<EmptySpace max="-2" attributes="0"/>
|
||
<Group type="103" groupAlignment="1" attributes="0">
|
||
<Component id="jScrollPane1" alignment="0" pref="649" max="32767" attributes="0"/>
|
||
<Component id="jScrollPane1" alignment="0" pref="646" max="32767" attributes="0"/>
|
||
<Group type="102" alignment="1" attributes="0">
|
||
<Component id="jButton9" min="-2" max="-2" attributes="0"/>
|
||
<EmptySpace max="-2" attributes="0"/>
|
||
... | ... | |
<Group type="103" groupAlignment="0" attributes="0">
|
||
<Group type="102" alignment="1" attributes="0">
|
||
<EmptySpace max="-2" attributes="0"/>
|
||
<Component id="jScrollPane1" pref="241" max="32767" attributes="0"/>
|
||
<Component id="jScrollPane1" pref="216" max="32767" attributes="0"/>
|
||
<EmptySpace max="-2" attributes="0"/>
|
||
<Group type="103" groupAlignment="3" attributes="0">
|
||
<Component id="jButton2" alignment="3" min="-2" max="-2" attributes="0"/>
|
||
... | ... | |
<Group type="102" alignment="0" attributes="0">
|
||
<EmptySpace max="-2" attributes="0"/>
|
||
<Group type="103" groupAlignment="0" attributes="0">
|
||
<Component id="jScrollPane2" alignment="0" pref="649" max="32767" attributes="0"/>
|
||
<Component id="jScrollPane2" alignment="0" pref="646" max="32767" attributes="0"/>
|
||
<Group type="102" alignment="1" attributes="0">
|
||
<Component id="jButton8" min="-2" max="-2" attributes="0"/>
|
||
<EmptySpace max="-2" attributes="0"/>
|
||
... | ... | |
<Group type="103" groupAlignment="0" attributes="0">
|
||
<Group type="102" alignment="1" attributes="0">
|
||
<EmptySpace max="-2" attributes="0"/>
|
||
<Component id="jScrollPane2" pref="241" max="32767" attributes="0"/>
|
||
<Component id="jScrollPane2" pref="216" max="32767" attributes="0"/>
|
||
<EmptySpace max="-2" attributes="0"/>
|
||
<Group type="103" groupAlignment="3" attributes="0">
|
||
<Component id="jButton3" alignment="3" min="-2" max="-2" attributes="0"/>
|
||
... | ... | |
<Group type="102" alignment="1" attributes="0">
|
||
<EmptySpace max="-2" attributes="0"/>
|
||
<Group type="103" groupAlignment="1" attributes="0">
|
||
<Component id="jScrollPane3" alignment="0" pref="649" max="32767" attributes="0"/>
|
||
<Component id="jScrollPane3" alignment="0" pref="646" max="32767" attributes="0"/>
|
||
<Group type="102" alignment="1" attributes="0">
|
||
<Component id="jButton7" min="-2" max="-2" attributes="0"/>
|
||
<EmptySpace max="-2" attributes="0"/>
|
||
... | ... | |
<Group type="103" groupAlignment="0" attributes="0">
|
||
<Group type="102" alignment="1" attributes="0">
|
||
<EmptySpace max="-2" attributes="0"/>
|
||
<Component id="jScrollPane3" pref="241" max="32767" attributes="0"/>
|
||
<Component id="jScrollPane3" pref="216" max="32767" attributes="0"/>
|
||
<EmptySpace max="-2" attributes="0"/>
|
||
<Group type="103" groupAlignment="3" attributes="0">
|
||
<Component id="jButton4" alignment="3" min="-2" max="-2" attributes="0"/>
|
DELTa/src/main/java/fr/unicaen/iota/validator/gui/DetailsDialog.java | ||
---|---|---|
/*
|
||
* This program is a part of the IoTa project.
|
||
*
|
||
* Copyright © 2008-2012 Université de Caen Basse-Normandie, GREYC
|
||
* Copyright © 2008-2013 Université de Caen Basse-Normandie, GREYC
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
... | ... | |
*/
|
||
package fr.unicaen.iota.validator.gui;
|
||
|
||
import fr.unicaen.iota.application.model.DSEvent;
|
||
import fr.unicaen.iota.application.rmi.AccessInterface;
|
||
import fr.unicaen.iota.application.AccessInterface;
|
||
import fr.unicaen.iota.ds.model.DSEvent;
|
||
import fr.unicaen.iota.validator.AnalyserResult;
|
||
import fr.unicaen.iota.validator.Configuration;
|
||
import fr.unicaen.iota.validator.IOTA;
|
||
... | ... | |
for (DSEvent dsEvent : container.getDsToEPCISReferentList(resultRaw.getContainerList())) {
|
||
i++;
|
||
DefaultTableModel model = (DefaultTableModel) (jTable2.getModel());
|
||
model.addRow(new String[]{i + "", dsEvent.getBizStep(), dsEvent.getReferenceAddress(), eventNotFound.contains(dsEvent) ? "MISSING" : "FOUND"});
|
||
model.addRow(new String[]{i + "", dsEvent.getBizStep(), dsEvent.getServiceAddress(), eventNotFound.contains(dsEvent) ? "MISSING" : "FOUND"});
|
||
}
|
||
}
|
||
if (showDStoDSResults) {
|
||
... | ... | |
for (DSEvent dsEvent : container.getDsToDsReferentList()) {
|
||
i++;
|
||
DefaultTableModel model = (DefaultTableModel) (jTable3.getModel());
|
||
model.addRow(new String[]{i + "", dsEvent.getBizStep(), dsEvent.getReferenceAddress(), eventNotFound.contains(dsEvent) ? "MISSING" : "FOUND"});
|
||
model.addRow(new String[]{i + "", dsEvent.getBizStep(), dsEvent.getServiceAddress(), eventNotFound.contains(dsEvent) ? "MISSING" : "FOUND"});
|
||
}
|
||
}
|
||
}
|
DELTa/src/main/java/fr/unicaen/iota/validator/gui/GUI.form | ||
---|---|---|
<Component id="jCheckBox2" min="-2" max="-2" attributes="0"/>
|
||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||
<Component id="jCheckBox3" min="-2" max="-2" attributes="0"/>
|
||
<EmptySpace pref="136" max="32767" attributes="0"/>
|
||
<EmptySpace pref="112" max="32767" attributes="0"/>
|
||
<Group type="103" groupAlignment="0" attributes="0">
|
||
<Group type="102" alignment="0" attributes="0">
|
||
<Component id="jLabel11" min="-2" pref="12" max="-2" attributes="0"/>
|
DELTa/src/main/java/fr/unicaen/iota/validator/gui/GUI.java | ||
---|---|---|
/*
|
||
* This program is a part of the IoTa project.
|
||
*
|
||
* Copyright © 2008-2012 Université de Caen Basse-Normandie, GREYC
|
||
* Copyright © 2008-2013 Université de Caen Basse-Normandie, GREYC
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
... | ... | |
*/
|
||
package fr.unicaen.iota.validator.gui;
|
||
|
||
import fr.unicaen.iota.application.model.DSEvent;
|
||
import fr.unicaen.iota.ds.model.DSEvent;
|
||
import fr.unicaen.iota.tau.model.Identity;
|
||
import fr.unicaen.iota.validator.*;
|
||
import fr.unicaen.iota.validator.listener.AnalyserListener;
|
DELTa/src/main/java/fr/unicaen/iota/validator/listener/AnalyserListener.java | ||
---|---|---|
/*
|
||
* This program is a part of the IoTa project.
|
||
*
|
||
* Copyright © 2008-2012 Université de Caen Basse-Normandie, GREYC
|
||
* Copyright © 2008-2013 Université de Caen Basse-Normandie, GREYC
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
... | ... | |
*/
|
||
package fr.unicaen.iota.validator.listener;
|
||
|
||
import fr.unicaen.iota.application.model.DSEvent;
|
||
import fr.unicaen.iota.ds.model.DSEvent;
|
||
import fr.unicaen.iota.validator.model.BaseEvent;
|
||
import fr.unicaen.iota.validator.model.EPC;
|
||
import java.util.EventListener;
|
DELTa/src/main/java/fr/unicaen/iota/validator/listener/AnalyserStatus.java | ||
---|---|---|
/*
|
||
* This program is a part of the IoTa project.
|
||
*
|
||
* Copyright © 2008-2012 Université de Caen Basse-Normandie, GREYC
|
||
* Copyright © 2008-2013 Université de Caen Basse-Normandie, GREYC
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
... | ... | |
*/
|
||
package fr.unicaen.iota.validator.listener;
|
||
|
||
import fr.unicaen.iota.application.model.DSEvent;
|
||
import fr.unicaen.iota.ds.model.DSEvent;
|
||
import fr.unicaen.iota.validator.model.BaseEvent;
|
||
import fr.unicaen.iota.validator.model.EPC;
|
||
import java.util.List;
|
DELTa/src/main/java/fr/unicaen/iota/validator/model/EPC.java | ||
---|---|---|
/*
|
||
* This program is a part of the IoTa project.
|
||
*
|
||
* Copyright © 2008-2012 Université de Caen Basse-Normandie, GREYC
|
||
* Copyright © 2008-2013 Université de Caen Basse-Normandie, GREYC
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
... | ... | |
package fr.unicaen.iota.validator.model;
|
||
|
||
import fr.unicaen.iota.ds.model.*;
|
||
import org.fosstrak.epcis.model.EPCISEventType;
|
||
import fr.unicaen.iota.validator.Configuration;
|
||
import fr.unicaen.iota.validator.IOTA;
|
||
import java.util.ArrayList;
|
||
import java.util.List;
|
||
import org.apache.commons.logging.Log;
|
||
import org.apache.commons.logging.LogFactory;
|
||
import org.fosstrak.epcis.model.EPCISEventType;
|
||
|
||
/**
|
||
*
|
||
... | ... | |
private static final Log log = LogFactory.getLog(EPC.class);
|
||
private String epc;
|
||
private List<BaseEvent> eventList;
|
||
private List<TEventItem> dsToDsReferentList;
|
||
private List<DSEvent> dsToDsReferentList;
|
||
private String parentId;
|
||
|
||
public EPC(String epc) {
|
||
... | ... | |
return res;
|
||
}
|
||
|
||
public List<TEventItem> getDSEvents(List<EPC> containerList) throws Exception {
|
||
public List<DSEvent> getDSEvents(List<EPC> containerList) throws Exception {
|
||
List<BaseEvent> eventListClone = new ArrayList<BaseEvent>();
|
||
eventListClone.addAll(this.eventList);
|
||
if (this.parentId != null) {
|
||
BaseEvent parentEvent = getParentEvent(parentId, containerList);
|
||
eventListClone.add(parentEvent);
|
||
}
|
||
List<TEventItem> events = new ArrayList<TEventItem>();
|
||
List<DSEvent> events = new ArrayList<DSEvent>();
|
||
for (BaseEvent be : eventListClone) {
|
||
TEventItem evt = new TEventItem();
|
||
TServiceItemList serviceList = new TServiceItemList();
|
||
TServiceItem service = new TServiceItem();
|
||
service.setUri(be.getInfrastructure().getServiceAddress());
|
||
serviceList.getService().add(service);
|
||
evt.setServiceList(serviceList);
|
||
evt.setC(epc);
|
||
evt.setLcs(be.getBizStep());
|
||
DSEvent evt = new DSEvent();
|
||
evt.setEpc(this.epc);
|
||
evt.setServiceAddress(be.getInfrastructure().getServiceAddress());
|
||
evt.setBizStep(be.getBizStep());
|
||
events.add(evt);
|
||
//new DSEvent(this.epc,
|
||
// be.getInfrastructure().getServiceAddress(),
|
||
// be.getBizStep(),
|
||
// null));
|
||
}
|
||
return events;
|
||
}
|
||
|
||
public Iterable<TEventItem> getDSToDSEvents(List<EPC> containerList) {
|
||
public Iterable<DSEvent> getDSToDSEvents(List<EPC> containerList) {
|
||
throw new UnsupportedOperationException("Not yet implemented");
|
||
}
|
||
|
||
... | ... | |
boolean found = false;
|
||
for (DSEvent dsEvent : list) {
|
||
if (dsEvent.getBizStep().equals(be.getBizStep())
|
||
&& dsEvent.getEPC().equals(this.epc)
|
||
&& dsEvent.getReferenceAddress().equals(formatAddress(be.getInfrastructure().getServiceAddress()))) {
|
||
&& dsEvent.getEpc().equals(this.epc)
|
||
&& dsEvent.getServiceAddress().equals(formatAddress(be.getInfrastructure().getServiceAddress()))) {
|
||
found = true;
|
||
break;
|
||
}
|
||
}
|
||
if (!found) {
|
||
events.add(new DSEvent(this.epc, be.getInfrastructure().getServiceAddress(), be.getBizStep(), null));
|
||
DSEvent evt = new DSEvent();
|
||
evt.setEpc(epc);
|
||
evt.setBizStep(be.getBizStep());
|
||
evt.setServiceAddress(be.getInfrastructure().getServiceAddress());
|
||
events.add(evt);
|
||
}
|
||
}
|
||
if (Configuration.DEBUG) {
|
||
... | ... | |
return res;
|
||
}
|
||
|
||
public List<BaseEvent> reverseVerifyEPCISEvents(List<EPCISEvent> list) {
|
||
public List<BaseEvent> reverseVerifyEPCISEvents(List<EPCISEventType> list) {
|
||
List<BaseEvent> res = new ArrayList<BaseEvent>();
|
||
for (BaseEvent be : this.eventList) {
|
||
if (!be.isContainedIn(list)) {
|
||
... | ... | |
log.debug("#");
|
||
for (DSEvent dsEvent : list) {
|
||
log.debug("# " + dsEvent.getBizStep());
|
||
log.debug("# " + dsEvent.getEPC());
|
||
log.debug("# " + dsEvent.getReferenceAddress());
|
||
log.debug("# " + dsEvent.getEpc());
|
||
log.debug("# " + dsEvent.getServiceAddress());
|
||
log.debug("#");
|
||
}
|
||
log.debug("# # # # # # # Event found in the XML file # # # # # # #");
|
||
... | ... | |
public List<DSEvent> getDsToEPCISReferentList(List<EPC> containerList) {
|
||
List<DSEvent> result = new ArrayList<DSEvent>();
|
||
for (BaseEvent event : eventList) {
|
||
result.add(new DSEvent(epc, event.getInfrastructure().getServiceAddress(), event.getBizStep(), null));
|
||
DSEvent evt = new DSEvent();
|
||
evt.setEpc(this.epc);
|
||
evt.setServiceAddress(event.getInfrastructure().getServiceAddress());
|
||
evt.setBizStep(event.getBizStep());
|
||
result.add(evt);
|
||
}
|
||
if (this.parentId != null) {
|
||
BaseEvent parentEvent = null;
|
||
... | ... | |
} catch (Exception ex) {
|
||
log.fatal(null, ex);
|
||
}
|
||
result.add(new DSEvent(epc, parentEvent.getInfrastructure().getServiceAddress(), parentEvent.getBizStep(), null));
|
||
DSEvent evt = new DSEvent();
|
||
evt.setEpc(this.epc);
|
||
evt.setServiceAddress(parentEvent.getInfrastructure().getServiceAddress());
|
||
evt.setBizStep(parentEvent.getBizStep());
|
||
result.add(evt);
|
||
}
|
||
return result;
|
||
}
|
DELTa/src/main/java/fr/unicaen/iota/validator/model/ObjectEvent.java | ||
---|---|---|
/*
|
||
* This program is a part of the IoTa project.
|
||
*
|
||
* Copyright © 2008-2012 Université de Caen Basse-Normandie, GREYC
|
||
* Copyright © 2008-2013 Université de Caen Basse-Normandie, GREYC
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
... | ... | |
package fr.unicaen.iota.validator.model;
|
||
|
||
import fr.unicaen.iota.mu.EPCISEventTypeHelper;
|
||
import org.fosstrak.epcis.model.EPCISEventType;
|
||
import java.util.ArrayList;
|
||
import java.util.Collection;
|
||
import java.util.List;
|
||
import org.fosstrak.epcis.model.ActionType;
|
||
import org.fosstrak.epcis.model.EPCISEventType;
|
||
import org.jdom.Element;
|
||
|
||
/**
|
||
... | ... | |
public boolean isContainedIn(Collection<EPCISEventType> list) {
|
||
for (EPCISEventType evt : list) {
|
||
EPCISEventTypeHelper event = new EPCISEventTypeHelper(evt);
|
||
for (String epc : event.getEpcs()) {
|
||
for (String epc : event.getEpcList()) {
|
||
if (!getEpcList().contains(epc)) {
|
||
return false;
|
||
}
|
DELTa/src/main/java/fr/unicaen/iota/validator/operations/Analyser.java | ||
---|---|---|
/*
|
||
* This program is a part of the IoTa project.
|
||
*
|
||
* Copyright © 2008-2012 Université de Caen Basse-Normandie, GREYC
|
||
* Copyright © 2008-2013 Université de Caen Basse-Normandie, GREYC
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
... | ... | |
*/
|
||
package fr.unicaen.iota.validator.operations;
|
||
|
||
import fr.unicaen.iota.application.model.DSEvent;
|
||
import fr.unicaen.iota.application.rmi.AccessInterface;
|
||
import fr.unicaen.iota.application.AccessInterface;
|
||
import fr.unicaen.iota.ds.model.DSEvent;
|
||
import fr.unicaen.iota.tau.model.Identity;
|
||
import fr.unicaen.iota.validator.Configuration;
|
||
import fr.unicaen.iota.validator.Controler;
|
||
... | ... | |
private final Identity identity;
|
||
private ThreadManager threadManager;
|
||
private final AnalyserStatus analyserStatus;
|
||
|
||
|
||
private static final Log log = LogFactory.getLog(Analyser.class);
|
||
|
||
public Analyser(String XMLPath, Identity identity, IOTA iota, AnalyserStatus analyserStatus) {
|
DELTa/src/main/java/fr/unicaen/iota/validator/operations/DSEntryComparator.java | ||
---|---|---|
/*
|
||
* This program is a part of the IoTa project.
|
||
*
|
||
* Copyright © 2008-2012 Université de Caen Basse-Normandie, GREYC
|
||
* Copyright © 2008-2013 Université de Caen Basse-Normandie, GREYC
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
... | ... | |
*/
|
||
package fr.unicaen.iota.validator.operations;
|
||
|
||
import fr.unicaen.iota.application.model.DSEvent;
|
||
import fr.unicaen.iota.application.rmi.AccessInterface;
|
||
import fr.unicaen.iota.application.AccessInterface;
|
||
import fr.unicaen.iota.ds.model.DSEvent;
|
||
import fr.unicaen.iota.nu.ONSEntryType;
|
||
import fr.unicaen.iota.tau.model.Identity;
|
||
import fr.unicaen.iota.validator.Configuration;
|
||
import fr.unicaen.iota.validator.IOTA;
|
||
... | ... | |
}
|
||
tmp.add(link.getDsAddress());
|
||
Date d1 = new Date();
|
||
eventList.addAll(applicationLevelInterface.queryDS(container.getEpc(),
|
||
link.getDsAddress(), identity, Configuration.DS_SERVICE_TYPE_FOR_EPCIS));
|
||
eventList.addAll(applicationLevelInterface.queryDS(identity, container.getEpc(),
|
||
link.getDsAddress(), ONSEntryType.epcis));
|
||
Date d2 = new Date();
|
||
link.addTimeResponse(d2.getTime() - d1.getTime());
|
||
}
|
||
... | ... | |
}
|
||
if (link.getDsAddress().equals(referentDS)) {
|
||
Date d1 = new Date();
|
||
List<DSEvent> list = applicationLevelInterface.queryDS(container.getEpc(), link.getDsAddress(), identity, Configuration.DS_SERVICE_TYPE_FOR_DS);
|
||
List<DSEvent> list = applicationLevelInterface.queryDS(identity, container.getEpc(),
|
||
link.getDsAddress(), ONSEntryType.ds);
|
||
Date d2 = new Date();
|
||
link.addTimeResponse(d2.getTime() - d1.getTime());
|
||
for (DSEvent dSEvent : list) {
|
||
if (Configuration.DEBUG) {
|
||
log.debug("found address: " + dSEvent.getReferenceAddress());
|
||
log.debug("found address: " + dSEvent.getServiceAddress());
|
||
}
|
||
if (dsEventList.contains(dSEvent)) {
|
||
continue;
|
||
... | ... | |
}
|
||
|
||
for (DSEvent dSEvent : dsEventList) {
|
||
if (!dsLinks.contains(dSEvent.getReferenceAddress())) {
|
||
if (!dsLinks.contains(dSEvent.getServiceAddress())) {
|
||
res.add(dSEvent);
|
||
}
|
||
}
|
DELTa/src/main/java/fr/unicaen/iota/validator/operations/EPCISEntryComparator.java | ||
---|---|---|
/*
|
||
* This program is a part of the IoTa project.
|
||
*
|
||
* Copyright © 2008-2012 Université de Caen Basse-Normandie, GREYC
|
||
* Copyright © 2008-2013 Université de Caen Basse-Normandie, GREYC
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
... | ... | |
*/
|
||
package fr.unicaen.iota.validator.operations;
|
||
|
||
import fr.unicaen.iota.application.rmi.AccessInterface;
|
||
import fr.unicaen.iota.application.AccessInterface;
|
||
import fr.unicaen.iota.tau.model.Identity;
|
||
import fr.unicaen.iota.validator.Configuration;
|
||
import fr.unicaen.iota.validator.IOTA;
|
DS/DS-Client/pom.xml | ||
---|---|---|
|
||
<groupId>fr.unicaen.iota</groupId>
|
||
<artifactId>ds-client</artifactId>
|
||
<version>2.0</version>
|
||
<version>2.1</version>
|
||
<packaging>jar</packaging>
|
||
|
||
<name>DS-Client</name>
|
DS/DS-Commons/pom.xml | ||
---|---|---|
|
||
<groupId>fr.unicaen.iota</groupId>
|
||
<artifactId>ds-commons</artifactId>
|
||
<version>2.0</version>
|
||
<version>2.1</version>
|
||
<packaging>jar</packaging>
|
||
|
||
<name>DS-Commons</name>
|
DS/DS/pom.xml | ||
---|---|---|
<groupId>fr.unicaen.iota</groupId>
|
||
<artifactId>ds</artifactId>
|
||
<packaging>war</packaging>
|
||
<version>2.0</version>
|
||
<version>2.1</version>
|
||
|
||
<name>DS</name>
|
||
|
DSeTa/DSeTa-Client/pom.xml | ||
---|---|---|
|
||
<groupId>fr.unicaen.iota</groupId>
|
||
<artifactId>dseta-client</artifactId>
|
||
<version>2.0</version>
|
||
<version>2.1</version>
|
||
<packaging>jar</packaging>
|
||
|
||
<name>DSeTa-Client</name>
|
DSeTa/DSeTa/pom.xml | ||
---|---|---|
|
||
<groupId>fr.unicaen.iota</groupId>
|
||
<artifactId>dseta</artifactId>
|
||
<version>2.0</version>
|
||
<version>2.1</version>
|
||
<packaging>war</packaging>
|
||
|
||
<name>DSeTa</name>
|
DSeTa/DiscoveryPHI/pom.xml | ||
---|---|---|
|
||
<groupId>fr.unicaen.iota</groupId>
|
||
<artifactId>discovery-phi</artifactId>
|
||
<version>2.0</version>
|
||
<version>2.1</version>
|
||
<packaging>war</packaging>
|
||
|
||
<name>DiscoveryPHI</name>
|
DSeTa/DiscoveryPHI/src/main/java/fr/unicaen/iota/auth/User.java | ||
---|---|---|
/*
|
||
* This program is a part of the IoTa project.
|
||
*
|
||
* Copyright © 2008-2013 Université de Caen Basse-Normandie, GREYC
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation, either version 3 of the License, or
|
||
* (at your option) any later version.
|
||
*
|
||
* This program is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
* <http://www.gnu.org/licenses/>
|
||
*
|
||
* See AUTHORS for a list of contributors.
|
||
*/
|
||
package fr.unicaen.iota.auth;
|
||
|
||
public class User {
|
||
|
||
private String userID;
|
||
private String ownerID;
|
||
|
||
public User() {
|
||
}
|
||
|
||
public User(String userID, String ownerID) {
|
||
this.userID = userID;
|
||
this.ownerID = ownerID;
|
||
}
|
||
|
||
public String getOwnerID() {
|
||
return ownerID;
|
||
}
|
||
|
||
public void setOwnerID(String ownerID) {
|
||
this.ownerID = ownerID;
|
||
}
|
||
|
||
public String getUserID() {
|
||
return userID;
|
||
}
|
||
|
||
public void setUserID(String userID) {
|
||
this.userID = userID;
|
||
}
|
||
|
||
}
|
DSeTa/DiscoveryPHI/src/main/java/fr/unicaen/iota/dphi/auth/User.java | ||
---|---|---|
/*
|
||
* This program is a part of the IoTa project.
|
||
*
|
||
* Copyright © 2008-2013 Université de Caen Basse-Normandie, GREYC
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation, either version 3 of the License, or
|
||
* (at your option) any later version.
|
||
*
|
||
* This program is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
* <http://www.gnu.org/licenses/>
|
||
*
|
||
* See AUTHORS for a list of contributors.
|
||
*/
|
||
package fr.unicaen.iota.dphi.auth;
|
||
|
||
public class User {
|
||
|
||
private String userID;
|
||
private String ownerID;
|
||
|
||
public User() {
|
||
}
|
||
|
||
public User(String userID, String ownerID) {
|
||
this.userID = userID;
|
||
this.ownerID = ownerID;
|
||
}
|
||
|
||
public String getOwnerID() {
|
||
return ownerID;
|
||
}
|
||
|
||
public void setOwnerID(String ownerID) {
|
||
this.ownerID = ownerID;
|
||
}
|
||
|
||
public String getUserID() {
|
||
return userID;
|
||
}
|
||
|
||
public void setUserID(String userID) {
|
||
this.userID = userID;
|
||
}
|
||
|
||
}
|
DSeTa/DiscoveryPHI/src/main/java/fr/unicaen/iota/dphi/utils/Constants.java | ||
---|---|---|
/*
|
||
* This program is a part of the IoTa project.
|
||
*
|
||
* Copyright © 2011-2013 Université de Caen Basse-Normandie, GREYC
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation, either version 3 of the License, or
|
||
* (at your option) any later version.
|
||
*
|
||
* This program is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
* <http://www.gnu.org/licenses/>
|
||
*
|
||
* See AUTHORS for a list of contributors.
|
||
*/
|
||
package fr.unicaen.iota.dphi.utils;
|
||
|
||
import java.io.IOException;
|
||
import java.io.InputStream;
|
||
import java.util.Properties;
|
||
import org.apache.commons.logging.Log;
|
||
import org.apache.commons.logging.LogFactory;
|
||
|
||
public final class Constants {
|
||
|
||
private Constants() {
|
||
}
|
||
private static Log log = LogFactory.getLog(Constants.class);
|
||
public static final String YPSILON_ADDRESS;
|
||
public static final String PKS_FILENAME;
|
||
public static final String PKS_PASSWORD;
|
||
public static final String TRUST_PKS_FILENAME;
|
||
public static final String TRUST_PKS_PASSWORD;
|
||
|
||
|
||
static {
|
||
Properties properties = new Properties();
|
||
InputStream is = Constants.class.getClassLoader().getResourceAsStream("application.properties");
|
||
log.info("Chargement des propriétés de l'application");
|
||
|
||
try {
|
||
properties.load(is);
|
||
} catch (IOException ex) {
|
||
log.fatal(null, ex);
|
||
}
|
||
YPSILON_ADDRESS = properties.getProperty("ypsilon-url");
|
||
PKS_FILENAME = properties.getProperty("pks-filename", "privatekeys.jks");
|
||
PKS_PASSWORD = properties.getProperty("pks-password", "changeit");
|
||
TRUST_PKS_FILENAME = properties.getProperty("trust-pks-filename", "publickeys.jks");
|
||
TRUST_PKS_PASSWORD = properties.getProperty("trust-pks-password", "changeit");
|
||
}
|
||
|
||
}
|
DSeTa/DiscoveryPHI/src/main/java/fr/unicaen/iota/dphi/utils/HTMLUtilities.java | ||
---|---|---|
/*
|
||
* This program is a part of the IoTa project.
|
||
*
|
||
* Copyright © 2008-2012 Université de Caen Basse-Normandie, GREYC
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation, either version 3 of the License, or
|
||
* (at your option) any later version.
|
||
*
|
||
* This program is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
* <http://www.gnu.org/licenses/>
|
||
*
|
||
* See AUTHORS for a list of contributors.
|
||
*/
|
||
package fr.unicaen.iota.dphi.utils;
|
||
|
||
import fr.unicaen.iota.dphi.xacml.ihm.Module;
|
||
import fr.unicaen.iota.xacml.pep.MethodNamesAdmin;
|
||
import fr.unicaen.iota.xacml.pep.MethodNamesCapture;
|
||
import fr.unicaen.iota.xacml.pep.MethodNamesQuery;
|
||
import java.lang.reflect.Method;
|
||
import java.util.ArrayList;
|
||
import java.util.List;
|
||
|
||
/**
|
||
*
|
||
*/
|
||
public final class HTMLUtilities {
|
||
|
||
private static final String[] SERVICES = {"ds", "ided_ds", "epcis", "ided_epcis", "html", "ws", "xmlrpc"};
|
||
|
||
private static final String[] TYPES = {"object", "aggregation", "quantity", "transaction"};
|
||
|
||
private HTMLUtilities() {
|
||
}
|
||
|
||
public static String createOwnerSelect() {
|
||
StringBuilder res = new StringBuilder();
|
||
res.append("<select class=\"ownerSelector\" id=\"groupOwnerName\">");
|
||
for (String ownerId : listAllOwners()) {
|
||
res.append("<option label=\"owner: ");
|
||
res.append(ownerId);
|
||
res.append("\" value=\"");
|
||
res.append(ownerId);
|
||
res.append("\">");
|
||
res.append(ownerId);
|
||
res.append("</option>");
|
||
}
|
||
res.append("</select>");
|
||
return res.toString();
|
||
}
|
||
|
||
public static String createMethodSelect(Module m) {
|
||
StringBuilder res = new StringBuilder();
|
||
|
||
switch (m) {
|
||
case adminModule:
|
||
res.append("<select class=\"methodSelector\" id=\"methodNameAdmin\">");
|
||
for (Method method1 : MethodNamesAdmin.class.getMethods()) {
|
||
res.append("<option label=\"method: ");
|
||
res.append(method1.getName());
|
||
res.append("\" value=\"");
|
||
res.append(method1.getName());
|
||
res.append("\">");
|
||
res.append(method1.getName());
|
||
res.append("</option>");
|
||
}
|
||
break;
|
||
case captureModule:
|
||
res.append("<select class=\"methodSelector\" id=\"methodNameCapture\">");
|
||
for (Method method2 : MethodNamesCapture.class.getMethods()) {
|
||
res.append("<option label=\"method: ");
|
||
res.append(method2.getName());
|
||
res.append("\" value=\"");
|
||
res.append(method2.getName());
|
||
res.append("\">");
|
||
res.append(method2.getName());
|
||
res.append("</option>");
|
||
}
|
||
break;
|
||
case queryModule:
|
||
res.append("<select class=\"methodSelector\" id=\"methodNameQuery\">");
|
||
for (Method method3 : MethodNamesQuery.class.getMethods()) {
|
||
res.append("<option label=\"method: ");
|
||
res.append(method3.getName());
|
||
res.append("\" value=\"");
|
||
res.append(method3.getName());
|
||
res.append("\">");
|
||
res.append(method3.getName());
|
||
res.append("</option>");
|
||
}
|
||
break;
|
||
}
|
||
res.append("</select>");
|
||
return res.toString();
|
||
}
|
||
|
||
public static String createSelectServiceType(String serviceType, String idSuffix) {
|
||
StringBuilder res = new StringBuilder();
|
||
res.append("<select id=\"serviceType");
|
||
res.append(idSuffix);
|
||
res.append("\" >");
|
||
for (String s : SERVICES) {
|
||
res.append("<option ");
|
||
res.append(serviceType.equals(s) ? "selected" : "");
|
||
res.append(" value=\"");
|
||
res.append(s);
|
||
res.append("\">");
|
||
res.append(s);
|
||
res.append("</option>");
|
||
}
|
||
res.append("</select>");
|
||
return res.toString();
|
||
}
|
||
|
||
public static String createSelectEventTypeFilter() {
|
||
StringBuilder res = new StringBuilder();
|
||
res.append("<select id=\"eventTypeFilterName\" >");
|
||
for (String s : TYPES) {
|
||
res.append("<option value=\"");
|
||
res.append(s);
|
||
res.append("\">");
|
||
res.append(s);
|
||
res.append("</option>");
|
||
}
|
||
res.append("</select>");
|
||
return res.toString();
|
||
}
|
||
|
||
private static Iterable<String> listAllOwners() {
|
||
|
||
// TODO: TODOTODO !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||
|
||
List<String> ownerIdList = new ArrayList<String>();
|
||
ownerIdList.add("owner1");
|
||
ownerIdList.add("owner2");
|
||
ownerIdList.add("owner3");
|
||
ownerIdList.add("owner4");
|
||
ownerIdList.add("owner5");
|
||
|
||
return ownerIdList;
|
||
}
|
||
|
||
private static Iterable<String> listAllMethods() {
|
||
|
||
// TODO: TODOTODO !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||
|
||
List<String> methodList = new ArrayList<String>();
|
||
methodList.add("m1");
|
||
methodList.add("m2");
|
||
methodList.add("m3");
|
||
methodList.add("m4");
|
||
methodList.add("m5");
|
||
|
||
return methodList;
|
||
}
|
||
}
|
DSeTa/DiscoveryPHI/src/main/java/fr/unicaen/iota/dphi/utils/InterfaceHelper.java | ||
---|---|---|
/*
|
||
* This program is a part of the IoTa project.
|
||
*
|
||
* Copyright © 2008-2012 Université de Caen Basse-Normandie, GREYC
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation, either version 3 of the License, or
|
||
* (at your option) any later version.
|
||
*
|
||
* This program is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
* <http://www.gnu.org/licenses/>
|
||
*
|
||
* See AUTHORS for a list of contributors.
|
||
*/
|
||
package fr.unicaen.iota.dphi.utils;
|
||
|
||
import fr.unicaen.iota.xacml.AccessPolicyManagerSession;
|
||
import org.apache.commons.logging.Log;
|
||
import org.apache.commons.logging.LogFactory;
|
||
|
||
/**
|
||
*
|
||
*/
|
||
public class InterfaceHelper {
|
||
|
||
private static final Log log = LogFactory.getLog(InterfaceHelper.class);
|
||
// TODO @SLS public field!
|
||
public AccessPolicyManagerSession APMSession;
|
||
|
||
public InterfaceHelper(String owner) {
|
||
log.info("InterfaceHelper instanciated");
|
||
APMSession = MapSessions.APM.getInstance(owner);
|
||
}
|
||
|
||
public void updateAPM() {
|
||
MapSessions.APM.updateAPMSession(APMSession);
|
||
}
|
||
|
||
public void updateQueryAPM() {
|
||
MapSessions.APM.updateAPMQuerySession(APMSession);
|
||
}
|
||
|
||
public void updateCaptureAPM() {
|
||
MapSessions.APM.updateAPMCaptureSession(APMSession);
|
||
}
|
||
|
||
public void updateAdminAPM() {
|
||
MapSessions.APM.updateAPMAdminSession(APMSession);
|
||
}
|
||
|
||
public void reload() {
|
||
log.info("RELAOD DSPDP");
|
||
APMSession.initDSPDP(APMSession.getOwner());
|
||
APMSession.initFinderModule();
|
||
}
|
||
}
|
DSeTa/DiscoveryPHI/src/main/java/fr/unicaen/iota/dphi/utils/MapSessions.java | ||
---|---|---|
/*
|
||
* This program is a part of the IoTa project.
|
||
*
|
||
* Copyright © 2008-2012 Université de Caen Basse-Normandie, GREYC
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation, either version 3 of the License, or
|
||
* (at your option) any later version.
|
||
*
|
||
* This program is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
* <http://www.gnu.org/licenses/>
|
||
*
|
||
* See AUTHORS for a list of contributors.
|
||
*/
|
||
package fr.unicaen.iota.dphi.utils;
|
||
|
||
import fr.unicaen.iota.xacml.AccessPolicyManager;
|
||
import fr.unicaen.iota.xacml.finder.MyPolicyCollection;
|
||
import fr.unicaen.iota.xacml.finder.MyPolicyFinderModule;
|
||
import fr.unicaen.iota.xacml.policy.OwnerPolicies;
|
||
import java.util.HashMap;
|
||
import java.util.Map;
|
||
import org.apache.commons.logging.Log;
|
||
import org.apache.commons.logging.LogFactory;
|
||
|
||
/**
|
||
*
|
||
*/
|
||
public final class MapSessions {
|
||
|
||
private MapSessions() {
|
||
}
|
||
private final static Log log = LogFactory.getLog(MapSessions.class);
|
||
// TODO: SLS public hence not procected by synchronized
|
||
public final static AccessPolicyManager APM = new AccessPolicyManager();
|
||
private final static Map<String, InterfaceHelper> APMSessions = new HashMap<String, InterfaceHelper>();
|
||
|
||
public static synchronized String AdminAPMtoString() {
|
||
StringBuilder res = new StringBuilder();
|
||
for (Object o : APM.getDspdp().getPolicyFinder().getModules()) {
|
||
if (o instanceof MyPolicyFinderModule) {
|
||
MyPolicyFinderModule mod = (MyPolicyFinderModule) o;
|
||
MyPolicyCollection col = mod.getPolicies();
|
||
Map<String, OwnerPolicies> map = col.getAdminPolicies();
|
||
for (String key : map.keySet()) {
|
||
res.append(key);
|
||
res.append(" \n");
|
||
OwnerPolicies ownerPolicies = map.get(key);
|
||
//TODO: SLS and?
|
||
}
|
||
}
|
||
}
|
||
return res.toString();
|
||
}
|
||
|
||
public static synchronized InterfaceHelper getAPMSession(String userId, String ownerId) {
|
||
if (APMSessions.containsKey(userId)) {
|
||
return APMSessions.get(userId);
|
||
} else {
|
||
InterfaceHelper IH = new InterfaceHelper(ownerId);
|
||
APMSessions.put(userId, IH);
|
||
return IH;
|
||
}
|
||
}
|
||
|
||
public static synchronized void releaseSession(String userId) {
|
||
APMSessions.remove(userId);
|
||
}
|
||
|
||
public static synchronized void init() {
|
||
APM.init();
|
||
}
|
||
}
|
DSeTa/DiscoveryPHI/src/main/java/fr/unicaen/iota/dphi/utils/PEPRequester.java | ||
---|---|---|
/*
|
||
* This program is a part of the IoTa project.
|
||
*
|
||
* Copyright © 2008-2012 Université de Caen Basse-Normandie, GREYC
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation, either version 3 of the License, or
|
||
* (at your option) any later version.
|
||
*
|
||
* This program is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
* <http://www.gnu.org/licenses/>
|
||
*
|
||
* See AUTHORS for a list of contributors.
|
||
*/
|
||
package fr.unicaen.iota.dphi.utils;
|
||
|
||
import com.sun.xacml.ctx.Result;
|
||
import fr.unicaen.iota.dphi.auth.User;
|
||
import fr.unicaen.iota.dphi.xacml.pep.DSPEP;
|
||
import java.lang.reflect.InvocationTargetException;
|
||
import java.lang.reflect.Method;
|
||
import java.util.ArrayList;
|
||
import org.apache.commons.logging.Log;
|
||
import org.apache.commons.logging.LogFactory;
|
||
|
||
/**
|
||
*
|
||
*/
|
||
public final class PEPRequester {
|
||
|
||
private static final Log log = LogFactory.getLog(PEPRequester.class);
|
||
|
||
private PEPRequester() {
|
||
}
|
||
|
||
private static Object runMethod(Object obj, Object[] args, String methodName) {
|
||
try {
|
||
Class<?>[] paramTypes = null;
|
||
if (args != null) {
|
||
paramTypes = new Class<?>[args.length];
|
||
for (int i = 0; i < args.length; ++i) {
|
||
paramTypes[i] = args[i].getClass();
|
||
}
|
||
}
|
||
Method m = obj.getClass().getMethod(methodName, paramTypes);
|
||
return m.invoke(obj, args);
|
||
} catch (IllegalAccessException ex) {
|
||
log.fatal(null, ex);
|
||
} catch (IllegalArgumentException ex) {
|
||
log.fatal(null, ex);
|
||
} catch (InvocationTargetException ex) {
|
||
log.fatal(null, ex);
|
||
} catch (NoSuchMethodException ex) {
|
||
log.fatal(null, ex);
|
||
} catch (SecurityException ex) {
|
||
log.fatal(null, ex);
|
||
}
|
||
return Result.DECISION_DENY;
|
||
}
|
||
|
||
public static int checkAccess(User user, String methodName) {
|
||
String userS = user.getUserID();
|
||
String owner = user.getOwnerID();
|
||
ArrayList<String> args = new ArrayList<String>();
|
||
args.add(userS);
|
||
args.add(owner);
|
||
DSPEP dspep = new DSPEP();
|
||
return (Integer) runMethod(dspep, args.toArray(), methodName);
|
||
}
|
||
}
|
DSeTa/DiscoveryPHI/src/main/java/fr/unicaen/iota/dphi/xacml/ihm/Mode.java | ||
---|---|---|
/*
|
||
* This program is a part of the IoTa project.
|
||
*
|
||
* Copyright © 2008-2012 Université de Caen Basse-Normandie, GREYC
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation, either version 3 of the License, or
|
||
* (at your option) any later version.
|
||
*
|
||
* This program is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
* <http://www.gnu.org/licenses/>
|
||
*
|
||
* See AUTHORS for a list of contributors.
|
||
*/
|
||
package fr.unicaen.iota.dphi.xacml.ihm;
|
||
|
||
/**
|
||
*
|
||
*/
|
||
public enum Mode {
|
||
|
||
Assert_Mode,
|
||
Create_Mode;
|
||
}
|
DSeTa/DiscoveryPHI/src/main/java/fr/unicaen/iota/dphi/xacml/ihm/Module.java | ||
---|---|---|
/*
|
||
* This program is a part of the IoTa project.
|
||
*
|
||
* Copyright © 2008-2012 Université de Caen Basse-Normandie, GREYC
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation, either version 3 of the License, or
|
||
* (at your option) any later version.
|
||
*
|
||
* This program is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
* <http://www.gnu.org/licenses/>
|
||
*
|
||
* See AUTHORS for a list of contributors.
|
||
*/
|
||
package fr.unicaen.iota.dphi.xacml.ihm;
|
||
|
||
/**
|
||
*
|
||
*/
|
||
public enum Module {
|
||
|
||
queryModule,
|
||
captureModule,
|
||
adminModule
|
||
|
||
}
|
DSeTa/DiscoveryPHI/src/main/java/fr/unicaen/iota/dphi/xacml/ihm/NodeType.java | ||
---|---|---|
/*
|
||
* This program is a part of the IoTa project.
|
||
*
|
||
* Copyright © 2008-2012 Université de Caen Basse-Normandie, GREYC
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation, either version 3 of the License, or
|
||
* (at your option) any later version.
|
||
*
|
||
* This program is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
* <http://www.gnu.org/licenses/>
|
||
*
|
||
* See AUTHORS for a list of contributors.
|
||
*/
|
||
package fr.unicaen.iota.dphi.xacml.ihm;
|
||
|
||
/**
|
||
*
|
||
*/
|
||
public enum NodeType {
|
||
|
||
policiesNode,
|
||
policyNode,
|
||
bizStepFilterNode,
|
||
epcFilterNode,
|
||
eventTypeFilterNode,
|
||
eventTimeFilterNode,
|
||
methodFilterNode,
|
||
bizStepFilterGroupNode,
|
||
epcFilterGroupNode,
|
||
eventTypeFilterGroupNode,
|
||
eventTimeFilterGroupNode,
|
||
methodFilterGroupNode,
|
||
rulesNode,
|
||
userNode,
|
||
usersNode;
|
||
|
||
public boolean isFilter() {
|
||
return this == bizStepFilterNode
|
||
|| this == epcFilterNode
|
||
|| this == eventTypeFilterNode
|
||
|| this == eventTimeFilterNode
|
||
|| this == methodFilterNode;
|
||
}
|
||
|
||
public boolean isFilterGroup() {
|
||
return this == bizStepFilterGroupNode
|
||
|| this == epcFilterGroupNode
|
||
|| this == eventTypeFilterGroupNode
|
||
|| this == eventTimeFilterGroupNode
|
||
|| this == methodFilterGroupNode;
|
||
}
|
||
|
||
public boolean isExpandable() {
|
||
return this == bizStepFilterGroupNode
|
||
|| this == epcFilterGroupNode
|
||
|| this == eventTypeFilterGroupNode
|
||
|| this == eventTimeFilterGroupNode
|
||
|| this == policyNode
|
||
|| this == policiesNode
|
||
|| this == rulesNode
|
||
|| this == usersNode
|
||
|| this == methodFilterGroupNode;
|
||
}
|
||
}
|
DSeTa/DiscoveryPHI/src/main/java/fr/unicaen/iota/dphi/xacml/ihm/TreeFactory.java | ||
---|---|---|
/*
|
||
* This program is a part of the IoTa project.
|
||
*
|
||
* Copyright © 2008-2012 Université de Caen Basse-Normandie, GREYC
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation, either version 3 of the License, or
|
||
* (at your option) any later version.
|
||
*
|
||
* This program is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
* <http://www.gnu.org/licenses/>
|
||
*
|
||
* See AUTHORS for a list of contributors.
|
||
*/
|
||
package fr.unicaen.iota.dphi.xacml.ihm;
|
||
|
||
/**
|
||
*
|
||
*/
|
||
public class TreeFactory {
|
||
|
||
private Mode mode;
|
||
|
||
public TreeFactory(Mode mode) {
|
||
this.mode = mode;
|
||
}
|
||
|
||
public String createTree(TreeNode treeNode) {
|
||
StringBuilder result = new StringBuilder();
|
||
String button = treeNode.getNodeType() == NodeType.policyNode && this.mode == Mode.Create_Mode
|
||
? "<a href=\"#\" onclick=\"expand(this);\" class=\"icon_tree expanderButton2\"></a>"
|
||
: "<a href=\"#\" onclick=\"expand(this);\" class=\"icon_tree expanderButton\"></a>";
|
||
String img = treeNode.getNodeType() == NodeType.userNode ? "user"
|
||
: (treeNode.getNodeType().isFilter() ? "filter" : "");
|
||
String desc = createTitleDescription(treeNode);
|
||
String icon = "<div class=\"icon_tree icon_tree_" + img + "\"> </div>";
|
||
if (treeNode.getNodeType() == NodeType.policiesNode) {
|
||
result.append("<div class=\"rootzone\" id=\"root");
|
||
result.append(treeNode.getModule());
|
||
result.append("\">\n");
|
||
}
|
||
result.append("<div class=\"TreeNodeBlock\"><div class=\"TreeNodeTitle ");
|
||
result.append(treeNode.getNodeType());
|
||
result.append("\">");
|
||
result.append(treeNode.getNodeType().isExpandable() ? button : icon);
|
||
result.append("<a href=\"#\" class=\"TreeNodeTitleInnerHtml\" onclick=\"selectBoxNode(this);\"><span class=\"TreeNodeTitleInnerHtmlDesc\">");
|
||
result.append(desc);
|
||
result.append("</span><span class=\"TreeNodeTitleInnerHtmlValue\">");
|
||
result.append(treeNode.getLabel());
|
||
result.append("</span></a>");
|
||
result.append(createCommand(treeNode));
|
||
result.append("</div>\n");
|
||
if (!treeNode.getChildren().isEmpty()) {
|
||
result.append("<div class=\"TreeNodeContent\" ");
|
||
result.append((treeNode.getNodeType() == NodeType.policyNode && this.mode == Mode.Create_Mode) ? "style=\"display:none\" " : "");
|
||
result.append(">\n");
|
||
for (TreeNode node : treeNode.getChildren()) {
|
||
result.append(createTree(node));
|
||
}
|
||
result.append("</div>\n");
|
||
} else if (treeNode.getNodeType().isFilterGroup()
|
||
|| treeNode.getNodeType() == NodeType.usersNode
|
||
|| treeNode.getNodeType() == NodeType.policiesNode) {
|
||
result.append("<div class=\"TreeNodeContent\">\n</div>\n");
|
||
}
|
||
result.append("</div>\n");
|
||
if (treeNode.getNodeType() == NodeType.policiesNode) {
|
||
result.append("</div>\n");
|
||
}
|
||
return result.toString();
|
||
}
|
||
|
||
private String createCommand(TreeNode treeNode) {
|
||
String command_start = "<div class=\"nodeCommand\">";
|
||
String command_end = "</div>";
|
||
String switchPolicy = "<a class=\"switch\" href=\"#\" onclick=\"processSwitchPolicy('" + treeNode.getNodeType() + "','"
|
||
+ treeNode.getGroupID() + "','" + treeNode.getObjectID() + "',this,'" + treeNode.getModule() + "');\"></a>";
|
||
String create = "<a class=\"add\" href=\"#\" onclick=\"processRequestCreate('" + treeNode.getNodeType() + "','"
|
||
+ treeNode.getGroupID() + "','" + treeNode.getObjectID() + "',this,'" + treeNode.getModule() + "');\"></a>";
|
||
String remove = "<a class=\"remove\" href=\"#\" onclick=\"processRequestRemove('" + treeNode.getNodeType() + "','"
|
||
+ treeNode.getGroupID() + "','" + escapeRegExp(treeNode.getObjectID()) + "',this,'" + treeNode.getModule() + "');\"></a>";
|
||
String update = "<a class=\"update\" href=\"#\" onclick=\"processRequestUpdate('" + treeNode.getNodeType() + "','"
|
||
+ treeNode.getGroupID() + "','" + treeNode.getObjectID() + "',this,'" + treeNode.getModule() + "');\"></a>";
|
||
if (treeNode.getNodeType().isFilter()) {
|
||
return command_start + remove + command_end;
|
||
}
|
||
if (treeNode.getNodeType().isFilterGroup()) {
|
||
if (treeNode.getNodeType() == NodeType.methodFilterGroupNode) {
|
||
return command_start + create + command_end;
|
||
} else {
|
||
return command_start + switchPolicy + create + command_end;
|
||
}
|
||
}
|
||
switch (treeNode.getNodeType()) {
|
||
case rulesNode:
|
||
return command_start + command_end;
|
||
case usersNode:
|
||
return command_start + switchPolicy + create + command_end;
|
||
case userNode:
|
||
return command_start + remove + command_end;
|
||
case policyNode:
|
||
return command_start + update + remove + command_end;
|
||
case policiesNode:
|
||
return command_start + create + command_end;
|
||
default:
|
||
break;
|
||
}
|
||
return command_start + remove + create + update + command_end;
|
||
}
|
||
|
||
private String createTitleDescription(TreeNode treeNode) {
|
||
switch (treeNode.getNodeType()) {
|
||
case usersNode:
|
||
return "users / default policy: ";
|
||
case policyNode:
|
||
return "Group name: ";
|
||
case bizStepFilterGroupNode:
|
||
return "BizStep Filters / default policy: ";
|
||
case epcFilterGroupNode:
|
||
return "EPC Filters / default policy: ";
|
||
case eventTypeFilterGroupNode:
|
||
return "Event Class Filters / default policy: ";
|
||
case eventTimeFilterGroupNode:
|
||
return "Event Time Filters / default policy: ";
|
||
case rulesNode:
|
||
return "Restricted filters";
|
||
case policiesNode:
|
||
return "Group list";
|
||
case methodFilterGroupNode:
|
||
return "Method filters";
|
||
case methodFilterNode:
|
||
return "method: ";
|
||
case userNode:
|
||
return "user id: ";
|
||
case bizStepFilterNode:
|
||
return "bizStep filter: ";
|
||
case eventTimeFilterNode:
|
||
return "period filter: ";
|
||
case eventTypeFilterNode:
|
||
return "Event class filter: ";
|
||
case epcFilterNode:
|
||
return "EPC filter: ";
|
||
default:
|
||
return "";
|
||
}
|
||
}
|
||
|
||
private String escapeRegExp(String objectID) {
|
||
if (objectID == null) {
|
||
return "null";
|
||
}
|
||
return objectID.replaceAll("\\\\", "\\\\\\\\");
|
||
}
|
||
}
|
DSeTa/DiscoveryPHI/src/main/java/fr/unicaen/iota/dphi/xacml/ihm/TreeNode.java | ||
---|---|---|
/*
|
||
* This program is a part of the IoTa project.
|
||
*
|
||
* Copyright © 2008-2012 Université de Caen Basse-Normandie, GREYC
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation, either version 3 of the License, or
|
||
* (at your option) any later version.
|
||
*
|
||
* This program is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
* <http://www.gnu.org/licenses/>
|
||
*
|
||
* See AUTHORS for a list of contributors.
|
||
*/
|
||
package fr.unicaen.iota.dphi.xacml.ihm;
|
||
|
||
import java.util.List;
|
||
|
||
/**
|
||
*
|
||
*/
|
||
public interface TreeNode {
|
||
|
||
public String getLabel();
|
||
|
||
public NodeType getNodeType();
|
||
|
||
public List<TreeNode> getChildren();
|
||
|
||
public String getObjectID();
|
||
|
||
public Module getModule();
|
||
|
||
public String getGroupID();
|
||
|
||
public void addChild(TreeNode child);
|
||
}
|
DSeTa/DiscoveryPHI/src/main/java/fr/unicaen/iota/dphi/xacml/ihm/factory/AccessPolicies.java | ||
---|---|---|
/*
|
||
* This program is a part of the IoTa project.
|
||
*
|
||
* Copyright © 2008-2013 Université de Caen Basse-Normandie, GREYC
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation, either version 3 of the License, or
|
||
* (at your option) any later version.
|
||
*
|
||
* This program is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
* <http://www.gnu.org/licenses/>
|
||
*
|
||
* See AUTHORS for a list of contributors.
|
||
*/
|
||
package fr.unicaen.iota.dphi.xacml.ihm.factory;
|
||
|
||
import fr.unicaen.iota.dphi.utils.InterfaceHelper;
|
||
import fr.unicaen.iota.dphi.utils.MapSessions;
|
||
import fr.unicaen.iota.dphi.xacml.ihm.Module;
|
||
import fr.unicaen.iota.dphi.xacml.ihm.NodeType;
|
||
import fr.unicaen.iota.dphi.xacml.ihm.TreeNode;
|
||
import fr.unicaen.iota.xacml.policy.GroupPolicy;
|
||
import fr.unicaen.iota.xacml.policy.OwnerPolicies;
|
||
import java.util.ArrayList;
|
||
import java.util.Date;
|
||
import java.util.List;
|
||
|
||
/**
|
||
*
|
||
*/
|
||
public class AccessPolicies {
|
||
|
||
private List<TreeNode> policiesQuery = new ArrayList<TreeNode>();
|
||
private List<TreeNode> policiesAdmin = new ArrayList<TreeNode>();
|
||
private List<TreeNode> policiesCapture = new ArrayList<TreeNode>();
|
||
|
||
public AccessPolicies() {
|
||
}
|
||
|
||
public AccessPolicies(String userId, String owner) {
|
||
this.createQueryPolicies(userId, owner);
|
||
this.createCapturePolicies(userId, owner);
|
||
this.createAdminPolicies(userId, owner);
|
||
}
|
||
|
||
public AccessPolicies(String userId, String owner, Module module) {
|
||
switch (module) {
|
||
case adminModule:
|
||
this.createAdminPolicies(userId, owner);
|
||
break;
|
||
case queryModule:
|
||
this.createQueryPolicies(userId, owner);
|
||
break;
|
||
case captureModule:
|
||
this.createCapturePolicies(userId, owner);
|
||
break;
|
||
}
|
||
}
|
||
|
||
private synchronized void createQueryPolicies(String userId, String owner) {
|
||
OwnerPolicies ownerPolicies = MapSessions.getAPMSession(userId, owner).APMSession.getQueryPolicy(owner);
|
||
Node policies = new Node("", NodeType.policiesNode, null, Module.queryModule, null);
|
||
if (ownerPolicies != null) {
|
||
for (Object ogp : ownerPolicies.getPolicies()) {
|
||
if (ogp instanceof GroupPolicy) {
|
||
GroupPolicy gp = (GroupPolicy) ogp;
|
||
GroupPolicyTreeNode gptn = new GroupPolicyTreeNode(gp, gp.getId().toString(), Module.queryModule);
|
||
UserGroupRuleTreeNode groupRoot = new UserGroupRuleTreeNode(gp.getUsersFilterFunction(), gp.getId().toString(), Module.queryModule);
|
||
for (Object ob : gp.getUsers()) {
|
||
String value = (String) ob;
|
||
UserTreeNode userTreeNode = new UserTreeNode(value, value, gp.getId().toString(), Module.queryModule);
|
||
groupRoot.addChild(userTreeNode);
|
||
}
|
||
gptn.addChild(groupRoot);
|
||
|
||
ActionTargetTreeNode actionTargetTreeNode = new ActionTargetTreeNode(gp.getId().toString(), Module.queryModule);
|
||
|
||
for (Object ob : gp.getActions()) {
|
||
String value = (String) ob;
|
||
ActionTreeNode actionTreeNode = new ActionTreeNode(value, value, gp.getId().toString(), Module.queryModule);
|
||
actionTargetTreeNode.addChild(actionTreeNode);
|
||
}
|
||
gptn.addChild(actionTargetTreeNode);
|
||
|
||
Node filters = new Node("", NodeType.rulesNode, null, Module.queryModule, "id_group_query_1"); // NATIVE
|
||
|
||
BizStepRuleTreeNode bizStepRuleTreeNode = new BizStepRuleTreeNode(gp.getBizStepsFilterFunction(), gp.getId().toString(), Module.queryModule);
|
||
|
||
for (Object ob : gp.getBizSteps()) {
|
||
String value = (String) ob;
|
||
BizStepTreeNode treeNode = new BizStepTreeNode(value, value, gp.getId().toString(), Module.queryModule);
|
||
bizStepRuleTreeNode.addChild(treeNode);
|
||
}
|
||
filters.addChild(bizStepRuleTreeNode);
|
||
|
||
EventTypeRuleTreeNode eventTypeRuleTreeNode = new EventTypeRuleTreeNode(gp.getEventTypesFilterFunction(), gp.getId().toString(), Module.queryModule);
|
||
|
||
for (Object ob : gp.getEventTypes()) {
|
||
String value = (String) ob;
|
||
EventTypeTreeNode treeNode = new EventTypeTreeNode(value, value, gp.getId().toString(), Module.queryModule);
|
||
eventTypeRuleTreeNode.addChild(treeNode);
|
||
}
|
||
|
||
filters.addChild(eventTypeRuleTreeNode);
|
||
|
||
EpcsRuleTreeNode epcRuleTreeNode = new EpcsRuleTreeNode(gp.getEpcsFilterFunction(), gp.getId().toString(), Module.queryModule);
|
||
|
||
for (Object ob : gp.getEpcs()) {
|
||
String value = (String) ob;
|
||
EpcTreeNode treeNode = new EpcTreeNode(value, value, gp.getId().toString(), Module.queryModule);
|
||
epcRuleTreeNode.addChild(treeNode);
|
||
}
|
||
|
||
filters.addChild(epcRuleTreeNode);
|
||
|
||
EventTimeRuleTreeNode eventTimeRuleTreeNode = new EventTimeRuleTreeNode(gp.getEventTimesFilterFunction(), gp.getId().toString(), Module.queryModule);
|
||
|
||
for (Object ob : gp.getEventTimes()) {
|
||
List value = (List) ob;
|
||
EventTimeTreeNode treeNode = new EventTimeTreeNode((Date) value.get(0), (Date) value.get(1), gp.getId().toString(), Module.queryModule);
|
||
eventTimeRuleTreeNode.addChild(treeNode);
|
||
}
|
||
filters.addChild(eventTimeRuleTreeNode);
|
||
gptn.addChild(filters);
|
||
policies.addChild(gptn);
|
||
}
|
||
}
|
||
} else {
|
||
InterfaceHelper ih = MapSessions.getAPMSession(userId, owner);
|
||
ownerPolicies = new OwnerPolicies(owner, fr.unicaen.iota.xacml.policy.Module.queryModule);
|
||
ih.APMSession.addQueryPolicy(ownerPolicies);
|
||
ih.APMSession.saveQueryPolicies(owner);
|
||
ih.updateAPM();
|
||
}
|
||
getPoliciesQuery().add(policies);
|
||
}
|
||
|
||
private synchronized void createCapturePolicies(String userId, String owner) {
|
||
OwnerPolicies ownerPolicies = MapSessions.getAPMSession(userId, owner).APMSession.getCapturePolicy(owner);
|
||
Node policies = new Node("", NodeType.policiesNode, null, Module.captureModule, null);
|
||
|
||
if (ownerPolicies != null) {
|
||
for (Object ogp : ownerPolicies.getPolicies()) {
|
||
if (ogp instanceof GroupPolicy) {
|
||
GroupPolicy gp = (GroupPolicy) ogp;
|
||
GroupPolicyTreeNode gptn = new GroupPolicyTreeNode(gp, gp.getId().toString(), Module.captureModule);
|
||
UserGroupRuleTreeNode groupRoot = new UserGroupRuleTreeNode(gp.getUsersFilterFunction(), gp.getId().toString(), Module.captureModule);
|
||
for (Object ob : gp.getUsers()) {
|
||
String value = (String) ob;
|
||
UserTreeNode userTreeNode = new UserTreeNode(value, value, gp.getId().toString(), Module.captureModule);
|
||
groupRoot.addChild(userTreeNode);
|
||
}
|
||
gptn.addChild(groupRoot);
|
||
|
||
ActionTargetTreeNode actionTargetTreeNode = new ActionTargetTreeNode(gp.getId().toString(), Module.captureModule);
|
||
|
||
for (Object ob : gp.getActions()) {
|
||
String value = (String) ob;
|
||
ActionTreeNode actionTreeNode = new ActionTreeNode(value, value, gp.getId().toString(), Module.captureModule);
|
||
actionTargetTreeNode.addChild(actionTreeNode);
|
||
}
|
||
gptn.addChild(actionTargetTreeNode);
|
||
|
||
Node filters = new Node("", NodeType.rulesNode, null, Module.captureModule, "id_group_capture_1"); // NATIVE
|
||
|
||
BizStepRuleTreeNode bizStepRuleTreeNode = new BizStepRuleTreeNode(gp.getBizStepsFilterFunction(), gp.getId().toString(), Module.captureModule);
|
||
|
||
for (Object ob : gp.getBizSteps()) {
|
||
String value = (String) ob;
|
||
BizStepTreeNode treeNode = new BizStepTreeNode(value, value, gp.getId().toString(), Module.captureModule);
|
||
bizStepRuleTreeNode.addChild(treeNode);
|
||
}
|
||
filters.addChild(bizStepRuleTreeNode);
|
||
|
||
EventTypeRuleTreeNode eventTypeRuleTreeNode = new EventTypeRuleTreeNode(gp.getEventTypesFilterFunction(), gp.getId().toString(), Module.captureModule);
|
||
|
||
for (Object ob : gp.getEventTypes()) {
|
||
String value = (String) ob;
|
||
EventTypeTreeNode treeNode = new EventTypeTreeNode(value, value, gp.getId().toString(), Module.captureModule);
|
||
eventTypeRuleTreeNode.addChild(treeNode);
|
||
}
|
||
|
||
filters.addChild(eventTypeRuleTreeNode);
|
||
|
||
EpcsRuleTreeNode epcRuleTreeNode = new EpcsRuleTreeNode(gp.getEpcsFilterFunction(), gp.getId().toString(), Module.captureModule);
|
||
|
||
for (Object ob : gp.getEpcs()) {
|
||
String value = (String) ob;
|
||
EpcTreeNode treeNode = new EpcTreeNode(value, value, gp.getId().toString(), Module.captureModule);
|
||
epcRuleTreeNode.addChild(treeNode);
|
||
}
|
||
|
||
filters.addChild(epcRuleTreeNode);
|
||
|
||
EventTimeRuleTreeNode eventTimeRuleTreeNode = new EventTimeRuleTreeNode(gp.getEventTimesFilterFunction(), gp.getId().toString(), Module.captureModule);
|
||
|
||
for (Object ob : gp.getEventTimes()) {
|
||
List value = (List) ob;
|
||
EventTimeTreeNode treeNode = new EventTimeTreeNode((Date) value.get(0), (Date) value.get(1), gp.getId().toString(), Module.captureModule);
|
||
eventTimeRuleTreeNode.addChild(treeNode);
|
||
}
|
||
filters.addChild(eventTimeRuleTreeNode);
|
||
gptn.addChild(filters);
|
||
policies.addChild(gptn);
|
||
|
||
}
|
||
}
|
||
} else {
|
||
InterfaceHelper ih = MapSessions.getAPMSession(userId, owner);
|
||
ownerPolicies = new OwnerPolicies(owner, fr.unicaen.iota.xacml.policy.Module.captureModule);
|
||
ih.APMSession.addCapturePolicy(ownerPolicies);
|
||
ih.APMSession.saveCapturePolicies(owner);
|
||
ih.updateAPM();
|
||
}
|
||
getPoliciesCapture().add(policies);
|
||
}
|
||
|
||
private synchronized void createAdminPolicies(String userId, String owner) {
|
||
OwnerPolicies ownerPolicies = MapSessions.getAPMSession(userId, owner).APMSession.getAdminPolicy(owner);
|
||
Node policies = new Node("", NodeType.policiesNode, null, Module.adminModule, null);
|
||
|
||
if (ownerPolicies != null) {
|
||
for (Object ogp : ownerPolicies.getPolicies()) {
|
||
if (ogp instanceof GroupPolicy) {
|
||
GroupPolicy gp = (GroupPolicy) ogp;
|
||
GroupPolicyTreeNode gptn = new GroupPolicyTreeNode(gp, gp.getId().toString(), Module.adminModule);
|
||
UserGroupRuleTreeNode groupRoot = new UserGroupRuleTreeNode(gp.getUsersFilterFunction(), gp.getId().toString(), Module.adminModule);
|
||
for (Object ob : gp.getUsers()) {
|
||
String value = (String) ob;
|
||
UserTreeNode userTreeNode = new UserTreeNode(value, value, gp.getId().toString(), Module.adminModule);
|
||
groupRoot.addChild(userTreeNode);
|
||
}
|
||
gptn.addChild(groupRoot);
|
||
|
||
ActionTargetTreeNode actionTargetTreeNode = new ActionTargetTreeNode(gp.getId().toString(), Module.adminModule);
|
||
|
||
for (Object ob : gp.getActions()) {
|
||
String value = (String) ob;
|
||
ActionTreeNode actionTreeNode = new ActionTreeNode(value, value, gp.getId().toString(), Module.adminModule);
|
||
actionTargetTreeNode.addChild(actionTreeNode);
|
||
}
|
||
gptn.addChild(actionTargetTreeNode);
|
||
policies.addChild(gptn);
|
||
|
||
}
|
||
}
|
||
} else {
|
||
InterfaceHelper ih = MapSessions.getAPMSession(userId, owner);
|
||
ownerPolicies = new OwnerPolicies(owner, fr.unicaen.iota.xacml.policy.Module.administrationModule);
|
||
ih.APMSession.addAdminPolicy(ownerPolicies);
|
||
ih.APMSession.saveAdminPolicies(owner);
|
||
ih.updateAPM();
|
||
}
|
||
getPoliciesAdmin().add(policies);
|
||
}
|
||
|
||
public synchronized TreeNode createGroupPolicy(GroupPolicy gp, Module module) {
|
||
GroupPolicyTreeNode gptn = new GroupPolicyTreeNode(gp, gp.getId().toString(), module);
|
||
UserGroupRuleTreeNode groupRoot = new UserGroupRuleTreeNode(gp.getUsersFilterFunction(), gp.getId().toString(), module);
|
||
for (Object ob : gp.getUsers()) {
|
||
String value = (String) ob;
|
||
UserTreeNode userTreeNode = new UserTreeNode(value, value, gp.getId().toString(), module);
|
||
groupRoot.addChild(userTreeNode);
|
||
}
|
||
gptn.addChild(groupRoot);
|
||
|
||
ActionTargetTreeNode actionTargetTreeNode = new ActionTargetTreeNode(gp.getId().toString(), module);
|
||
|
||
for (Object ob : gp.getActions()) {
|
||
String value = (String) ob;
|
||
ActionTreeNode actionTreeNode = new ActionTreeNode(value, value, gp.getId().toString(), module);
|
||
actionTargetTreeNode.addChild(actionTreeNode);
|
||
}
|
||
gptn.addChild(actionTargetTreeNode);
|
||
|
||
if (!module.equals(Module.adminModule)) {
|
||
Node filters = new Node("", NodeType.rulesNode, null, module, "id_group_query_1"); // NATIVE
|
||
|
||
BizStepRuleTreeNode bizStepRuleTreeNode = new BizStepRuleTreeNode(gp.getBizStepsFilterFunction(), gp.getId().toString(), module);
|
||
|
||
for (Object ob : gp.getBizSteps()) {
|
||
String value = (String) ob;
|
||
BizStepTreeNode treeNode = new BizStepTreeNode(value, value, gp.getId().toString(), module);
|
||
bizStepRuleTreeNode.addChild(treeNode);
|
||
}
|
||
filters.addChild(bizStepRuleTreeNode);
|
||
|
||
EventTypeRuleTreeNode eventTypeRuleTreeNode = new EventTypeRuleTreeNode(gp.getEventTypesFilterFunction(), gp.getId().toString(), module);
|
||
|
||
for (Object ob : gp.getEventTypes()) {
|
||
String value = (String) ob;
|
||
EventTypeTreeNode treeNode = new EventTypeTreeNode(value, value, gp.getId().toString(), module);
|
||
eventTypeRuleTreeNode.addChild(treeNode);
|
||
}
|
||
|
||
filters.addChild(eventTypeRuleTreeNode);
|
||
|
||
EpcsRuleTreeNode epcRuleTreeNode = new EpcsRuleTreeNode(gp.getEpcsFilterFunction(), gp.getId().toString(), module);
|
||
|
||
for (Object ob : gp.getEpcs()) {
|
||
String value = (String) ob;
|
||
EpcTreeNode treeNode = new EpcTreeNode(value, value, gp.getId().toString(), module);
|
||
epcRuleTreeNode.addChild(treeNode);
|
||
}
|
||
|
||
filters.addChild(epcRuleTreeNode);
|
||
|
||
EventTimeRuleTreeNode eventTimeRuleTreeNode = new EventTimeRuleTreeNode(gp.getEventTimesFilterFunction(), gp.getId().toString(), module);
|
||
|
||
for (Object ob : gp.getEventTimes()) {
|
||
List value = (List) ob;
|
||
EventTimeTreeNode treeNode = new EventTimeTreeNode((Date) value.get(0), (Date) value.get(1), gp.getId().toString(), module);
|
||
eventTimeRuleTreeNode.addChild(treeNode);
|
||
}
|
||
filters.addChild(eventTimeRuleTreeNode);
|
||
gptn.addChild(filters);
|
||
}
|
||
return gptn;
|
||
}
|
||
|
||
/**
|
||
* @return the policiesQuery
|
||
*/
|
||
public synchronized List<TreeNode> getPoliciesQuery() {
|
||
return policiesQuery;
|
||
}
|
||
|
||
/**
|
||
* @param policiesQuery the policiesQuery to set
|
||
*/
|
||
public synchronized void setPoliciesQuery(List<TreeNode> policiesQuery) {
|
||
this.policiesQuery = policiesQuery;
|
||
}
|
||
|
||
/**
|
||
* @return the policiesAdmin
|
||
*/
|
||
public synchronized List<TreeNode> getPoliciesAdmin() {
|
||
return policiesAdmin;
|
||
}
|
||
|
||
/**
|
||
* @param policiesAdmin the policiesAdmin to set
|
||
*/
|
||
public synchronized void setPoliciesAdmin(List<TreeNode> policiesAdmin) {
|
||
this.policiesAdmin = policiesAdmin;
|
||
}
|
||
|
||
/**
|
||
* @return the policiesCapture
|
||
*/
|
||
public synchronized List<TreeNode> getPoliciesCapture() {
|
||
return policiesCapture;
|
||
}
|
||
|
||
/**
|
||
* @param policiesCapture the policiesCapture to set
|
||
*/
|
||
public synchronized void setPoliciesCapture(List<TreeNode> policiesCapture) {
|
||
this.policiesCapture = policiesCapture;
|
||
}
|
||
}
|
DSeTa/DiscoveryPHI/src/main/java/fr/unicaen/iota/dphi/xacml/ihm/factory/ActionTargetTreeNode.java | ||
---|---|---|
/*
|
||
* This program is a part of the IoTa project.
|
||
*
|
||
* Copyright © 2008-2012 Université de Caen Basse-Normandie, GREYC
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation, either version 3 of the License, or
|
||
* (at your option) any later version.
|
||
*
|
||
* This program is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
* <http://www.gnu.org/licenses/>
|
||
*
|
||
* See AUTHORS for a list of contributors.
|
||
*/
|
||
package fr.unicaen.iota.dphi.xacml.ihm.factory;
|
||
|
||
import fr.unicaen.iota.dphi.xacml.ihm.Module;
|
||
import fr.unicaen.iota.dphi.xacml.ihm.NodeType;
|
||
import fr.unicaen.iota.dphi.xacml.ihm.TreeNode;
|
||
import java.util.ArrayList;
|
||
import java.util.List;
|
||
|
||
/**
|
||
*
|
||
*/
|
||
public class ActionTargetTreeNode implements TreeNode {
|
||
|
||
private List<TreeNode> children;
|
||
private String id;
|
||
private Module module;
|
||
private String groupID;
|
||
|
||
public ActionTargetTreeNode(String gID, Module m) {
|
||
children = new ArrayList<TreeNode>();
|
||
this.id = "Actions";
|
||
this.module = m;
|
||
this.groupID = gID;
|
||
}
|
||
|
||
@Override
|
||
public String getLabel() {
|
||
return "";
|
||
}
|
||
|
||
@Override
|
||
public NodeType getNodeType() {
|
||
return NodeType.methodFilterGroupNode;
|
||
}
|
||
|
||
@Override
|
||
public List<TreeNode> getChildren() {
|
||
return children;
|
||
}
|
||
|
||
@Override
|
||
public String getObjectID() {
|
||
return id;
|
||
}
|
||
|
||
@Override
|
||
public Module getModule() {
|
||
return module;
|
||
}
|
||
|
||
@Override
|
||
public String getGroupID() {
|
||
return groupID;
|
||
}
|
||
|
||
@Override
|
||
public void addChild(TreeNode child) {
|
||
children.add(child);
|
||
}
|
||
}
|
DSeTa/DiscoveryPHI/src/main/java/fr/unicaen/iota/dphi/xacml/ihm/factory/ActionTreeNode.java | ||
---|---|---|
/*
|
||
* This program is a part of the IoTa project.
|
||
*
|
||
* Copyright © 2008-2012 Université de Caen Basse-Normandie, GREYC
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation, either version 3 of the License, or
|
||
* (at your option) any later version.
|
||
*
|
||
* This program is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
* <http://www.gnu.org/licenses/>
|
||
*
|
||
* See AUTHORS for a list of contributors.
|
||
*/
|
||
package fr.unicaen.iota.dphi.xacml.ihm.factory;
|
||
|
||
import fr.unicaen.iota.dphi.xacml.ihm.Module;
|
||
import fr.unicaen.iota.dphi.xacml.ihm.NodeType;
|
||
import fr.unicaen.iota.dphi.xacml.ihm.TreeNode;
|
||
import java.util.ArrayList;
|
||
import java.util.List;
|
||
|
||
/**
|
||
*
|
||
*/
|
||
public class ActionTreeNode implements TreeNode {
|
||
|
||
private String value;
|
||
private String id;
|
||
private String groupID;
|
||
private Module module;
|
||
private List<TreeNode> children;
|
||
|
||
public ActionTreeNode(String v, String id, String gID, Module module) {
|
||
value = v;
|
||
this.id = id;
|
||
this.groupID = gID;
|
||
this.module = module;
|
||
this.children = new ArrayList<TreeNode>();
|
||
}
|
||
|
||
public String getValue() {
|
||
return value;
|
||
}
|
||
|
||
public void setValue(String value) {
|
||
this.value = value;
|
||
}
|
||
|
||
@Override
|
||
public String getLabel() {
|
||
return value;
|
||
}
|
||
|
||
@Override
|
||
public NodeType getNodeType() {
|
||
return NodeType.methodFilterNode;
|
||
}
|
||
|
||
@Override
|
||
public List<TreeNode> getChildren() {
|
||
return children;
|
||
}
|
||
|
||
@Override
|
||
public String getObjectID() {
|
||
return id;
|
||
}
|
||
|
||
@Override
|
||
public Module getModule() {
|
||
return module;
|
||
}
|
||
|
||
@Override
|
||
public String getGroupID() {
|
||
return groupID;
|
||
}
|
||
|
||
@Override
|
||
public void addChild(TreeNode child) {
|
||
children.add(child);
|
||
}
|
||
}
|
DSeTa/DiscoveryPHI/src/main/java/fr/unicaen/iota/dphi/xacml/ihm/factory/BizStepRuleTreeNode.java | ||
---|---|---|
/*
|
||
* This program is a part of the IoTa project.
|
||
*
|
||
* Copyright © 2008-2012 Université de Caen Basse-Normandie, GREYC
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation, either version 3 of the License, or
|
||
* (at your option) any later version.
|
||
*
|
||
* This program is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
* <http://www.gnu.org/licenses/>
|
||
*
|
||
* See AUTHORS for a list of contributors.
|
||
*/
|
||
package fr.unicaen.iota.dphi.xacml.ihm.factory;
|
||
|
||
import fr.unicaen.iota.xacml.cond.OneOrGlobalFunction;
|
||
import fr.unicaen.iota.dphi.xacml.ihm.Module;
|
||
import fr.unicaen.iota.xacml.policy.SCBizStepRule;
|
||
|
||
/**
|
||
*
|
||
*/
|
||
public class BizStepRuleTreeNode extends RuleTreeNode {
|
||
|
||
public BizStepRuleTreeNode(OneOrGlobalFunction f, String gID, Module m) {
|
||
super(f, gID, m);
|
||
id = SCBizStepRule.RULEFILTER;
|
||
}
|
||
}
|
DSeTa/DiscoveryPHI/src/main/java/fr/unicaen/iota/dphi/xacml/ihm/factory/BizStepTreeNode.java | ||
---|---|---|
/*
|
||
* This program is a part of the IoTa project.
|
||
*
|
||
* Copyright © 2008-2012 Université de Caen Basse-Normandie, GREYC
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation, either version 3 of the License, or
|
||
* (at your option) any later version.
|
||
*
|
||
* This program is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
* <http://www.gnu.org/licenses/>
|
||
*
|
||
* See AUTHORS for a list of contributors.
|
||
*/
|
||
package fr.unicaen.iota.dphi.xacml.ihm.factory;
|
||
|
||
import fr.unicaen.iota.dphi.xacml.ihm.Module;
|
||
import fr.unicaen.iota.dphi.xacml.ihm.NodeType;
|
||
import fr.unicaen.iota.dphi.xacml.ihm.TreeNode;
|
||
import java.util.ArrayList;
|
||
import java.util.List;
|
||
|
||
/**
|
||
*
|
||
*/
|
||
public class BizStepTreeNode implements TreeNode {
|
||
|
||
private String value;
|
||
private String id;
|
||
private String groupID;
|
||
private Module module;
|
||
private List<TreeNode> children;
|
||
|
||
public BizStepTreeNode(String v, String id, String gID, Module module) {
|
||
value = v;
|
||
this.id = id;
|
||
this.groupID = gID;
|
||
this.module = module;
|
||
this.children = new ArrayList<TreeNode>();
|
||
}
|
||
|
||
public String getValue() {
|
||
return value;
|
||
}
|
||
|
||
public void setValue(String value) {
|
||
this.value = value;
|
||
}
|
||
|
||
@Override
|
||
public String getLabel() {
|
||
return value;
|
||
}
|
||
|
||
@Override
|
||
public NodeType getNodeType() {
|
||
return NodeType.bizStepFilterNode;
|
||
}
|
||
|
||
@Override
|
||
public List<TreeNode> getChildren() {
|
||
return children;
|
||
}
|
||
|
||
@Override
|
||
public String getObjectID() {
|
||
return id;
|
||
}
|
||
|
||
@Override
|
||
public Module getModule() {
|
||
return module;
|
||
}
|
||
|
||
@Override
|
||
public String getGroupID() {
|
||
return groupID;
|
||
}
|
||
|
||
@Override
|
||
public void addChild(TreeNode child) {
|
||
children.add(child);
|
||
}
|
||
}
|
DSeTa/DiscoveryPHI/src/main/java/fr/unicaen/iota/dphi/xacml/ihm/factory/EpcTreeNode.java | ||
---|---|---|
/*
|
||
* This program is a part of the IoTa project.
|
||
*
|
||
* Copyright © 2008-2012 Université de Caen Basse-Normandie, GREYC
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation, either version 3 of the License, or
|
||
* (at your option) any later version.
|
||
*
|
||
* This program is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
* <http://www.gnu.org/licenses/>
|
||
*
|
||
* See AUTHORS for a list of contributors.
|
||
*/
|
||
package fr.unicaen.iota.dphi.xacml.ihm.factory;
|
||
|
||
import fr.unicaen.iota.dphi.xacml.ihm.Module;
|
||
import fr.unicaen.iota.dphi.xacml.ihm.NodeType;
|
||
import fr.unicaen.iota.dphi.xacml.ihm.TreeNode;
|
||
import java.util.ArrayList;
|
||
import java.util.List;
|
||
|
||
/**
|
||
*
|
||
*/
|
||
public class EpcTreeNode implements TreeNode {
|
||
|
||
private String value;
|
||
private String id;
|
||
private String groupID;
|
||
private Module module;
|
||
private List<TreeNode> children;
|
||
|
||
public EpcTreeNode(String v, String id, String gID, Module module) {
|
||
value = v;
|
||
this.id = id;
|
||
this.groupID = gID;
|
||
this.module = module;
|
||
this.children = new ArrayList<TreeNode>();
|
||
}
|
||
|
||
public String getValue() {
|
||
return value;
|
||
}
|
||
|
||
public void setValue(String value) {
|
||
this.value = value;
|
||
}
|
||
|
||
@Override
|
||
public String getLabel() {
|
||
return value;
|
||
}
|
||
|
||
@Override
|
||
public NodeType getNodeType() {
|
||
return NodeType.epcFilterNode;
|
||
}
|
||
|
||
@Override
|
||
public List<TreeNode> getChildren() {
|
||
return children;
|
||
}
|
||
|
||
@Override
|
||
public String getObjectID() {
|
||
return id;
|
||
}
|
||
|
||
@Override
|
||
public Module getModule() {
|
||
return module;
|
||
}
|
||
|
||
@Override
|
||
public String getGroupID() {
|
||
return groupID;
|
||
}
|
||
|
||
@Override
|
||
public void addChild(TreeNode child) {
|
||
children.add(child);
|
||
}
|
||
}
|
DSeTa/DiscoveryPHI/src/main/java/fr/unicaen/iota/dphi/xacml/ihm/factory/EpcsRuleTreeNode.java | ||
---|---|---|
/*
|
||
* This program is a part of the IoTa project.
|
||
*
|
||
* Copyright © 2008-2012 Université de Caen Basse-Normandie, GREYC
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation, either version 3 of the License, or
|
||
* (at your option) any later version.
|
||
*
|
||
* This program is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
* <http://www.gnu.org/licenses/>
|
||
*
|
||
* See AUTHORS for a list of contributors.
|
||
*/
|
||
package fr.unicaen.iota.dphi.xacml.ihm.factory;
|
||
|
||
import fr.unicaen.iota.xacml.cond.OneOrGlobalFunction;
|
||
import fr.unicaen.iota.dphi.xacml.ihm.Module;
|
||
import fr.unicaen.iota.xacml.policy.SCEPCsRule;
|
||
|
||
/**
|
||
*
|
||
*/
|
||
public class EpcsRuleTreeNode extends RuleTreeNode {
|
||
|
||
public EpcsRuleTreeNode(OneOrGlobalFunction f, String gID, Module m) {
|
||
super(f, gID, m);
|
||
id = SCEPCsRule.RULEFILTER;
|
||
}
|
||
}
|
DSeTa/DiscoveryPHI/src/main/java/fr/unicaen/iota/dphi/xacml/ihm/factory/EventTimeRuleTreeNode.java | ||
---|---|---|
/*
|
||
* This program is a part of the IoTa project.
|
||
*
|
||
* Copyright © 2008-2012 Université de Caen Basse-Normandie, GREYC
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation, either version 3 of the License, or
|
||
* (at your option) any later version.
|
||
*
|
||
* This program is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
* <http://www.gnu.org/licenses/>
|
||
*
|
||
* See AUTHORS for a list of contributors.
|
||
*/
|
||
package fr.unicaen.iota.dphi.xacml.ihm.factory;
|
||
|
||
import fr.unicaen.iota.xacml.cond.OneOrGlobalFunction;
|
||
import fr.unicaen.iota.dphi.xacml.ihm.Module;
|
||
import fr.unicaen.iota.xacml.policy.SCEventTimeRule;
|
||
|
||
/**
|
||
*
|
||
*/
|
||
public class EventTimeRuleTreeNode extends RuleTreeNode {
|
||
|
||
public EventTimeRuleTreeNode(OneOrGlobalFunction f, String gID, Module m) {
|
||
super(f, gID, m);
|
||
id = SCEventTimeRule.RULEFILTER;
|
||
}
|
||
}
|
DSeTa/DiscoveryPHI/src/main/java/fr/unicaen/iota/dphi/xacml/ihm/factory/EventTimeTreeNode.java | ||
---|---|---|
/*
|
||
* This program is a part of the IoTa project.
|
||
*
|
||
* Copyright © 2008-2012 Université de Caen Basse-Normandie, GREYC
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation, either version 3 of the License, or
|
||
* (at your option) any later version.
|
||
*
|
||
* This program is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
* <http://www.gnu.org/licenses/>
|
||
*
|
||
* See AUTHORS for a list of contributors.
|
||
*/
|
||
package fr.unicaen.iota.dphi.xacml.ihm.factory;
|
||
|
||
import fr.unicaen.iota.dphi.xacml.ihm.Module;
|
||
import fr.unicaen.iota.dphi.xacml.ihm.NodeType;
|
||
import fr.unicaen.iota.dphi.xacml.ihm.TreeNode;
|
||
import java.util.ArrayList;
|
||
import java.util.Calendar;
|
||
import java.util.Date;
|
||
import java.util.List;
|
||
|
||
/**
|
||
*
|
||
*/
|
||
public class EventTimeTreeNode implements TreeNode {
|
||
|
||
private Date minDate;
|
||
private Date maxDate;
|
||
private List<TreeNode> children;
|
||
private String groupID;
|
||
private Module module;
|
||
private String id;
|
||
|
||
public Date getMaxDate() {
|
||
return maxDate;
|
||
}
|
||
|
||
public void setMaxDate(Date maxDate) {
|
||
this.maxDate = maxDate;
|
||
}
|
||
|
||
public Date getMinDate() {
|
||
return minDate;
|
||
}
|
||
|
||
public void setMinDate(Date minDate) {
|
||
this.minDate = minDate;
|
||
}
|
||
|
||
public EventTimeTreeNode(Date minD, Date maxD, String gID, Module m) {
|
||
maxDate = maxD;
|
||
minDate = minD;
|
||
this.id = getLabel();
|
||
this.groupID = gID;
|
||
this.module = m;
|
||
this.children = new ArrayList<TreeNode>();
|
||
}
|
||
|
||
@Override
|
||
public String getLabel() {
|
||
Calendar calMin = Calendar.getInstance();
|
||
calMin.setTime(minDate);
|
||
Calendar calMax = Calendar.getInstance();
|
||
calMax.setTime(maxDate);
|
||
return String.format("%1$tm/%1$td/%1$tY -> %2$tm/%2$td/%2$tY", calMin, calMax);
|
||
}
|
||
|
||
@Override
|
||
public NodeType getNodeType() {
|
||
return NodeType.eventTimeFilterNode;
|
||
}
|
||
|
||
@Override
|
||
public List<TreeNode> getChildren() {
|
||
return children;
|
||
}
|
||
|
||
@Override
|
||
public String getObjectID() {
|
||
return id;
|
||
}
|
||
|
||
@Override
|
||
public Module getModule() {
|
||
return module;
|
||
}
|
||
|
||
@Override
|
||
public String getGroupID() {
|
||
return groupID;
|
||
}
|
||
|
||
@Override
|
||
public void addChild(TreeNode child) {
|
||
this.children.add(child);
|
||
}
|
||
}
|
DSeTa/DiscoveryPHI/src/main/java/fr/unicaen/iota/dphi/xacml/ihm/factory/EventTypeRuleTreeNode.java | ||
---|---|---|
/*
|
||
* This program is a part of the IoTa project.
|
||
*
|
||
* Copyright © 2008-2012 Université de Caen Basse-Normandie, GREYC
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation, either version 3 of the License, or
|
||
* (at your option) any later version.
|
||
*
|
||
* This program is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
* <http://www.gnu.org/licenses/>
|
||
*
|
||
* See AUTHORS for a list of contributors.
|
||
*/
|
||
package fr.unicaen.iota.dphi.xacml.ihm.factory;
|
||
|
||
import fr.unicaen.iota.xacml.cond.OneOrGlobalFunction;
|
||
import fr.unicaen.iota.dphi.xacml.ihm.Module;
|
||
import fr.unicaen.iota.xacml.policy.SCEventTypeRule;
|
||
|
||
/**
|
||
*
|
||
*/
|
||
public class EventTypeRuleTreeNode extends RuleTreeNode {
|
||
|
||
public EventTypeRuleTreeNode(OneOrGlobalFunction f, String gID, Module m) {
|
||
super(f, gID, m);
|
||
id = SCEventTypeRule.RULEFILTER;
|
||
}
|
||
}
|
DSeTa/DiscoveryPHI/src/main/java/fr/unicaen/iota/dphi/xacml/ihm/factory/EventTypeTreeNode.java | ||
---|---|---|
/*
|
||
* This program is a part of the IoTa project.
|
||
*
|
||
* Copyright © 2008-2012 Université de Caen Basse-Normandie, GREYC
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation, either version 3 of the License, or
|
||
* (at your option) any later version.
|
||
*
|
||
* This program is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
* <http://www.gnu.org/licenses/>
|
||
*
|
||
* See AUTHORS for a list of contributors.
|
||
*/
|
||
package fr.unicaen.iota.dphi.xacml.ihm.factory;
|
||
|
||
import fr.unicaen.iota.dphi.xacml.ihm.Module;
|
||
import fr.unicaen.iota.dphi.xacml.ihm.NodeType;
|
||
import fr.unicaen.iota.dphi.xacml.ihm.TreeNode;
|
||
import java.util.ArrayList;
|
||
import java.util.List;
|
||
|
||
/**
|
||
*
|
||
*/
|
||
public class EventTypeTreeNode implements TreeNode {
|
||
|
||
private String value;
|
||
private String id;
|
||
private String groupID;
|
||
private Module module;
|
||
private List<TreeNode> children;
|
||
|
||
public EventTypeTreeNode(String v, String id, String gID, Module module) {
|
||
value = v;
|
||
this.id = id;
|
||
this.groupID = gID;
|
||
this.module = module;
|
||
this.children = new ArrayList<TreeNode>();
|
||
}
|
||
|
||
public String getValue() {
|
||
return value;
|
||
}
|
||
|
||
public void setValue(String value) {
|
||
this.value = value;
|
||
}
|
||
|
||
@Override
|
||
public String getLabel() {
|
||
return value;
|
||
}
|
||
|
||
@Override
|
||
public NodeType getNodeType() {
|
||
return NodeType.eventTypeFilterNode;
|
||
}
|
||
|
||
@Override
|
||
public List<TreeNode> getChildren() {
|
||
return children;
|
||
}
|
||
|
||
@Override
|
||
public String getObjectID() {
|
||
return id;
|
||
}
|
||
|
||
@Override
|
||
public Module getModule() {
|
||
return module;
|
||
}
|
||
|
||
@Override
|
||
public String getGroupID() {
|
||
return groupID;
|
||
}
|
||
|
||
@Override
|
||
public void addChild(TreeNode child) {
|
||
children.add(child);
|
||
}
|
||
}
|
DSeTa/DiscoveryPHI/src/main/java/fr/unicaen/iota/dphi/xacml/ihm/factory/GroupPolicyTreeNode.java | ||
---|---|---|
/*
|
||
* This program is a part of the IoTa project.
|
||
*
|
||
* Copyright © 2008-2012 Université de Caen Basse-Normandie, GREYC
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation, either version 3 of the License, or
|
||
* (at your option) any later version.
|
||
*
|
||
* This program is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
* <http://www.gnu.org/licenses/>
|
||
*
|
||
* See AUTHORS for a list of contributors.
|
||
*/
|
||
package fr.unicaen.iota.dphi.xacml.ihm.factory;
|
||
|
||
import fr.unicaen.iota.dphi.xacml.ihm.Module;
|
||
import fr.unicaen.iota.dphi.xacml.ihm.NodeType;
|
||
import fr.unicaen.iota.dphi.xacml.ihm.TreeNode;
|
||
import fr.unicaen.iota.xacml.policy.GroupPolicy;
|
||
import java.util.ArrayList;
|
||
import java.util.List;
|
||
|
||
/**
|
||
*
|
||
*/
|
||
public class GroupPolicyTreeNode implements TreeNode {
|
||
|
||
private GroupPolicy groupPolicy;
|
||
private List nodeChildren;
|
||
private String groupID;
|
||
private Module module;
|
||
|
||
public GroupPolicy getGroupPolicy() {
|
||
return groupPolicy;
|
||
}
|
||
|
||
public GroupPolicyTreeNode(GroupPolicy gp, String groupID, Module module) {
|
||
this.groupPolicy = gp;
|
||
this.groupID = groupID;
|
||
this.module = module;
|
||
this.nodeChildren = new ArrayList();
|
||
}
|
||
|
||
@Override
|
||
public String getLabel() {
|
||
return groupPolicy.getName();
|
||
}
|
||
|
||
@Override
|
||
public NodeType getNodeType() {
|
||
return NodeType.policyNode;
|
||
}
|
||
|
||
@Override
|
||
public List<TreeNode> getChildren() {
|
||
return nodeChildren;
|
||
}
|
||
|
||
@Override
|
||
public String getObjectID() {
|
||
return groupID;
|
||
}
|
||
|
||
@Override
|
||
public Module getModule() {
|
||
return module;
|
||
}
|
||
|
||
@Override
|
||
public String getGroupID() {
|
||
return groupID;
|
||
}
|
||
|
||
@Override
|
||
public void addChild(TreeNode child) {
|
||
nodeChildren.add(child);
|
||
}
|
||
}
|
DSeTa/DiscoveryPHI/src/main/java/fr/unicaen/iota/dphi/xacml/ihm/factory/Node.java | ||
---|---|---|
/*
|
||
* This program is a part of the IoTa project.
|
||
*
|
||
* Copyright © 2008-2012 Université de Caen Basse-Normandie, GREYC
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation, either version 3 of the License, or
|
||
* (at your option) any later version.
|
||
*
|
||
* This program is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
* <http://www.gnu.org/licenses/>
|
||
*
|
||
* See AUTHORS for a list of contributors.
|
||
*/
|
||
package fr.unicaen.iota.dphi.xacml.ihm.factory;
|
||
|
||
import fr.unicaen.iota.dphi.xacml.ihm.Module;
|
||
import fr.unicaen.iota.dphi.xacml.ihm.NodeType;
|
||
import fr.unicaen.iota.dphi.xacml.ihm.TreeNode;
|
||
import java.util.ArrayList;
|
||
import java.util.List;
|
||
|
||
/**
|
||
*
|
||
*/
|
||
public class Node implements TreeNode {
|
||
|
||
private String value;
|
||
private NodeType nodeType;
|
||
private List<TreeNode> children;
|
||
private String objectID;
|
||
private Module module;
|
||
private String groupID;
|
||
|
||
public Node(String value, NodeType type, String id, Module module, String groupID) {
|
||
this.value = value;
|
||
this.nodeType = type;
|
||
this.children = new ArrayList<TreeNode>();
|
||
this.objectID = id;
|
||
this.module = module;
|
||
this.groupID = groupID;
|
||
}
|
||
|
||
@Override
|
||
public void addChild(TreeNode node) {
|
||
children.add(node);
|
||
}
|
||
|
||
@Override
|
||
public String getLabel() {
|
||
return value;
|
||
}
|
||
|
||
@Override
|
||
public NodeType getNodeType() {
|
||
return nodeType;
|
||
}
|
||
|
||
@Override
|
||
public List<TreeNode> getChildren() {
|
||
return children;
|
||
}
|
||
|
||
@Override
|
||
public String getObjectID() {
|
||
return objectID;
|
||
}
|
||
|
||
@Override
|
||
public Module getModule() {
|
||
return module;
|
||
}
|
||
|
||
@Override
|
||
public String getGroupID() {
|
||
return groupID;
|
||
}
|
||
}
|
DSeTa/DiscoveryPHI/src/main/java/fr/unicaen/iota/dphi/xacml/ihm/factory/Policies.java | ||
---|---|---|
/*
|
||
* This program is a part of the IoTa project.
|
||
*
|
||
* Copyright © 2008-2012 Université de Caen Basse-Normandie, GREYC
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation, either version 3 of the License, or
|
||
* (at your option) any later version.
|
||
*
|
||
* This program is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
* <http://www.gnu.org/licenses/>
|
||
*
|
||
* See AUTHORS for a list of contributors.
|
||
*/
|
||
package fr.unicaen.iota.dphi.xacml.ihm.factory;
|
||
|
||
import fr.unicaen.iota.dphi.xacml.ihm.Module;
|
||
import fr.unicaen.iota.dphi.xacml.ihm.NodeType;
|
||
import fr.unicaen.iota.dphi.xacml.ihm.TreeNode;
|
||
import java.util.ArrayList;
|
||
import java.util.List;
|
||
|
||
/**
|
||
*
|
||
*/
|
||
public class Policies {
|
||
|
||
public List<TreeNode> policiesQuery = new ArrayList<TreeNode>();
|
||
public List<TreeNode> policiesAdmin = new ArrayList<TreeNode>();
|
||
public List<TreeNode> policiesCapture = new ArrayList<TreeNode>();
|
||
|
||
public Policies() {
|
||
createQueryPolicies();
|
||
createAdminPolicies();
|
||
createCapturePolicies();
|
||
}
|
||
|
||
private void createQueryPolicies() {
|
||
Node policy1 = new Node("group_query_1", NodeType.policyNode, null, Module.queryModule, "id_group_query_1");
|
||
|
||
Node users = new Node("Associated users:", NodeType.usersNode, null, Module.queryModule, "id_group_query_1"); // NATIVE
|
||
users.addChild(new Node("user1", NodeType.userNode, null, Module.queryModule, "id_group_query_1"));
|
||
users.addChild(new Node("user2", NodeType.userNode, null, Module.queryModule, "id_group_query_1"));
|
||
users.addChild(new Node("user3", NodeType.userNode, null, Module.queryModule, "id_group_query_1"));
|
||
|
||
Node filters = new Node("Restricted filters", NodeType.rulesNode, null, Module.queryModule, "id_group_query_1"); // NATIVE
|
||
|
||
Node rule1 = new Node("ACCEPT", NodeType.bizStepFilterGroupNode, null, Module.queryModule, "id_group_query_1");
|
||
Node filter1 = new Node("blablabla", NodeType.bizStepFilterNode, null, Module.queryModule, "id_group_query_1");
|
||
Node filter2 = new Node("bliblibli", NodeType.bizStepFilterNode, null, Module.queryModule, "id_group_query_1");
|
||
Node filter3 = new Node("blobloblo", NodeType.bizStepFilterNode, null, Module.queryModule, "id_group_query_1");
|
||
rule1.addChild(filter1);
|
||
rule1.addChild(filter2);
|
||
rule1.addChild(filter3);
|
||
|
||
Node rule2 = new Node("DROP", NodeType.epcFilterGroupNode, null, Module.queryModule, "id_group_query_1");
|
||
Node filter21 = new Node("clacclac", NodeType.epcFilterNode, null, Module.queryModule, "id_group_query_1");
|
||
Node filter22 = new Node("clicclic", NodeType.epcFilterNode, null, Module.queryModule, "id_group_query_1");
|
||
rule2.addChild(filter21);
|
||
rule2.addChild(filter22);
|
||
|
||
Node rule3 = new Node("DROP", NodeType.eventTypeFilterGroupNode, null, Module.queryModule, "id_group_query_1");
|
||
Node rule4 = new Node("DROP", NodeType.eventTimeFilterGroupNode, null, Module.queryModule, "id_group_query_1");
|
||
|
||
filters.addChild(rule1);
|
||
filters.addChild(rule2);
|
||
filters.addChild(rule3);
|
||
filters.addChild(rule4);
|
||
|
||
policy1.addChild(users);
|
||
policy1.addChild(filters);
|
||
|
||
Node policy2 = new Node("group_query_2", NodeType.policyNode, null, Module.queryModule, "id_group_query_2");
|
||
|
||
Node users2 = new Node("Associated users:", NodeType.usersNode, null, Module.queryModule, "id_group_query_2");
|
||
users2.addChild(new Node("userx", NodeType.userNode, null, Module.queryModule, "id_group_query_2"));
|
||
users2.addChild(new Node("usery", NodeType.userNode, null, Module.queryModule, "id_group_query_2"));
|
||
users2.addChild(new Node("userz", NodeType.userNode, null, Module.queryModule, "id_group_query_2"));
|
||
users2.addChild(new Node("useru", NodeType.userNode, null, Module.queryModule, "id_group_query_2"));
|
||
users2.addChild(new Node("userv", NodeType.userNode, null, Module.queryModule, "id_group_query_2"));
|
||
users2.addChild(new Node("userw", NodeType.userNode, null, Module.queryModule, "id_group_query_2"));
|
||
|
||
policy2.addChild(users2);
|
||
|
||
Node policies = new Node("Groups", NodeType.policiesNode, null, Module.queryModule, null); // NATIVE
|
||
|
||
policies.addChild(policy1);
|
||
policies.addChild(policy2);
|
||
policiesQuery.add(policies);
|
||
}
|
||
|
||
private void createAdminPolicies() {
|
||
Node policy1 = new Node("group_admin_1", NodeType.policyNode, null, Module.adminModule, "id_group_admin_1");
|
||
|
||
Node users = new Node("Associated users", NodeType.usersNode, null, Module.adminModule, "id_group_admin_1");
|
||
users.addChild(new Node("user1", NodeType.userNode, null, Module.adminModule, "id_group_admin_1"));
|
||
users.addChild(new Node("user3", NodeType.userNode, null, Module.adminModule, "id_group_admin_1"));
|
||
|
||
Node rule1 = new Node("ACCEPT", NodeType.methodFilterGroupNode, null, Module.adminModule, "id_group_admin_1");
|
||
Node filter1 = new Node("eventCreate", NodeType.methodFilterNode, null, Module.adminModule, "id_group_admin_1");
|
||
Node filter2 = new Node("filterCreate", NodeType.methodFilterNode, null, Module.adminModule, "id_group_admin_1");
|
||
rule1.addChild(filter1);
|
||
rule1.addChild(filter2);
|
||
|
||
policy1.addChild(users);
|
||
policy1.addChild(rule1);
|
||
|
||
Node policy2 = new Node("group_admin_2", NodeType.policyNode, null, Module.adminModule, "id_group_admin_2");
|
||
|
||
Node users2 = new Node("Associated users", NodeType.usersNode, null, Module.adminModule, "id_group_admin_2");
|
||
users2.addChild(new Node("userx", NodeType.userNode, null, Module.adminModule, "id_group_admin_2"));
|
||
users2.addChild(new Node("userz", NodeType.userNode, null, Module.adminModule, "id_group_admin_2"));
|
||
users2.addChild(new Node("useru", NodeType.userNode, null, Module.adminModule, "id_group_admin_2"));
|
||
users2.addChild(new Node("userv", NodeType.userNode, null, Module.adminModule, "id_group_admin_2"));
|
||
users2.addChild(new Node("userw", NodeType.userNode, null, Module.adminModule, "id_group_admin_2"));
|
||
|
||
Node rule2 = new Node("DROP", NodeType.methodFilterGroupNode, null, Module.adminModule, "id_group_admin_2");
|
||
Node filter21 = new Node("groupCreate", NodeType.methodFilterNode, null, Module.adminModule, "id_group_admin_2");
|
||
Node filter22 = new Node("groupUpdate", NodeType.methodFilterNode, null, Module.adminModule, "id_group_admin_2");
|
||
rule2.addChild(filter21);
|
||
rule2.addChild(filter22);
|
||
|
||
policy2.addChild(rule2);
|
||
policy2.addChild(users2);
|
||
|
||
Node policies = new Node("Groups", NodeType.policiesNode, null, Module.adminModule, null);
|
||
|
||
policies.addChild(policy1);
|
||
policies.addChild(policy2);
|
||
policiesAdmin.add(policies);
|
||
|
||
}
|
||
|
||
private void createCapturePolicies() {
|
||
Node policies = new Node("Groups", NodeType.policiesNode, null, Module.captureModule, null);
|
||
policiesCapture.add(policies);
|
||
}
|
||
}
|
DSeTa/DiscoveryPHI/src/main/java/fr/unicaen/iota/dphi/xacml/ihm/factory/RuleTreeNode.java | ||
---|---|---|
/*
|
||
* This program is a part of the IoTa project.
|
||
*
|
||
* Copyright © 2008-2012 Université de Caen Basse-Normandie, GREYC
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation, either version 3 of the License, or
|
||
* (at your option) any later version.
|
||
*
|
||
* This program is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
* <http://www.gnu.org/licenses/>
|
||
*
|
||
* See AUTHORS for a list of contributors.
|
||
*/
|
||
package fr.unicaen.iota.dphi.xacml.ihm.factory;
|
||
|
||
import fr.unicaen.iota.xacml.cond.OneOrGlobalFunction;
|
||
import fr.unicaen.iota.dphi.xacml.ihm.Module;
|
||
import fr.unicaen.iota.dphi.xacml.ihm.NodeType;
|
||
import fr.unicaen.iota.dphi.xacml.ihm.TreeNode;
|
||
import fr.unicaen.iota.xacml.policy.*;
|
||
import java.util.ArrayList;
|
||
import java.util.List;
|
||
|
||
/**
|
||
*
|
||
*/
|
||
public class RuleTreeNode implements TreeNode {
|
||
|
||
private OneOrGlobalFunction function;
|
||
protected String id;
|
||
private List<TreeNode> children;
|
||
private Module module;
|
||
private String groupID;
|
||
|
||
public String getId() {
|
||
return id;
|
||
}
|
||
|
||
public OneOrGlobalFunction getFunction() {
|
||
return function;
|
||
}
|
||
|
||
public RuleTreeNode(OneOrGlobalFunction f, String groupID, Module m) {
|
||
this.function = f;
|
||
this.groupID = groupID;
|
||
this.module = m;
|
||
this.children = new ArrayList<TreeNode>();
|
||
}
|
||
|
||
@Override
|
||
public String getLabel() {
|
||
if (function.getFunctionName().equals(OneOrGlobalFunction.NAME_GLOBAL_PERMIT)) {
|
||
return "ACCEPT";
|
||
} else if (function.getFunctionName().equals(OneOrGlobalFunction.NAME_GLOBAL_DENY)) {
|
||
return "DENY";
|
||
}
|
||
return "";
|
||
}
|
||
|
||
@Override
|
||
public NodeType getNodeType() {
|
||
if (SCBizStepRule.RULEFILTER.equals(id)) {
|
||
return NodeType.bizStepFilterGroupNode;
|
||
} else if (SCEventTypeRule.RULEFILTER.equals(id)) {
|
||
return NodeType.eventTypeFilterGroupNode;
|
||
} else if (SCEPCsRule.RULEFILTER.equals(id)) {
|
||
return NodeType.epcFilterGroupNode;
|
||
} else if (SCEventTimeRule.RULEFILTER.equals(id)) {
|
||
return NodeType.eventTimeFilterGroupNode;
|
||
} else if (SCgroupRule.RULEFILTER.equals(id)) {
|
||
return NodeType.usersNode;
|
||
}
|
||
return null;
|
||
}
|
||
|
||
@Override
|
||
public List<TreeNode> getChildren() {
|
||
return children;
|
||
}
|
||
|
||
@Override
|
||
public String getObjectID() {
|
||
return id;
|
||
}
|
||
|
||
@Override
|
||
public Module getModule() {
|
||
return module;
|
||
}
|
||
|
||
@Override
|
||
public String getGroupID() {
|
||
return groupID;
|
||
}
|
||
|
||
@Override
|
||
public void addChild(TreeNode child) {
|
||
this.children.add(child);
|
||
}
|
||
}
|
DSeTa/DiscoveryPHI/src/main/java/fr/unicaen/iota/dphi/xacml/ihm/factory/UserGroupRuleTreeNode.java | ||
---|---|---|
/*
|
||
* This program is a part of the IoTa project.
|
||
*
|
||
* Copyright © 2008-2012 Université de Caen Basse-Normandie, GREYC
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation, either version 3 of the License, or
|
||
* (at your option) any later version.
|
||
*
|
||
* This program is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
* <http://www.gnu.org/licenses/>
|
||
*
|
||
* See AUTHORS for a list of contributors.
|
||
*/
|
||
package fr.unicaen.iota.dphi.xacml.ihm.factory;
|
||
|
||
import fr.unicaen.iota.xacml.cond.OneOrGlobalFunction;
|
||
import fr.unicaen.iota.dphi.xacml.ihm.Module;
|
||
import fr.unicaen.iota.xacml.policy.SCgroupRule;
|
||
|
||
/**
|
||
*
|
||
*/
|
||
public class UserGroupRuleTreeNode extends RuleTreeNode {
|
||
|
||
public UserGroupRuleTreeNode(OneOrGlobalFunction f, String gID, Module m) {
|
||
super(f, gID, m);
|
||
id = SCgroupRule.RULEFILTER;
|
||
}
|
||
}
|
DSeTa/DiscoveryPHI/src/main/java/fr/unicaen/iota/dphi/xacml/ihm/factory/UserTreeNode.java | ||
---|---|---|
/*
|
||
* This program is a part of the IoTa project.
|
||
*
|
||
* Copyright © 2008-2012 Université de Caen Basse-Normandie, GREYC
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation, either version 3 of the License, or
|
||
* (at your option) any later version.
|
||
*
|
||
* This program is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
* <http://www.gnu.org/licenses/>
|
||
*
|
||
* See AUTHORS for a list of contributors.
|
||
*/
|
||
package fr.unicaen.iota.dphi.xacml.ihm.factory;
|
||
|
||
import fr.unicaen.iota.dphi.xacml.ihm.Module;
|
||
import fr.unicaen.iota.dphi.xacml.ihm.NodeType;
|
||
import fr.unicaen.iota.dphi.xacml.ihm.TreeNode;
|
||
import java.util.ArrayList;
|
||
import java.util.List;
|
||
|
||
/**
|
||
*
|
||
*/
|
||
public class UserTreeNode implements TreeNode {
|
||
|
||
private String value;
|
||
private String id;
|
||
private String groupID;
|
||
private Module module;
|
||
private List<TreeNode> children;
|
||
|
||
public UserTreeNode(String v, String id, String gID, Module module) {
|
||
value = v;
|
||
this.id = id;
|
||
this.groupID = gID;
|
||
this.module = module;
|
||
this.children = new ArrayList<TreeNode>();
|
||
}
|
||
|
||
public String getValue() {
|
||
return value;
|
||
}
|
||
|
||
public void setValue(String value) {
|
||
this.value = value;
|
||
}
|
||
|
||
@Override
|
||
public String getLabel() {
|
||
return value;
|
||
}
|
||
|
||
@Override
|
||
public NodeType getNodeType() {
|
||
return NodeType.userNode;
|
||
}
|
||
|
||
@Override
|
||
public List<TreeNode> getChildren() {
|
||
return children;
|
||
}
|
||
|
||
@Override
|
||
public String getObjectID() {
|
||
return id;
|
||
}
|
||
|
||
@Override
|
||
public Module getModule() {
|
||
return module;
|
||
}
|
||
|
||
@Override
|
||
public String getGroupID() {
|
||
return groupID;
|
||
}
|
||
|
||
@Override
|
||
public void addChild(TreeNode child) {
|
||
children.add(child);
|
||
}
|
||
}
|
DSeTa/DiscoveryPHI/src/main/java/fr/unicaen/iota/dphi/xacml/ihm/test/AccessResponse.form | ||
---|---|---|
<?xml version="1.0" encoding="UTF-8" ?>
|
||
|
||
<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
|
||
<Properties>
|
||
<Property name="defaultCloseOperation" type="int" value="2"/>
|
||
</Properties>
|
||
<SyntheticProperties>
|
||
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
|
||
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
|
||
</SyntheticProperties>
|
||
<AuxValues>
|
||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||
</AuxValues>
|
||
|
||
<Layout>
|
||
<DimensionLayout dim="0">
|
||
<Group type="103" groupAlignment="0" attributes="0">
|
||
<Group type="102" attributes="0">
|
||
<Group type="103" groupAlignment="0" attributes="0">
|
||
<Group type="102" alignment="0" attributes="0">
|
||
<EmptySpace min="-2" pref="17" max="-2" attributes="0"/>
|
||
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
|
||
</Group>
|
||
<Group type="102" alignment="0" attributes="0">
|
||
<EmptySpace min="-2" pref="38" max="-2" attributes="0"/>
|
||
<Component id="responseLabel" min="-2" max="-2" attributes="0"/>
|
||
</Group>
|
||
</Group>
|
||
<EmptySpace max="32767" attributes="0"/>
|
||
</Group>
|
||
</Group>
|
||
</DimensionLayout>
|
||
<DimensionLayout dim="1">
|
||
<Group type="103" groupAlignment="0" attributes="0">
|
||
<Group type="102" alignment="0" attributes="0">
|
||
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
|
||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||
<Component id="responseLabel" min="-2" max="-2" attributes="0"/>
|
||
<EmptySpace max="32767" attributes="0"/>
|
||
</Group>
|
||
</Group>
|
||
</DimensionLayout>
|
||
</Layout>
|
||
<SubComponents>
|
||
<Component class="javax.swing.JLabel" name="responseLabel">
|
||
<Properties>
|
||
<Property name="text" type="java.lang.String" value="Response"/>
|
||
<Property name="horizontalTextPosition" type="int" value="0"/>
|
||
</Properties>
|
||
</Component>
|
||
<Component class="javax.swing.JLabel" name="jLabel2">
|
||
<Properties>
|
||
<Property name="text" type="java.lang.String" value="Access Response"/>
|
||
</Properties>
|
||
</Component>
|
||
</SubComponents>
|
||
</Form>
|
DSeTa/DiscoveryPHI/src/main/java/fr/unicaen/iota/dphi/xacml/ihm/test/AccessResponse.java | ||
---|---|---|
/*
|
||
* This program is a part of the IoTa project.
|
||
*
|
||
* Copyright © 2008-2012 Université de Caen Basse-Normandie, GREYC
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation, either version 3 of the License, or
|
||
* (at your option) any later version.
|
||
*
|
||
* This program is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
* <http://www.gnu.org/licenses/>
|
||
*
|
||
* See AUTHORS for a list of contributors.
|
||
*/
|
||
package fr.unicaen.iota.dphi.xacml.ihm.test;
|
||
|
||
/**
|
||
*
|
||
*/
|
||
public class AccessResponse extends javax.swing.JDialog {
|
||
|
||
/**
|
||
* Creates new form AccessResponse
|
||
*/
|
||
public AccessResponse(java.awt.Frame parent, boolean modal) {
|
||
super(parent, modal);
|
||
initComponents();
|
||
}
|
||
|
||
/**
|
||
* This method is called from within the constructor to initialize the form.
|
||
* WARNING: Do NOT modify this code. The content of this method is always
|
||
* regenerated by the Form Editor.
|
||
*/
|
||
@SuppressWarnings("unchecked")
|
||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||
private void initComponents() {
|
||
|
||
responseLabel = new javax.swing.JLabel();
|
||
jLabel2 = new javax.swing.JLabel();
|
||
|
||
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
|
||
|
||
responseLabel.setText("Response");
|
||
responseLabel.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
||
|
||
jLabel2.setText("Access Response");
|
||
|
||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||
getContentPane().setLayout(layout);
|
||
layout.setHorizontalGroup(
|
||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||
.addGroup(layout.createSequentialGroup()
|
||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||
.addGroup(layout.createSequentialGroup()
|
||
.addGap(17, 17, 17)
|
||
.addComponent(jLabel2))
|
||
.addGroup(layout.createSequentialGroup()
|
||
.addGap(38, 38, 38)
|
||
.addComponent(responseLabel)))
|
||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||
);
|
||
layout.setVerticalGroup(
|
||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||
.addGroup(layout.createSequentialGroup()
|
||
.addComponent(jLabel2)
|
||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||
.addComponent(responseLabel)
|
||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||
);
|
||
|
||
pack();
|
||
}// </editor-fold>//GEN-END:initComponents
|
||
|
||
/**
|
||
* @param args the command line arguments
|
||
*/
|
||
public static void main(String args[]) {
|
||
java.awt.EventQueue.invokeLater(new Runnable() {
|
||
|
||
@Override
|
||
public void run() {
|
||
AccessResponse dialog = new AccessResponse(new javax.swing.JFrame(), true);
|
||
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
|
||
|
||
@Override
|
||
public void windowClosing(java.awt.event.WindowEvent e) {
|
||
System.exit(0);
|
||
}
|
||
});
|
||
dialog.setVisible(true);
|
||
}
|
||
});
|
||
}
|
||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||
private javax.swing.JLabel jLabel2;
|
||
private javax.swing.JLabel responseLabel;
|
||
// End of variables declaration//GEN-END:variables
|
||
}
|
DSeTa/DiscoveryPHI/src/main/java/fr/unicaen/iota/dphi/xacml/ihm/test/AccessResponseDialog.java | ||
---|---|---|
/*
|
||
* This program is a part of the IoTa project.
|
||
*
|
||
* Copyright © 2008-2012 Université de Caen Basse-Normandie, GREYC
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation, either version 3 of the License, or
|
||
* (at your option) any later version.
|
||
*
|
||
* This program is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
* <http://www.gnu.org/licenses/>
|
||
*
|
||
* See AUTHORS for a list of contributors.
|
||
*/
|
||
package fr.unicaen.iota.dphi.xacml.ihm.test;
|
||
|
||
/**
|
||
*
|
||
*/
|
||
public class AccessResponseDialog extends javax.swing.JDialog {
|
||
|
||
/**
|
||
* Creates new form AccessResponse
|
||
*/
|
||
public AccessResponseDialog(java.awt.Frame parent, boolean modal) {
|
||
super(parent, modal);
|
||
initComponents();
|
||
}
|
||
|
||
public void setResponse(String response) {
|
||
responseLabel.setText(response);
|
||
}
|
||
|
||
/**
|
||
* This method is called from within the constructor to initialize the form.
|
||
* WARNING: Do NOT modify this code. The content of this method is always
|
||
* regenerated by the Form Editor.
|
||
*/
|
||
private void initComponents() {
|
||
responseLabel = new javax.swing.JLabel();
|
||
jLabel2 = new javax.swing.JLabel();
|
||
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
|
||
responseLabel.setText("Response");
|
||
jLabel2.setText("Access Response");
|
||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||
getContentPane().setLayout(layout);
|
||
layout.setHorizontalGroup(
|
||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addGap(17, 17, 17).addComponent(jLabel2)).addGroup(layout.createSequentialGroup().addGap(38, 38, 38).addComponent(responseLabel))).addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
|
||
layout.setVerticalGroup(
|
||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addComponent(jLabel2).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).addComponent(responseLabel).addContainerGap(29, Short.MAX_VALUE)));
|
||
pack();
|
||
}
|
||
|
||
/**
|
||
* @param args the command line arguments
|
||
*/
|
||
public static void main(String args[]) {
|
||
java.awt.EventQueue.invokeLater(new Runnable() {
|
||
|
||
@Override
|
||
public void run() {
|
||
AccessResponseDialog dialog = new AccessResponseDialog(new javax.swing.JFrame(), true);
|
||
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
|
||
|
||
@Override
|
||
public void windowClosing(java.awt.event.WindowEvent e) {
|
||
System.exit(0);
|
||
}
|
||
});
|
||
dialog.setVisible(true);
|
||
}
|
||
});
|
||
}
|
||
// Variables declaration - do not modify
|
||
private javax.swing.JLabel jLabel2;
|
||
private javax.swing.JLabel responseLabel;
|
||
// End of variables declaration
|
||
}
|
DSeTa/DiscoveryPHI/src/main/java/fr/unicaen/iota/dphi/xacml/ihm/test/AdminModuleClient.java | ||
---|---|---|
/*
|
||
* This program is a part of the IoTa project.
|
||
*
|
||
* Copyright © 2008-2012 Université de Caen Basse-Normandie, GREYC
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation, either version 3 of the License, or
|
||
* (at your option) any later version.
|
||
*
|
||
* This program is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
* <http://www.gnu.org/licenses/>
|
||
*
|
||
* See AUTHORS for a list of contributors.
|
||
*/
|
||
package fr.unicaen.iota.dphi.xacml.ihm.test;
|
||
|
||
import com.sun.xacml.ctx.Result;
|
||
import fr.unicaen.iota.dphi.utils.InterfaceHelper;
|
||
import fr.unicaen.iota.dphi.xacml.pep.DSPEP;
|
||
import fr.unicaen.iota.xacml.pep.MethodNamesAdmin;
|
||
import java.lang.reflect.InvocationTargetException;
|
||
import java.lang.reflect.Method;
|
||
import java.util.ArrayList;
|
||
import org.apache.commons.logging.Log;
|
||
import org.apache.commons.logging.LogFactory;
|
||
|
||
/**
|
||
*
|
||
*/
|
||
public class AdminModuleClient extends javax.swing.JFrame {
|
||
|
||
private static final Log log = LogFactory.getLog(AdminModuleClient.class);
|
||
private String ownerName;
|
||
|
||
/**
|
||
* Creates new form CaptureModule
|
||
*/
|
||
public AdminModuleClient(String ownerName) {
|
||
this.ownerName = ownerName;
|
||
initComponents();
|
||
this.setLocationRelativeTo(null);
|
||
}
|
||
|
||
/**
|
||
* This method is called from within the constructor to initialize the form.
|
||
* WARNING: Do NOT modify this code. The content of this method is always
|
||
* regenerated by the Form Editor.
|
||
*/
|
||
private void initComponents() {
|
||
jLabel1 = new javax.swing.JLabel();
|
||
jLabel2 = new javax.swing.JLabel();
|
||
jLabel3 = new javax.swing.JLabel();
|
||
jLabel8 = new javax.swing.JLabel();
|
||
sendButton = new javax.swing.JButton();
|
||
actionComboBox = new javax.swing.JComboBox();
|
||
userField = new javax.swing.JTextField();
|
||
ownerField = new javax.swing.JTextField();
|
||
|
||
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
|
||
jLabel1.setText("Admin Module");
|
||
jLabel2.setText("User: ");
|
||
jLabel3.setText("Owner: ");
|
||
jLabel8.setText("Action: ");
|
||
sendButton.setText("Send");
|
||
sendButton.addActionListener(new java.awt.event.ActionListener() {
|
||
|
||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||
InterfaceHelper IH = new InterfaceHelper(ownerName);
|
||
IH.reload();
|
||
sendButtonActionPerformed(evt);
|
||
}
|
||
});
|
||
|
||
ArrayList actions = new ArrayList();
|
||
for (Method m : MethodNamesAdmin.class.getMethods()) {
|
||
actions.add(m.getName());
|
||
}
|
||
actionComboBox.setModel(new javax.swing.DefaultComboBoxModel(actions.toArray()));
|
||
|
||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||
getContentPane().setLayout(layout);
|
||
layout.setHorizontalGroup(
|
||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addComponent(jLabel3)).addGroup(layout.createSequentialGroup().addContainerGap().addComponent(jLabel2)).addGroup(layout.createSequentialGroup().addContainerGap().addComponent(jLabel8))).addGap(20, 20, 20).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(userField, javax.swing.GroupLayout.DEFAULT_SIZE, 231, Short.MAX_VALUE).addComponent(ownerField, javax.swing.GroupLayout.DEFAULT_SIZE, 231, Short.MAX_VALUE).addComponent(actionComboBox, 0, 231, Short.MAX_VALUE).addComponent(jLabel1))).addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup().addContainerGap(273, Short.MAX_VALUE).addComponent(sendButton))).addContainerGap()));
|
||
layout.setVerticalGroup(
|
||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addComponent(jLabel1).addGap(12, 12, 12).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(userField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jLabel2)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(ownerField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jLabel3)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(actionComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jLabel8)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).addComponent(sendButton).addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
|
||
|
||
pack();
|
||
}
|
||
|
||
private Object runMethod(Object obj, Object[] args, String methodName) throws Exception {
|
||
Class[] paramTypes = null;
|
||
if (args != null) {
|
||
paramTypes = new Class[args.length];
|
||
for (int i = 0; i < args.length; ++i) {
|
||
paramTypes[i] = args[i].getClass();
|
||
}
|
||
}
|
||
Method m = obj.getClass().getMethod(methodName, paramTypes);
|
||
return m.invoke(obj, args);
|
||
}
|
||
|
||
private void sendButtonActionPerformed(java.awt.event.ActionEvent evt) {
|
||
String action = (String) actionComboBox.getSelectedItem();
|
||
ArrayList args = new ArrayList();
|
||
args.add(userField.getText());
|
||
args.add(ownerField.getText());
|
||
try {
|
||
DSPEP dspep = new DSPEP();
|
||
int response = (Integer) runMethod(dspep, args.toArray(), action);
|
||
String res = (response == Result.DECISION_PERMIT)? "ACCEPT": "DENY";
|
||
AccessResponseDialog dialog = new AccessResponseDialog(this, true);
|
||
dialog.setLocationRelativeTo(this);
|
||
dialog.setResponse(res);
|
||
dialog.setVisible(true);
|
||
} catch (InvocationTargetException ex) {
|
||
AccessResponseDialog dialog = new AccessResponseDialog(this, true);
|
||
dialog.setLocationRelativeTo(this);
|
||
dialog.setResponse("DENY");
|
||
dialog.setVisible(true);
|
||
} catch (NullPointerException ex) {
|
||
AccessResponseDialog dialog = new AccessResponseDialog(this, true);
|
||
dialog.setLocationRelativeTo(this);
|
||
dialog.setResponse("DENY");
|
||
dialog.setVisible(true);
|
||
} catch (Exception ex) {
|
||
log.fatal(null, ex);
|
||
}
|
||
}
|
||
|
||
/**
|
||
* @param args the command line arguments
|
||
*/
|
||
public static void main(String args[]) {
|
||
java.awt.EventQueue.invokeLater(new Runnable() {
|
||
|
||
@Override
|
||
public void run() {
|
||
String owner = "anonymous";
|
||
new AdminModuleClient(owner).setVisible(true);
|
||
}
|
||
});
|
||
}
|
||
private javax.swing.JComboBox actionComboBox;
|
||
private javax.swing.JLabel jLabel1;
|
||
private javax.swing.JLabel jLabel2;
|
||
private javax.swing.JLabel jLabel3;
|
||
private javax.swing.JLabel jLabel8;
|
||
private javax.swing.JTextField ownerField;
|
||
private javax.swing.JButton sendButton;
|
||
private javax.swing.JTextField userField;
|
||
}
|
DSeTa/DiscoveryPHI/src/main/java/fr/unicaen/iota/dphi/xacml/ihm/test/CaptureModule.form | ||
---|---|---|
<?xml version="1.0" encoding="UTF-8" ?>
|
||
|
||
<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
|
||
<Properties>
|
||
<Property name="defaultCloseOperation" type="int" value="3"/>
|
||
</Properties>
|
||
<SyntheticProperties>
|
||
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
|
||
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
|
||
</SyntheticProperties>
|
||
<AuxValues>
|
||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||
</AuxValues>
|
||
|
||
<Layout>
|
||
<DimensionLayout dim="0">
|
||
<Group type="103" groupAlignment="0" attributes="0">
|
||
<Group type="102" attributes="0">
|
||
<EmptySpace max="-2" attributes="0"/>
|
||
<Group type="103" groupAlignment="0" attributes="0">
|
||
<Group type="102" attributes="0">
|
||
<Group type="103" groupAlignment="0" attributes="0">
|
||
<Component id="jLabel3" alignment="0" min="-2" max="-2" attributes="0"/>
|
||
<Component id="jLabel2" alignment="0" min="-2" max="-2" attributes="0"/>
|
||
<Component id="jLabel8" alignment="0" min="-2" max="-2" attributes="0"/>
|
||
</Group>
|
||
<EmptySpace min="-2" pref="20" max="-2" attributes="0"/>
|
||
<Group type="103" groupAlignment="0" attributes="0">
|
||
<Component id="userField" alignment="0" pref="239" max="32767" attributes="0"/>
|
||
<Component id="ownerField" alignment="0" pref="239" max="32767" attributes="0"/>
|
||
<Component id="actionComboBox" alignment="0" pref="239" max="32767" attributes="0"/>
|
||
<Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/>
|
||
</Group>
|
||
</Group>
|
||
<Group type="102" alignment="1" attributes="0">
|
||
<EmptySpace min="0" pref="261" max="32767" attributes="0"/>
|
||
<Component id="sendButton" min="-2" max="-2" attributes="0"/>
|
||
</Group>
|
||
</Group>
|
||
<EmptySpace max="-2" attributes="0"/>
|
||
</Group>
|
||
</Group>
|
||
</DimensionLayout>
|
||
<DimensionLayout dim="1">
|
||
<Group type="103" groupAlignment="0" attributes="0">
|
||
<Group type="102" alignment="0" attributes="0">
|
||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||
<EmptySpace min="-2" pref="12" max="-2" attributes="0"/>
|
||
<Group type="103" groupAlignment="3" attributes="0">
|
||
<Component id="userField" alignment="3" min="-2" max="-2" attributes="0"/>
|
||
<Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
|
||
</Group>
|
||
<EmptySpace max="-2" attributes="0"/>
|
||
<Group type="103" groupAlignment="3" attributes="0">
|
||
<Component id="ownerField" alignment="3" min="-2" max="-2" attributes="0"/>
|
||
<Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/>
|
||
</Group>
|
||
<EmptySpace max="-2" attributes="0"/>
|
||
<Group type="103" groupAlignment="3" attributes="0">
|
||
<Component id="actionComboBox" alignment="3" min="-2" max="-2" attributes="0"/>
|
||
<Component id="jLabel8" alignment="3" min="-2" max="-2" attributes="0"/>
|
||
</Group>
|
||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||
<Component id="sendButton" min="-2" max="-2" attributes="0"/>
|
||
<EmptySpace max="32767" attributes="0"/>
|
||
</Group>
|
||
</Group>
|
||
</DimensionLayout>
|
||
</Layout>
|
||
<SubComponents>
|
||
<Component class="javax.swing.JLabel" name="jLabel1">
|
||
<Properties>
|
||
<Property name="text" type="java.lang.String" value="Capture Module"/>
|
||
</Properties>
|
||
</Component>
|
||
<Component class="javax.swing.JLabel" name="jLabel2">
|
||
<Properties>
|
||
<Property name="text" type="java.lang.String" value="User: "/>
|
||
</Properties>
|
||
</Component>
|
||
<Component class="javax.swing.JLabel" name="jLabel3">
|
||
<Properties>
|
||
<Property name="text" type="java.lang.String" value="Owner:"/>
|
||
</Properties>
|
||
</Component>
|
||
<Component class="javax.swing.JLabel" name="jLabel8">
|
||
<Properties>
|
||
<Property name="text" type="java.lang.String" value="Action: "/>
|
||
</Properties>
|
||
</Component>
|
||
<Component class="javax.swing.JButton" name="sendButton">
|
||
<Properties>
|
||
<Property name="text" type="java.lang.String" value="Send"/>
|
||
</Properties>
|
||
<Events>
|
||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="sendButtonActionPerformed"/>
|
||
</Events>
|
||
</Component>
|
||
<Component class="javax.swing.JComboBox" name="actionComboBox">
|
||
<Properties>
|
||
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
|
||
<StringArray count="4">
|
||
<StringItem index="0" value="Item 1"/>
|
||
<StringItem index="1" value="Item 2"/>
|
||
<StringItem index="2" value="Item 3"/>
|
||
<StringItem index="3" value="Item 4"/>
|
||
</StringArray>
|
||
</Property>
|
||
</Properties>
|
||
</Component>
|
||
<Component class="javax.swing.JTextField" name="userField">
|
||
</Component>
|
||
<Component class="javax.swing.JTextField" name="ownerField">
|
||
</Component>
|
||
</SubComponents>
|
||
</Form>
|
DSeTa/DiscoveryPHI/src/main/java/fr/unicaen/iota/dphi/xacml/ihm/test/CaptureModule.java | ||
---|---|---|
/*
|
||
* This program is a part of the IoTa project.
|
||
*
|
||
* Copyright © 2008-2012 Université de Caen Basse-Normandie, GREYC
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation, either version 3 of the License, or
|
||
* (at your option) any later version.
|
||
*
|
||
* This program is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
* <http://www.gnu.org/licenses/>
|
||
*
|
||
* See AUTHORS for a list of contributors.
|
||
*/
|
||
package fr.unicaen.iota.dphi.xacml.ihm.test;
|
||
|
||
/**
|
||
*
|
||
*/
|
||
public class CaptureModule extends javax.swing.JFrame {
|
||
|
||
/**
|
||
* Creates new form CaptureModule
|
||
*/
|
||
public CaptureModule() {
|
||
initComponents();
|
||
}
|
||
|
||
/**
|
||
* This method is called from within the constructor to initialize the form.
|
||
* WARNING: Do NOT modify this code. The content of this method is always
|
||
* regenerated by the Form Editor.
|
||
*/
|
||
@SuppressWarnings("unchecked")
|
||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||
private void initComponents() {
|
||
|
||
jLabel1 = new javax.swing.JLabel();
|
||
jLabel2 = new javax.swing.JLabel();
|
||
jLabel3 = new javax.swing.JLabel();
|
||
jLabel8 = new javax.swing.JLabel();
|
||
sendButton = new javax.swing.JButton();
|
||
actionComboBox = new javax.swing.JComboBox();
|
||
userField = new javax.swing.JTextField();
|
||
ownerField = new javax.swing.JTextField();
|
||
|
||
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
|
||
|
||
jLabel1.setText("Capture Module");
|
||
|
||
jLabel2.setText("User: ");
|
||
|
||
jLabel3.setText("Owner:");
|
||
|
||
jLabel8.setText("Action: ");
|
||
|
||
sendButton.setText("Send");
|
||
sendButton.addActionListener(new java.awt.event.ActionListener() {
|
||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||
sendButtonActionPerformed(evt);
|
||
}
|
||
});
|
||
|
||
actionComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
|
||
|
||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||
getContentPane().setLayout(layout);
|
||
layout.setHorizontalGroup(
|
||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||
.addGroup(layout.createSequentialGroup()
|
||
.addContainerGap()
|
||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||
.addGroup(layout.createSequentialGroup()
|
||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||
.addComponent(jLabel3)
|
||
.addComponent(jLabel2)
|
||
.addComponent(jLabel8))
|
||
.addGap(20, 20, 20)
|
||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||
.addComponent(userField, javax.swing.GroupLayout.DEFAULT_SIZE, 239, Short.MAX_VALUE)
|
||
.addComponent(ownerField, javax.swing.GroupLayout.DEFAULT_SIZE, 239, Short.MAX_VALUE)
|
||
.addComponent(actionComboBox, 0, 239, Short.MAX_VALUE)
|
||
.addComponent(jLabel1)))
|
||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||
.addGap(0, 261, Short.MAX_VALUE)
|
||
.addComponent(sendButton)))
|
||
.addContainerGap())
|
||
);
|
||
layout.setVerticalGroup(
|
||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||
.addGroup(layout.createSequentialGroup()
|
||
.addComponent(jLabel1)
|
||
.addGap(12, 12, 12)
|
||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||
.addComponent(userField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||
.addComponent(jLabel2))
|
||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||
.addComponent(ownerField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||
.addComponent(jLabel3))
|
||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||
.addComponent(actionComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||
.addComponent(jLabel8))
|
||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||
.addComponent(sendButton)
|
||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||
);
|
||
|
||
pack();
|
||
}// </editor-fold>//GEN-END:initComponents
|
||
|
||
private void sendButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sendButtonActionPerformed
|
||
}//GEN-LAST:event_sendButtonActionPerformed
|
||
|
||
/**
|
||
* @param args the command line arguments
|
||
*/
|
||
public static void main(String args[]) {
|
||
java.awt.EventQueue.invokeLater(new Runnable() {
|
||
|
||
@Override
|
||
public void run() {
|
||
new CaptureModule().setVisible(true);
|
||
}
|
||
});
|
||
}
|
||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||
private javax.swing.JComboBox actionComboBox;
|
||
private javax.swing.JLabel jLabel1;
|
||
private javax.swing.JLabel jLabel2;
|
||
private javax.swing.JLabel jLabel3;
|
||
private javax.swing.JLabel jLabel8;
|
||
private javax.swing.JTextField ownerField;
|
||
private javax.swing.JButton sendButton;
|
||
private javax.swing.JTextField userField;
|
||
// End of variables declaration//GEN-END:variables
|
||
}
|
DSeTa/DiscoveryPHI/src/main/java/fr/unicaen/iota/dphi/xacml/ihm/test/CaptureModuleClient.java | ||
---|---|---|
/*
|
||
* This program is a part of the IoTa project.
|
||
*
|
||
* Copyright © 2008-2012 Université de Caen Basse-Normandie, GREYC
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation, either version 3 of the License, or
|
||
* (at your option) any later version.
|
||
*
|
||
* This program is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
* <http://www.gnu.org/licenses/>
|
||
*
|
||
* See AUTHORS for a list of contributors.
|
||
*/
|
||
package fr.unicaen.iota.dphi.xacml.ihm.test;
|
||
|
||
import com.sun.xacml.ctx.Result;
|
||
import fr.unicaen.iota.dphi.utils.InterfaceHelper;
|
||
import fr.unicaen.iota.dphi.utils.MapSessions;
|
||
import fr.unicaen.iota.dphi.xacml.pep.DSPEP;
|
||
import fr.unicaen.iota.xacml.pep.MethodNamesCapture;
|
||
import fr.unicaen.iota.xacml.pep.XACMLDSEvent;
|
||
import java.lang.reflect.InvocationTargetException;
|
||
import java.lang.reflect.Method;
|
||
import java.util.ArrayList;
|
||
import java.util.Calendar;
|
||
import java.util.Date;
|
||
import org.apache.commons.logging.Log;
|
||
import org.apache.commons.logging.LogFactory;
|
||
|
||
/**
|
||
*
|
||
*/
|
||
public class CaptureModuleClient extends javax.swing.JFrame {
|
||
|
||
private static final Log log = LogFactory.getLog(CaptureModuleClient.class);
|
||
private String ownerName;
|
||
|
||
public CaptureModuleClient(String ownerName) {
|
||
this.ownerName = ownerName;
|
||
initComponents();
|
||
this.setLocationRelativeTo(null);
|
||
}
|
||
|
||
/**
|
||
* This method is called from within the constructor to initialize the form.
|
||
* WARNING: Do NOT modify this code. The content of this method is always
|
||
* regenerated by the Form Editor.
|
||
*/
|
||
private void initComponents() {
|
||
|
||
jLabel1 = new javax.swing.JLabel();
|
||
jLabel2 = new javax.swing.JLabel();
|
||
jLabel3 = new javax.swing.JLabel();
|
||
jLabel4 = new javax.swing.JLabel();
|
||
jLabel5 = new javax.swing.JLabel();
|
||
jLabel6 = new javax.swing.JLabel();
|
||
jLabel7 = new javax.swing.JLabel();
|
||
jLabel8 = new javax.swing.JLabel();
|
||
sendButton = new javax.swing.JButton();
|
||
actionComboBox = new javax.swing.JComboBox();
|
||
userField = new javax.swing.JTextField();
|
||
ownerField = new javax.swing.JTextField();
|
||
epcField = new javax.swing.JTextField();
|
||
eventTypeField = new javax.swing.JTextField();
|
||
bizStepField = new javax.swing.JTextField();
|
||
eventTimeDayBox = new javax.swing.JComboBox();
|
||
eventTimeMonthBox = new javax.swing.JComboBox();
|
||
eventTimeYearBox = new javax.swing.JComboBox();
|
||
|
||
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
|
||
jLabel1.setText("Capture Module");
|
||
jLabel2.setText("User: ");
|
||
jLabel3.setText("Owner: ");
|
||
jLabel4.setText("EPC: ");
|
||
jLabel5.setText("EventType: ");
|
||
jLabel6.setText("BizStep: ");
|
||
jLabel7.setText("EventTime: ");
|
||
jLabel8.setText("Action: ");
|
||
sendButton.setText("Send");
|
||
sendButton.addActionListener(new java.awt.event.ActionListener() {
|
||
|
||
@Override
|
||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||
InterfaceHelper IH = new InterfaceHelper(ownerName);
|
||
IH.reload();
|
||
sendButtonActionPerformed(evt);
|
||
}
|
||
});
|
||
|
||
ArrayList actions = new ArrayList();
|
||
for (Method m : MethodNamesCapture.class.getMethods()) {
|
||
actions.add(m.getName());
|
||
}
|
||
actionComboBox.setModel(new javax.swing.DefaultComboBoxModel(actions.toArray()));
|
||
|
||
String[] days = new String[31];
|
||
for (int i = 1; i <= 31; i++) {
|
||
days[i - 1] = "" + i;
|
||
}
|
||
eventTimeDayBox.setModel(new javax.swing.DefaultComboBoxModel(days));
|
||
|
||
String[] months = new String[12];
|
||
for (int i = 1; i <= 12; i++) {
|
||
months[i - 1] = "" + i;
|
||
}
|
||
eventTimeMonthBox.setModel(new javax.swing.DefaultComboBoxModel(months));
|
||
|
||
ArrayList years = new ArrayList();
|
||
for (int i = 1970; i <= 2020; i++) {
|
||
years.add("" + i);
|
||
}
|
||
eventTimeYearBox.setModel(new javax.swing.DefaultComboBoxModel(years.toArray()));
|
||
|
||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||
getContentPane().setLayout(layout);
|
||
layout.setHorizontalGroup(
|
||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jLabel2).addComponent(jLabel3).addComponent(jLabel8).addComponent(jLabel4).addComponent(jLabel5).addComponent(jLabel6).addComponent(jLabel7)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addComponent(eventTimeDayBox, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(eventTimeMonthBox, 0, 51, Short.MAX_VALUE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(eventTimeYearBox, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)).addComponent(userField, javax.swing.GroupLayout.DEFAULT_SIZE, 212, Short.MAX_VALUE).addComponent(ownerField, javax.swing.GroupLayout.DEFAULT_SIZE, 212, Short.MAX_VALUE).addComponent(actionComboBox, 0, 212, Short.MAX_VALUE).addComponent(epcField, javax.swing.GroupLayout.DEFAULT_SIZE, 212, Short.MAX_VALUE).addComponent(eventTypeField, javax.swing.GroupLayout.DEFAULT_SIZE, 212, Short.MAX_VALUE).addComponent(bizStepField, javax.swing.GroupLayout.DEFAULT_SIZE, 212, Short.MAX_VALUE).addComponent(jLabel1))).addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup().addContainerGap(254, Short.MAX_VALUE).addComponent(sendButton))).addContainerGap()));
|
||
layout.setVerticalGroup(
|
||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addComponent(jLabel1).addGap(12, 12, 12).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel2).addComponent(userField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(ownerField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jLabel3)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(actionComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jLabel8)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(epcField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jLabel4)).addGap(7, 7, 7).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(eventTypeField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jLabel5)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(bizStepField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jLabel6)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel7).addComponent(eventTimeDayBox, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(eventTimeYearBox, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(eventTimeMonthBox, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).addComponent(sendButton).addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
|
||
|
||
pack();
|
||
}
|
||
|
||
private Date convertStringToDate(String day, String month, String year) {
|
||
Calendar cal = Calendar.getInstance();
|
||
cal.set(Integer.parseInt(year), Integer.parseInt(month), Integer.parseInt(day));
|
||
return cal.getTime();
|
||
}
|
||
|
||
private Object runMethod(Object obj, Object[] args, String methodName) throws Exception {
|
||
Class[] paramTypes = null;
|
||
if (args != null) {
|
||
paramTypes = new Class[args.length];
|
||
for (int i = 0; i < args.length; ++i) {
|
||
paramTypes[i] = args[i].getClass();
|
||
}
|
||
}
|
||
Method m = obj.getClass().getMethod(methodName, paramTypes);
|
||
return m.invoke(obj, args);
|
||
}
|
||
|
||
private void sendButtonActionPerformed(java.awt.event.ActionEvent evt) {
|
||
Date eventTime = convertStringToDate((String) eventTimeDayBox.getSelectedItem(), (String) eventTimeMonthBox.getSelectedItem(), (String) eventTimeYearBox.getSelectedItem());
|
||
String action = (String) actionComboBox.getSelectedItem();
|
||
ArrayList args = new ArrayList();
|
||
args.add(MapSessions.APM);
|
||
args.add(userField.getText());
|
||
args.add(ownerField.getText());
|
||
if (!"hello".equals(action)) {
|
||
XACMLDSEvent xacmldse = new XACMLDSEvent(ownerField.getText(), bizStepField.getText(), epcField.getText(), eventTypeField.getText(), eventTime);
|
||
args.add(xacmldse);
|
||
}
|
||
try {
|
||
DSPEP dspep = new DSPEP();
|
||
int response = (Integer) runMethod(dspep, args.toArray(), action);
|
||
String res = (response == Result.DECISION_PERMIT)? "ACCEPT": "DENY";
|
||
AccessResponseDialog dialog = new AccessResponseDialog(this, true);
|
||
dialog.setLocationRelativeTo(this);
|
||
dialog.setResponse(res);
|
||
dialog.setVisible(true);
|
||
} catch (InvocationTargetException ex) {
|
||
AccessResponseDialog dialog = new AccessResponseDialog(this, true);
|
||
dialog.setLocationRelativeTo(this);
|
||
dialog.setResponse("DENY");
|
||
dialog.setVisible(true);
|
||
} catch (NullPointerException ex) {
|
||
AccessResponseDialog dialog = new AccessResponseDialog(this, true);
|
||
dialog.setLocationRelativeTo(this);
|
||
dialog.setResponse("DENY");
|
||
dialog.setVisible(true);
|
||
} catch (Exception ex) {
|
||
log.fatal(null, ex);
|
||
}
|
||
}
|
||
|
||
/**
|
||
* @param args the command line arguments
|
||
*/
|
||
public static void main(String args[]) {
|
||
java.awt.EventQueue.invokeLater(new Runnable() {
|
||
|
||
@Override
|
||
public void run() {
|
||
String owner = "ownerDeTest";
|
||
new CaptureModuleClient(owner).setVisible(true);
|
||
}
|
||
});
|
||
}
|
||
// Variables declaration - do not modify
|
||
private javax.swing.JComboBox actionComboBox;
|
||
private javax.swing.JTextField bizStepField;
|
||
private javax.swing.JTextField eventTypeField;
|
||
private javax.swing.JTextField epcField;
|
||
private javax.swing.JComboBox eventTimeDayBox;
|
||
private javax.swing.JComboBox eventTimeMonthBox;
|
||
private javax.swing.JComboBox eventTimeYearBox;
|
||
private javax.swing.JLabel jLabel1;
|
||
private javax.swing.JLabel jLabel2;
|
||
private javax.swing.JLabel jLabel3;
|
||
private javax.swing.JLabel jLabel4;
|
||
private javax.swing.JLabel jLabel5;
|
||
private javax.swing.JLabel jLabel6;
|
||
private javax.swing.JLabel jLabel7;
|
||
private javax.swing.JLabel jLabel8;
|
||
private javax.swing.JTextField ownerField;
|
||
private javax.swing.JButton sendButton;
|
||
private javax.swing.JTextField userField;
|
||
// End of variables declaration
|
||
}
|
DSeTa/DiscoveryPHI/src/main/java/fr/unicaen/iota/dphi/xacml/ihm/test/QueryModuleClient.java | ||
---|---|---|
/*
|
||
* This program is a part of the IoTa project.
|
||
*
|
||
* Copyright © 2008-2012 Université de Caen Basse-Normandie, GREYC
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation, either version 3 of the License, or
|
||
* (at your option) any later version.
|
||
*
|
||
* This program is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
* <http://www.gnu.org/licenses/>
|
||
*
|
||
* See AUTHORS for a list of contributors.
|
||
*/
|
||
package fr.unicaen.iota.dphi.xacml.ihm.test;
|
||
|
||
import com.sun.xacml.ctx.Result;
|
||
import fr.unicaen.iota.dphi.utils.InterfaceHelper;
|
||
import fr.unicaen.iota.dphi.utils.MapSessions;
|
||
import fr.unicaen.iota.dphi.xacml.pep.DSPEP;
|
||
import fr.unicaen.iota.xacml.pep.MethodNamesQuery;
|
||
import fr.unicaen.iota.xacml.pep.XACMLDSEvent;
|
||
import java.lang.reflect.InvocationTargetException;
|
||
import java.lang.reflect.Method;
|
||
import java.util.ArrayList;
|
||
import java.util.Calendar;
|
||
import java.util.Date;
|
||
import org.apache.commons.logging.Log;
|
||
import org.apache.commons.logging.LogFactory;
|
||
|
||
/**
|
||
*
|
||
*/
|
||
public class QueryModuleClient extends javax.swing.JFrame {
|
||
|
||
private static final Log log = LogFactory.getLog(QueryModuleClient.class);
|
||
private String ownerName;
|
||
|
||
public QueryModuleClient(String ownerName) {
|
||
this.ownerName = ownerName;
|
||
initComponents();
|
||
this.setLocationRelativeTo(null);
|
||
}
|
||
|
||
/**
|
||
* This method is called from within the constructor to initialize the form.
|
||
* WARNING: Do NOT modify this code. The content of this method is always
|
||
* regenerated by the Form Editor.
|
||
*/
|
||
private void initComponents() {
|
||
|
||
jLabel1 = new javax.swing.JLabel();
|
||
jLabel2 = new javax.swing.JLabel();
|
||
jLabel3 = new javax.swing.JLabel();
|
||
jLabel4 = new javax.swing.JLabel();
|
||
jLabel5 = new javax.swing.JLabel();
|
||
jLabel6 = new javax.swing.JLabel();
|
||
jLabel7 = new javax.swing.JLabel();
|
||
jLabel8 = new javax.swing.JLabel();
|
||
sendButton = new javax.swing.JButton();
|
||
actionComboBox = new javax.swing.JComboBox();
|
||
userField = new javax.swing.JTextField();
|
||
ownerField = new javax.swing.JTextField();
|
||
epcField = new javax.swing.JTextField();
|
||
eventTypeField = new javax.swing.JTextField();
|
||
bizStepField = new javax.swing.JTextField();
|
||
eventTimeDayBox = new javax.swing.JComboBox();
|
||
eventTimeMonthBox = new javax.swing.JComboBox();
|
||
eventTimeYearBox = new javax.swing.JComboBox();
|
||
|
||
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
|
||
jLabel1.setText("Query Module");
|
||
jLabel2.setText("Owner: ");
|
||
jLabel3.setText("Owner Partner: ");
|
||
jLabel4.setText("EPC: ");
|
||
jLabel5.setText("EventType: ");
|
||
jLabel6.setText("BizStep: ");
|
||
jLabel7.setText("EventTime: ");
|
||
jLabel8.setText("Action: ");
|
||
sendButton.setText("Send");
|
||
sendButton.addActionListener(new java.awt.event.ActionListener() {
|
||
|
||
@Override
|
||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||
InterfaceHelper IH = new InterfaceHelper(ownerName);
|
||
IH.reload();
|
||
sendButtonActionPerformed(evt);
|
||
}
|
||
});
|
||
|
||
ArrayList actions = new ArrayList();
|
||
for (Method m : MethodNamesQuery.class.getMethods()) {
|
||
actions.add(m.getName());
|
||
}
|
||
actionComboBox.setModel(new javax.swing.DefaultComboBoxModel(actions.toArray()));
|
||
|
||
String[] days = new String[31];
|
||
for (int i = 1; i <= 31; i++) {
|
||
days[i - 1] = "" + i;
|
||
}
|
||
eventTimeDayBox.setModel(new javax.swing.DefaultComboBoxModel(days));
|
||
|
||
String[] months = new String[12];
|
||
for (int i = 1; i <= 12; i++) {
|
||
months[i - 1] = "" + i;
|
||
}
|
||
eventTimeMonthBox.setModel(new javax.swing.DefaultComboBoxModel(months));
|
||
|
||
ArrayList years = new ArrayList();
|
||
for (int i = 1970; i <= 2020; i++) {
|
||
years.add("" + i);
|
||
}
|
||
eventTimeYearBox.setModel(new javax.swing.DefaultComboBoxModel(years.toArray()));
|
||
|
||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||
getContentPane().setLayout(layout);
|
||
layout.setHorizontalGroup(
|
||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jLabel2).addComponent(jLabel3).addComponent(jLabel8).addComponent(jLabel4).addComponent(jLabel5).addComponent(jLabel6).addComponent(jLabel7)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addComponent(eventTimeDayBox, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(eventTimeMonthBox, 0, 51, Short.MAX_VALUE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(eventTimeYearBox, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)).addComponent(userField, javax.swing.GroupLayout.DEFAULT_SIZE, 212, Short.MAX_VALUE).addComponent(ownerField, javax.swing.GroupLayout.DEFAULT_SIZE, 212, Short.MAX_VALUE).addComponent(actionComboBox, 0, 212, Short.MAX_VALUE).addComponent(epcField, javax.swing.GroupLayout.DEFAULT_SIZE, 212, Short.MAX_VALUE).addComponent(eventTypeField, javax.swing.GroupLayout.DEFAULT_SIZE, 212, Short.MAX_VALUE).addComponent(bizStepField, javax.swing.GroupLayout.DEFAULT_SIZE, 212, Short.MAX_VALUE).addComponent(jLabel1))).addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup().addContainerGap(254, Short.MAX_VALUE).addComponent(sendButton))).addContainerGap()));
|
||
layout.setVerticalGroup(
|
||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addComponent(jLabel1).addGap(12, 12, 12).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel2).addComponent(userField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(ownerField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jLabel3)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(actionComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jLabel8)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(epcField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jLabel4)).addGap(7, 7, 7).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(eventTypeField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jLabel5)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(bizStepField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jLabel6)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel7).addComponent(eventTimeDayBox, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(eventTimeYearBox, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(eventTimeMonthBox, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).addComponent(sendButton).addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
|
||
|
||
pack();
|
||
}
|
||
|
||
private Date convertStringToDate(String day, String month, String year) {
|
||
Calendar cal = Calendar.getInstance();
|
||
cal.set(Integer.parseInt(year), Integer.parseInt(month), Integer.parseInt(day));
|
||
return cal.getTime();
|
||
}
|
||
|
||
private Object runMethod(Object obj, Object[] args, String methodName) throws Exception {
|
||
Class[] paramTypes = null;
|
||
if (args != null) {
|
||
paramTypes = new Class[args.length];
|
||
for (int i = 0; i < args.length; ++i) {
|
||
paramTypes[i] = args[i].getClass();
|
||
}
|
||
}
|
||
Method m = obj.getClass().getMethod(methodName, paramTypes);
|
||
return m.invoke(obj, args);
|
||
}
|
||
|
||
private void sendButtonActionPerformed(java.awt.event.ActionEvent evt) {
|
||
Date eventTime = convertStringToDate((String) eventTimeDayBox.getSelectedItem(), (String) eventTimeMonthBox.getSelectedItem(), (String) eventTimeYearBox.getSelectedItem());
|
||
String action = (String) actionComboBox.getSelectedItem();
|
||
ArrayList args = new ArrayList();
|
||
args.add(MapSessions.APM);
|
||
args.add(userField.getText());
|
||
args.add(ownerField.getText());
|
||
if (!"hello".equals(action)) {
|
||
XACMLDSEvent xacmldse = new XACMLDSEvent(ownerField.getText(), bizStepField.getText(), epcField.getText(), eventTypeField.getText(), eventTime);
|
||
args.add(xacmldse);
|
||
}
|
||
try {
|
||
DSPEP dspep = new DSPEP();
|
||
int response = (Integer) runMethod(dspep, args.toArray(), action);
|
||
String res = (response == Result.DECISION_PERMIT)? "ACCEPT": "DENY";
|
||
AccessResponseDialog dialog = new AccessResponseDialog(this, true);
|
||
dialog.setLocationRelativeTo(this);
|
||
dialog.setResponse(res);
|
||
dialog.setVisible(true);
|
||
} catch (InvocationTargetException ex) {
|
||
AccessResponseDialog dialog = new AccessResponseDialog(this, true);
|
||
dialog.setLocationRelativeTo(this);
|
||
dialog.setResponse("DENY");
|
||
dialog.setVisible(true);
|
||
} catch (NullPointerException ex) {
|
||
AccessResponseDialog dialog = new AccessResponseDialog(this, true);
|
||
dialog.setLocationRelativeTo(this);
|
||
dialog.setResponse("DENY");
|
||
dialog.setVisible(true);
|
||
} catch (Exception ex) {
|
||
log.fatal(null, ex);
|
||
}
|
||
}
|
||
|
||
/**
|
||
* @param args the command line arguments
|
||
*/
|
||
public static void main(String args[]) {
|
||
java.awt.EventQueue.invokeLater(new Runnable() {
|
||
|
||
@Override
|
||
public void run() {
|
||
String owner = "anonymous";
|
||
new QueryModuleClient(owner).setVisible(true);
|
||
}
|
||
});
|
||
}
|
||
// Variables declaration - do not modify
|
||
private javax.swing.JComboBox actionComboBox;
|
||
private javax.swing.JTextField bizStepField;
|
||
private javax.swing.JTextField eventTypeField;
|
||
private javax.swing.JTextField epcField;
|
||
private javax.swing.JComboBox eventTimeDayBox;
|
||
private javax.swing.JComboBox eventTimeMonthBox;
|
||
private javax.swing.JComboBox eventTimeYearBox;
|
||
private javax.swing.JLabel jLabel1;
|
||
private javax.swing.JLabel jLabel2;
|
||
private javax.swing.JLabel jLabel3;
|
||
private javax.swing.JLabel jLabel4;
|
||
private javax.swing.JLabel jLabel5;
|
||
private javax.swing.JLabel jLabel6;
|
||
private javax.swing.JLabel jLabel7;
|
||
private javax.swing.JLabel jLabel8;
|
||
private javax.swing.JTextField ownerField;
|
||
private javax.swing.JButton sendButton;
|
||
private javax.swing.JTextField userField;
|
||
// End of variables declaration
|
||
}
|
DSeTa/DiscoveryPHI/src/main/java/fr/unicaen/iota/dphi/xacml/ihm/test/TestPEP.java | ||
---|---|---|
/*
|
||
* This program is a part of the IoTa project.
|
||
*
|
||
* Copyright © 2008-2012 Université de Caen Basse-Normandie, GREYC
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation, either version 3 of the License, or
|
||
* (at your option) any later version.
|
||
*
|
||
* This program is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
* <http://www.gnu.org/licenses/>
|
||
*
|
||
* See AUTHORS for a list of contributors.
|
||
*/
|
||
package fr.unicaen.iota.dphi.xacml.ihm.test;
|
||
|
||
//import fr.unicaen.iota.utils.InterfaceHelper;
|
||
//import fr.unicaen.iota.xacml.pep.DSPEP;
|
||
//import fr.unicaen.iota.xacml.pep.XACMLDSEvent;
|
||
//import fr.unicaen.iota.xacml.pep.XACMLResponse;
|
||
/**
|
||
*
|
||
*/
|
||
public class TestPEP {
|
||
|
||
public static void main(String[] args) {
|
||
// DSPEP dspep = InterfaceHelper.APM.getDspep();
|
||
// XACMLResponse res = dspep.hello(InterfaceHelper.APM, "owner2", "OwnerDeTest");
|
||
// System.out.println(res.toString());
|
||
}
|
||
}
|
DSeTa/DiscoveryPHI/src/main/java/fr/unicaen/iota/dphi/xacml/pep/DSPEP.java | ||
---|---|---|
/*
|
||
* This program is a part of the IoTa project.
|
||
*
|
||
* Copyright © 2008-2012 Université de Caen Basse-Normandie, GREYC
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation, either version 3 of the License, or
|
||
* (at your option) any later version.
|
||
*
|
||
* This program is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
* <http://www.gnu.org/licenses/>
|
||
*
|
||
* See AUTHORS for a list of contributors.
|
||
*/
|
||
package fr.unicaen.iota.dphi.xacml.pep;
|
||
|
||
import com.sun.xacml.ctx.RequestCtx;
|
||
import com.sun.xacml.ctx.ResponseCtx;
|
||
import com.sun.xacml.ctx.Result;
|
||
import fr.unicaen.iota.dphi.utils.MapSessions;
|
||
import fr.unicaen.iota.xacml.pep.MethodNamesAdmin;
|
||
import fr.unicaen.iota.xacml.policy.Module;
|
||
import fr.unicaen.iota.xacml.request.EventRequest;
|
||
import java.util.Iterator;
|
||
import org.apache.commons.logging.Log;
|
||
import org.apache.commons.logging.LogFactory;
|
||
|
||
/**
|
||
*
|
||
*/
|
||
public class DSPEP implements MethodNamesAdmin {
|
||
|
||
private static final Log log = LogFactory.getLog(DSPEP.class);
|
||
|
||
//####################################################
|
||
//################## Authentication ##################
|
||
//####################################################
|
||
@Override
|
||
public int hello(String user, String owner) {
|
||
EventRequest eventRequest = new EventRequest(user, "hello", owner, Module.administrationModule.getValue());
|
||
RequestCtx request = eventRequest.createRequest();
|
||
ResponseCtx result = MapSessions.APM.evaluate(request);
|
||
return processResult(result);
|
||
}
|
||
|
||
@Override
|
||
public int userLookup(String user, String owner) {
|
||
EventRequest eventRequest = new EventRequest(user, "userLookup", owner, Module.administrationModule.getValue());
|
||
RequestCtx request = eventRequest.createRequest();
|
||
ResponseCtx result = MapSessions.APM.evaluate(request);
|
||
return processResult(result);
|
||
}
|
||
|
||
@Override
|
||
public int userCreate(String user, String owner) {
|
||
EventRequest eventRequest = new EventRequest(user, "userCreate", owner, Module.administrationModule.getValue());
|
||
RequestCtx request = eventRequest.createRequest();
|
||
ResponseCtx result = MapSessions.APM.evaluate(request);
|
||
return processResult(result);
|
||
}
|
||
|
||
@Override
|
||
public int userInfo(String user, String owner) {
|
||
EventRequest eventRequest = new EventRequest(user, "userInfo", owner, Module.administrationModule.getValue());
|
||
RequestCtx request = eventRequest.createRequest();
|
||
ResponseCtx result = MapSessions.APM.evaluate(request);
|
||
return processResult(result);
|
||
}
|
||
|
||
@Override
|
||
public int userUpdate(String user, String owner) {
|
||
EventRequest eventRequest = new EventRequest(user, "userUpdate", owner, Module.administrationModule.getValue());
|
||
RequestCtx request = eventRequest.createRequest();
|
||
ResponseCtx result = MapSessions.APM.evaluate(request);
|
||
return processResult(result);
|
||
}
|
||
|
||
@Override
|
||
public int userDelete(String user, String owner) {
|
||
EventRequest eventRequest = new EventRequest(user, "userDelete", owner, Module.administrationModule.getValue());
|
||
RequestCtx request = eventRequest.createRequest();
|
||
ResponseCtx result = MapSessions.APM.evaluate(request);
|
||
return processResult(result);
|
||
}
|
||
|
||
@Override
|
||
public int ownerUpdate(String user, String owner) {
|
||
EventRequest eventRequest = new EventRequest(user, "ownerUpdate", owner, Module.administrationModule.getValue());
|
||
RequestCtx request = eventRequest.createRequest();
|
||
ResponseCtx result = MapSessions.APM.evaluate(request);
|
||
return processResult(result);
|
||
}
|
||
|
||
@Override
|
||
public int ownerDelete(String user, String owner) {
|
||
EventRequest eventRequest = new EventRequest(user, "ownerDelete", owner, Module.administrationModule.getValue());
|
||
RequestCtx request = eventRequest.createRequest();
|
||
ResponseCtx result = MapSessions.APM.evaluate(request);
|
||
return processResult(result);
|
||
}
|
||
|
||
//####################################################
|
||
//############## Admin Module Section ################
|
||
//####################################################
|
||
public int superadmin(String user, String owner) {
|
||
EventRequest eventRequest = new EventRequest(user, "superadmin", owner, Module.administrationModule.getValue());
|
||
RequestCtx request = eventRequest.createRequest();
|
||
ResponseCtx result = MapSessions.APM.evaluate(request);
|
||
return processResult(result);
|
||
}
|
||
|
||
public int allAdminMethods(String user, String owner) {
|
||
EventRequest eventRequest = new EventRequest(user, "allAdminMethods", owner, Module.administrationModule.getValue());
|
||
RequestCtx request = eventRequest.createRequest();
|
||
ResponseCtx result = MapSessions.APM.evaluate(request);
|
||
return processResult(result);
|
||
}
|
||
|
||
public int allQueryMethods(String user, String owner) {
|
||
EventRequest eventRequest = new EventRequest(user, "allQueryMethods", owner, Module.administrationModule.getValue());
|
||
RequestCtx request = eventRequest.createRequest();
|
||
ResponseCtx result = MapSessions.APM.evaluate(request);
|
||
return processResult(result);
|
||
}
|
||
|
||
public int allCaptureMethods(String user, String owner) {
|
||
EventRequest eventRequest = new EventRequest(user, "allCaptureMethods", owner, Module.administrationModule.getValue());
|
||
RequestCtx request = eventRequest.createRequest();
|
||
ResponseCtx result = MapSessions.APM.evaluate(request);
|
||
return processResult(result);
|
||
}
|
||
|
||
@Override
|
||
public int createAdminOwnerGroup(String user, String owner) {
|
||
EventRequest eventRequest = new EventRequest(user, "createAdminOwnerGroup", owner, Module.administrationModule.getValue());
|
||
RequestCtx request = eventRequest.createRequest();
|
||
ResponseCtx result = MapSessions.APM.evaluate(request);
|
||
return processResult(result);
|
||
}
|
||
|
||
@Override
|
||
public int deleteAdminOwnerGroup(String user, String owner) {
|
||
EventRequest eventRequest = new EventRequest(user, "deleteAdminOwnerGroup", owner, Module.administrationModule.getValue());
|
||
RequestCtx request = eventRequest.createRequest();
|
||
ResponseCtx result = MapSessions.APM.evaluate(request);
|
||
return processResult(result);
|
||
}
|
||
|
||
@Override
|
||
public int addAdminOwnerToGroup(String user, String owner) {
|
||
EventRequest eventRequest = new EventRequest(user, "addAdminOwnerToGroup", owner, Module.administrationModule.getValue());
|
||
RequestCtx request = eventRequest.createRequest();
|
||
ResponseCtx result = MapSessions.APM.evaluate(request);
|
||
return processResult(result);
|
||
}
|
||
|
||
@Override
|
||
public int removeAdminOwnerFromGroup(String user, String owner) {
|
||
EventRequest eventRequest = new EventRequest(user, "removeAdminOwnerFromGroup", owner, Module.administrationModule.getValue());
|
||
RequestCtx request = eventRequest.createRequest();
|
||
ResponseCtx result = MapSessions.APM.evaluate(request);
|
||
return processResult(result);
|
||
}
|
||
|
||
@Override
|
||
public int switchAdminUserPermissionPolicy(String user, String owner) {
|
||
EventRequest eventRequest = new EventRequest(user, "switchAdminUserPermissionPolicy", owner, Module.administrationModule.getValue());
|
||
RequestCtx request = eventRequest.createRequest();
|
||
ResponseCtx result = MapSessions.APM.evaluate(request);
|
||
return processResult(result);
|
||
}
|
||
|
||
@Override
|
||
public int removeAdminUserPermission(String user, String owner) {
|
||
EventRequest eventRequest = new EventRequest(user, "removeAdminUserPermission", owner, Module.administrationModule.getValue());
|
||
RequestCtx request = eventRequest.createRequest();
|
||
ResponseCtx result = MapSessions.APM.evaluate(request);
|
||
return processResult(result);
|
||
}
|
||
|
||
@Override
|
||
public int addAdminUserPermission(String user, String owner) {
|
||
EventRequest eventRequest = new EventRequest(user, "addAdminUserPermission", owner, Module.administrationModule.getValue());
|
||
RequestCtx request = eventRequest.createRequest();
|
||
ResponseCtx result = MapSessions.APM.evaluate(request);
|
||
return processResult(result);
|
||
}
|
||
|
||
@Override
|
||
public int updateAdminGroupName(String user, String owner) {
|
||
EventRequest eventRequest = new EventRequest(user, "updateAdminGroupName", owner, Module.administrationModule.getValue());
|
||
RequestCtx request = eventRequest.createRequest();
|
||
ResponseCtx result = MapSessions.APM.evaluate(request);
|
||
return processResult(result);
|
||
}
|
||
|
||
@Override
|
||
public int saveAdminPolicyOwner(String user, String owner) {
|
||
EventRequest eventRequest = new EventRequest(user, "saveAdminPolicyOwner", owner, Module.administrationModule.getValue());
|
||
RequestCtx request = eventRequest.createRequest();
|
||
ResponseCtx result = MapSessions.APM.evaluate(request);
|
||
return processResult(result);
|
||
}
|
||
|
||
//####################################################
|
||
//################# Modules Section ##################
|
||
//####################################################
|
||
@Override
|
||
public int createOwnerGroup(String user, String owner) {
|
||
EventRequest eventRequest = new EventRequest(user, "createOwnerGroup", owner, Module.administrationModule.getValue());
|
||
RequestCtx request = eventRequest.createRequest();
|
||
ResponseCtx result = MapSessions.APM.evaluate(request);
|
||
return processResult(result);
|
||
}
|
||
|
||
@Override
|
||
public int deleteOwnerGroup(String user, String owner) {
|
||
EventRequest eventRequest = new EventRequest(user, "deleteOwnerGroup", owner, Module.administrationModule.getValue());
|
||
RequestCtx request = eventRequest.createRequest();
|
||
ResponseCtx result = MapSessions.APM.evaluate(request);
|
||
return processResult(result);
|
||
}
|
||
|
||
@Override
|
||
public int addOwnerToGroup(String user, String owner) {
|
||
EventRequest eventRequest = new EventRequest(user, "addOwnerToGroup", owner, Module.administrationModule.getValue());
|
||
RequestCtx request = eventRequest.createRequest();
|
||
ResponseCtx result = MapSessions.APM.evaluate(request);
|
||
return processResult(result);
|
||
}
|
||
|
||
@Override
|
||
public int removeOwnerFromGroup(String user, String owner) {
|
||
EventRequest eventRequest = new EventRequest(user, "removeOwnerFromGroup", owner, Module.administrationModule.getValue());
|
||
RequestCtx request = eventRequest.createRequest();
|
||
ResponseCtx result = MapSessions.APM.evaluate(request);
|
||
return processResult(result);
|
||
}
|
||
|
||
@Override
|
||
public int addBizStepRestriction(String user, String owner) {
|
||
EventRequest eventRequest = new EventRequest(user, "addBizStepRestriction", owner, Module.administrationModule.getValue());
|
||
RequestCtx request = eventRequest.createRequest();
|
||
ResponseCtx result = MapSessions.APM.evaluate(request);
|
||
return processResult(result);
|
||
}
|
||
|
||
@Override
|
||
public int removeBizStepRestriction(String user, String owner) {
|
||
EventRequest eventRequest = new EventRequest(user, "removeBizStepRestriction", owner, Module.administrationModule.getValue());
|
||
RequestCtx request = eventRequest.createRequest();
|
||
ResponseCtx result = MapSessions.APM.evaluate(request);
|
||
return processResult(result);
|
||
}
|
||
|
||
@Override
|
||
public int addEPCRestriction(String user, String owner) {
|
||
EventRequest eventRequest = new EventRequest(user, "addEPCRestriction", owner, Module.administrationModule.getValue());
|
||
RequestCtx request = eventRequest.createRequest();
|
||
ResponseCtx result = MapSessions.APM.evaluate(request);
|
||
return processResult(result);
|
||
}
|
||
|
||
@Override
|
||
public int removeEPCRestriction(String user, String owner) {
|
||
EventRequest eventRequest = new EventRequest(user, "removeEPCRestriction", owner, Module.administrationModule.getValue());
|
||
RequestCtx request = eventRequest.createRequest();
|
||
ResponseCtx result = MapSessions.APM.evaluate(request);
|
||
return processResult(result);
|
||
}
|
||
|
||
@Override
|
||
public int addEventTypeRestriction(String user, String owner) {
|
||
EventRequest eventRequest = new EventRequest(user, "addEventTypeRestriction", owner, Module.administrationModule.getValue());
|
||
RequestCtx request = eventRequest.createRequest();
|
||
ResponseCtx result = MapSessions.APM.evaluate(request);
|
||
return processResult(result);
|
||
}
|
||
|
||
@Override
|
||
public int removeEventTypeRestriction(String user, String owner) {
|
||
EventRequest eventRequest = new EventRequest(user, "removeEventTypeRestriction", owner, Module.administrationModule.getValue());
|
||
RequestCtx request = eventRequest.createRequest();
|
||
ResponseCtx result = MapSessions.APM.evaluate(request);
|
||
return processResult(result);
|
||
}
|
||
|
||
@Override
|
||
public int addTimeRestriction(String user, String owner) {
|
||
EventRequest eventRequest = new EventRequest(user, "addTimeRestriction", owner, Module.administrationModule.getValue());
|
||
RequestCtx request = eventRequest.createRequest();
|
||
ResponseCtx result = MapSessions.APM.evaluate(request);
|
||
return processResult(result);
|
||
}
|
||
|
||
@Override
|
||
public int removeTimeRestriction(String user, String owner) {
|
||
EventRequest eventRequest = new EventRequest(user, "removeTimeRestriction", owner, Module.administrationModule.getValue());
|
||
RequestCtx request = eventRequest.createRequest();
|
||
ResponseCtx result = MapSessions.APM.evaluate(request);
|
||
return processResult(result);
|
||
}
|
||
|
||
@Override
|
||
public int switchBizStepPolicy(String user, String owner) {
|
||
EventRequest eventRequest = new EventRequest(user, "switchBizStepPolicy", owner, Module.administrationModule.getValue());
|
||
RequestCtx request = eventRequest.createRequest();
|
||
ResponseCtx result = MapSessions.APM.evaluate(request);
|
||
return processResult(result);
|
||
}
|
||
|
||
@Override
|
||
public int switchEPCPolicy(String user, String owner) {
|
||
EventRequest eventRequest = new EventRequest(user, "switchEPCPolicy", owner, Module.administrationModule.getValue());
|
||
RequestCtx request = eventRequest.createRequest();
|
||
ResponseCtx result = MapSessions.APM.evaluate(request);
|
||
return processResult(result);
|
||
}
|
||
|
||
@Override
|
||
public int switchEventTypePolicy(String user, String owner) {
|
||
EventRequest eventRequest = new EventRequest(user, "switchEventTypePolicy", owner, Module.administrationModule.getValue());
|
||
RequestCtx request = eventRequest.createRequest();
|
||
ResponseCtx result = MapSessions.APM.evaluate(request);
|
||
return processResult(result);
|
||
}
|
||
|
||
@Override
|
||
public int switchTimePolicy(String user, String owner) {
|
||
EventRequest eventRequest = new EventRequest(user, "switchTimePolicy", owner, Module.administrationModule.getValue());
|
||
RequestCtx request = eventRequest.createRequest();
|
||
ResponseCtx result = MapSessions.APM.evaluate(request);
|
||
return processResult(result);
|
||
}
|
||
|
||
@Override
|
||
public int switchUserPermissionPolicy(String user, String owner) {
|
||
EventRequest eventRequest = new EventRequest(user, "switchUserPermissionPolicy", owner, Module.administrationModule.getValue());
|
||
RequestCtx request = eventRequest.createRequest();
|
||
ResponseCtx result = MapSessions.APM.evaluate(request);
|
||
return processResult(result);
|
||
}
|
||
|
||
@Override
|
||
public int removeUserPermission(String user, String owner) {
|
||
EventRequest eventRequest = new EventRequest(user, "removeUserPermission", owner, Module.administrationModule.getValue());
|
||
RequestCtx request = eventRequest.createRequest();
|
||
ResponseCtx result = MapSessions.APM.evaluate(request);
|
||
return processResult(result);
|
||
}
|
||
|
||
@Override
|
||
public int addUserPermission(String user, String owner) {
|
||
EventRequest eventRequest = new EventRequest(user, "addUserPermission", owner, Module.administrationModule.getValue());
|
||
RequestCtx request = eventRequest.createRequest();
|
||
ResponseCtx result = MapSessions.APM.evaluate(request);
|
||
return processResult(result);
|
||
}
|
||
|
||
@Override
|
||
public int updateGroupName(String user, String owner) {
|
||
EventRequest eventRequest = new EventRequest(user, "updateGroupName", owner, Module.administrationModule.getValue());
|
||
RequestCtx request = eventRequest.createRequest();
|
||
ResponseCtx result = MapSessions.APM.evaluate(request);
|
||
return processResult(result);
|
||
}
|
||
|
||
@Override
|
||
public int savePolicyOwner(String user, String owner) {
|
||
EventRequest eventRequest = new EventRequest(user, "savePolicyOwner", owner, Module.administrationModule.getValue());
|
||
RequestCtx request = eventRequest.createRequest();
|
||
ResponseCtx result = MapSessions.APM.evaluate(request);
|
||
return processResult(result);
|
||
}
|
||
|
||
private int processResult(ResponseCtx result) {
|
||
Iterator it = result.getResults().iterator();
|
||
while (it.hasNext()) {
|
||
Result res = (Result) it.next();
|
||
if (res != null) {
|
||
return res.getDecision();
|
||
}
|
||
}
|
||
return Result.DECISION_DENY;
|
||
}
|
||
}
|
DSeTa/DiscoveryPHI/src/main/java/fr/unicaen/iota/dphi/xacml/servlet/AccessControlPolicy.java | ||
---|---|---|
/*
|
||
* This program is a part of the IoTa project.
|
||
*
|
||
* Copyright © 2008-2013 Université de Caen Basse-Normandie, GREYC
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation, either version 3 of the License, or
|
||
* (at your option) any later version.
|
||
*
|
||
* This program is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
* <http://www.gnu.org/licenses/>
|
||
*
|
||
* See AUTHORS for a list of contributors.
|
||
*/
|
||
package fr.unicaen.iota.dphi.xacml.servlet;
|
||
|
||
import fr.unicaen.iota.dphi.xacml.ihm.NodeType;
|
||
import fr.unicaen.iota.dphi.xacml.ihm.TreeNode;
|
||
import fr.unicaen.iota.dphi.xacml.ihm.Mode;
|
||
import fr.unicaen.iota.dphi.xacml.ihm.TreeFactory;
|
||
import fr.unicaen.iota.dphi.xacml.ihm.Module;
|
||
import fr.unicaen.iota.dphi.auth.User;
|
||
import fr.unicaen.iota.mu.Utils;
|
||
import fr.unicaen.iota.dphi.utils.InterfaceHelper;
|
||
import fr.unicaen.iota.dphi.utils.MapSessions;
|
||
import fr.unicaen.iota.dphi.xacml.ihm.factory.AccessPolicies;
|
||
import fr.unicaen.iota.dphi.xacml.ihm.factory.Node;
|
||
import fr.unicaen.iota.xacml.policy.GroupPolicy;
|
||
import java.io.IOException;
|
||
import java.io.PrintWriter;
|
||
import javax.servlet.ServletException;
|
||
import javax.servlet.http.HttpServlet;
|
||
import javax.servlet.http.HttpServletRequest;
|
||
import javax.servlet.http.HttpServletResponse;
|
||
import org.apache.commons.logging.Log;
|
||
import org.apache.commons.logging.LogFactory;
|
||
|
||
/**
|
||
*
|
||
*/
|
||
public class AccessControlPolicy extends HttpServlet {
|
||
|
||
private Services services = new Services();
|
||
|
||
private static final Log log = LogFactory.getLog(AccessControlPolicy.class);
|
||
|
||
/**
|
||
* Processes requests for both HTTP
|
||
* <code>GET</code> and
|
||
* <code>POST</code> methods.
|
||
*
|
||
* @param request servlet request
|
||
* @param response servlet response
|
||
* @throws ServletException if a servlet-specific error occurs
|
||
* @throws IOException if an I/O error occurs
|
||
*/
|
||
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
|
||
throws ServletException, IOException {
|
||
response.setContentType("text/xml;charset=UTF-8");
|
||
PrintWriter out = response.getWriter();
|
||
StringBuilder html = new StringBuilder();
|
||
try {
|
||
// ************************** CREATE *********************************
|
||
try {
|
||
if (request.getSession().getAttribute("user") == null || request.getSession().getAttribute("cert") == null) {
|
||
throw new ServiceException("Session expired you have to reconnect !", ServiceErrorType.ds);
|
||
}
|
||
String dn = (request.getUserPrincipal() != null) ? request.getUserPrincipal().getName() : null;
|
||
if (request.getSession().getAttribute("cert") != null) {
|
||
String cert = (String) request.getSession().getAttribute("cert");
|
||
if (!cert.equals(Utils.formatId(dn))) {
|
||
throw new ServiceException("Don't change your certificate!", ServiceErrorType.unknown);
|
||
}
|
||
}
|
||
User user = (User) request.getSession().getAttribute("user");
|
||
Module module = (request.getParameter("d") != null) ? Module.valueOf(request.getParameter("d")) : null;
|
||
String objectId = request.getParameter("b");
|
||
String groupId = request.getParameter("e");
|
||
String userId = user.getUserID();
|
||
String a = request.getParameter("a");
|
||
// ************************** CREATE *********************************
|
||
if ("createOwnerGroup".equals(a)) {
|
||
String newValue = request.getParameter("c");
|
||
String resp = services.createOwnerGroup(userId, user, module, newValue);
|
||
TreeNode node = createEmptyPolicies(user, newValue, module, resp);
|
||
html.append(new TreeFactory(Mode.Assert_Mode).createTree(node));
|
||
}
|
||
else if ("addOwnerToGroup".equals(a)) {
|
||
String newValue = request.getParameter("c");
|
||
services.addOwnerToGroup(userId, user, module, objectId, groupId, newValue);
|
||
TreeNode node = new Node(newValue, NodeType.userNode, newValue, module, groupId);
|
||
html.append(new TreeFactory(Mode.Assert_Mode).createTree(node));
|
||
}
|
||
else if ("addBizStepRestriction".equals(a)) {
|
||
String newValue = request.getParameter("c");
|
||
services.addBizStepRestriction(userId, user, module, objectId, groupId, newValue);
|
||
TreeNode node = new Node(newValue, NodeType.bizStepFilterNode, newValue, module, groupId);
|
||
html.append(new TreeFactory(Mode.Assert_Mode).createTree(node));
|
||
}
|
||
else if ("addEPCRestriction".equals(a)) {
|
||
String newValue = request.getParameter("c");
|
||
services.addEPCRestriction(userId, user, module, objectId, groupId, newValue);
|
||
TreeNode node = new Node(newValue, NodeType.epcFilterNode, newValue, module, groupId);
|
||
html.append(new TreeFactory(Mode.Assert_Mode).createTree(node));
|
||
}
|
||
else if ("addEventTypeRestriction".equals(a)) {
|
||
String newValue = request.getParameter("c");
|
||
services.addEventTypeRestriction(userId, user, module, objectId, groupId, newValue);
|
||
TreeNode node = new Node(newValue, NodeType.eventTypeFilterNode, newValue, module, groupId);
|
||
html.append(new TreeFactory(Mode.Assert_Mode).createTree(node));
|
||
}
|
||
else if ("addTimeRestriction".equals(a)) {
|
||
String d1 = request.getParameter("d1");
|
||
String d2 = request.getParameter("d2");
|
||
services.addTimeRestriction(userId, user, module, objectId, groupId, d1, d2);
|
||
TreeNode node = new Node(d1 + " -> " + d2, NodeType.eventTimeFilterNode, d1 + " -> " + d2, module, groupId);
|
||
html.append(new TreeFactory(Mode.Assert_Mode).createTree(node));
|
||
}
|
||
else if ("addUserPermission".equals(a)) {
|
||
String newValue = request.getParameter("c");
|
||
services.addUserPermission(userId, user, module, objectId, groupId, newValue);
|
||
TreeNode node = new Node(newValue, NodeType.methodFilterNode, newValue, module, groupId);
|
||
html.append(new TreeFactory(Mode.Assert_Mode).createTree(node));
|
||
} // ************************** SWITCH *********************************
|
||
else if ("switchBizStepPolicy".equals(a)) {
|
||
html.append(services.switchBizStepPolicy(userId, user, module, objectId, groupId));
|
||
}
|
||
else if ("switchEPCPolicy".equals(a)) {
|
||
html.append(services.switchEPCPolicy(userId, user, module, objectId, groupId));
|
||
}
|
||
else if ("switchEventTypePolicy".equals(a)) {
|
||
html.append(services.switchEventTypePolicy(userId, user, module, objectId, groupId));
|
||
}
|
||
else if ("switchTimePolicy".equals(a)) {
|
||
html.append(services.switchTimePolicy(userId, user, module, objectId, groupId));
|
||
}
|
||
else if ("switchPermissionPolicy".equals(a)) {
|
||
html.append(services.switchUserPermissionPolicy(userId, user, module, objectId, groupId));
|
||
} // ************************** REMOVE *********************************
|
||
else if ("removeBizStepRestriction".equals(a)) {
|
||
services.removeBizStepRestriction(userId, user, module, objectId, groupId);
|
||
}
|
||
else if ("removeEPCRestriction".equals(a)) {
|
||
services.removeEPCRestriction(userId, user, module, objectId, groupId);
|
||
}
|
||
else if ("removeEventTypeRestriction".equals(a)) {
|
||
services.removeEventTypeRestriction(userId, user, module, objectId, groupId);
|
||
}
|
||
else if ("removeTimeRestriction".equals(a)) {
|
||
services.removeTimeRestriction(userId, user, module, objectId, groupId);
|
||
}
|
||
else if ("removeUserPermission".equals(a)) {
|
||
services.removeUserPermission(userId, user, module, objectId, groupId);
|
||
}
|
||
else if ("deleteOwnerGroup".equals(a)) {
|
||
services.deleteOwnerGroup(userId, user, module, objectId, groupId);
|
||
}
|
||
else if ("removeOwnerFromGroup".equals(a)) {
|
||
services.removeOwnerFromGroup(userId, user, module, objectId, groupId);
|
||
} // ************************* DS ADMIN ********************************
|
||
else if ("createUser".equals(a)) {
|
||
String userDN = request.getParameter("f");
|
||
String userName = request.getParameter("g");
|
||
services.createUser(user, userDN, userName);
|
||
}
|
||
else if ("updateUser".equals(a)) {
|
||
String login = request.getParameter("f");
|
||
String pass = request.getParameter("g");
|
||
//services.updateUser(sessionId, user, login, pass);
|
||
}
|
||
else if ("deleteUser".equals(a)) {
|
||
String login = request.getParameter("f");
|
||
services.deleteUser(user, login);
|
||
}
|
||
else if ("createAccount".equals(a)) {
|
||
String userDN = request.getParameter("f");
|
||
String owner = request.getParameter("g");
|
||
String userName = request.getParameter("h");
|
||
boolean rtr = services.createAccount(user, owner, userDN, userName);
|
||
if (rtr) {
|
||
html.append("Account successfull created.");
|
||
}
|
||
} // ************************** UPDATE *********************************
|
||
else if ("updateGroupName".equals(a)) {
|
||
String newValue = request.getParameter("c");
|
||
services.updateGroupName(userId, user, module, objectId, groupId, newValue);
|
||
|
||
} // ************************** SAVE **********************************
|
||
else if ("savePolicyOwner".equals(a)) {
|
||
services.savePolicyOwner(userId, user, module);
|
||
|
||
} // ************************** CANCEL **********************************
|
||
else if ("cancelOwnerPolicy".equals(a)) {
|
||
services.cancelOwnerPolicy(user, module);
|
||
|
||
} // ************************** LOAD POLICIES *************************
|
||
else if ("loadPolicyTree".equals(a)) {
|
||
services.loadPolicyTree(user, module);
|
||
InterfaceHelper interfaceHelper = MapSessions.getAPMSession(userId, user.getOwnerID());
|
||
interfaceHelper.reload();
|
||
AccessPolicies policies = new AccessPolicies(userId, user.getOwnerID(), module);
|
||
switch (module) {
|
||
case adminModule:
|
||
html.append(new TreeFactory(Mode.Create_Mode).createTree(policies.getPoliciesAdmin().get(0)));
|
||
break;
|
||
case queryModule:
|
||
html.append(new TreeFactory(Mode.Create_Mode).createTree(policies.getPoliciesQuery().get(0)));
|
||
break;
|
||
case captureModule:
|
||
html.append(new TreeFactory(Mode.Create_Mode).createTree(policies.getPoliciesCapture().get(0)));
|
||
break;
|
||
}
|
||
}
|
||
else {
|
||
throw new ServiceException("service method " + a + " not found!", ServiceErrorType.unknown);
|
||
}
|
||
out.print(createXMLEnvelop(createXMLRespondeHeader(Response.Value.OK, "") + createXMLHTMLTag(html.toString())));
|
||
} catch (ServiceException se) {
|
||
log.info("", se);
|
||
out.print(createXMLEnvelop(createXMLRespondeHeader(Response.Value.ERROR, se.getMessage())
|
||
+ createXMLHTMLTag(html.toString())));
|
||
} catch (Exception e) {
|
||
log.info("", e);
|
||
out.print(createXMLEnvelop(createXMLRespondeHeader(Response.Value.ERROR, "INTERNAL ERROR: "
|
||
+ e.getMessage()) + createXMLHTMLTag(html.toString())));
|
||
}
|
||
} finally {
|
||
out.close();
|
||
}
|
||
}
|
||
|
||
public String createXMLEnvelop(String content) {
|
||
return "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<response>\n" + content + "</response>";
|
||
}
|
||
|
||
public String createXMLRespondeHeader(Response.Value code, String message) {
|
||
return "<result>\n<id>" + code.toString() + "</id>\n<desc>" + message + "</desc>\n</result>\n";
|
||
}
|
||
|
||
private String createXMLHTMLTag(String html) {
|
||
return "<htmlcontent>\n<![CDATA[" + html + "]]>\n</htmlcontent>";
|
||
}
|
||
|
||
public TreeNode createEmptyPolicies(User user, String name, Module module, String groupId) {
|
||
GroupPolicy gpq = new GroupPolicy(name, user.getOwnerID());
|
||
AccessPolicies accessPolicies = new AccessPolicies();
|
||
return accessPolicies.createGroupPolicy(gpq, module);
|
||
}
|
||
|
||
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
|
||
/**
|
||
* Handles the HTTP
|
||
* <code>GET</code> method.
|
||
*
|
||
* @param request servlet request
|
||
* @param response servlet response
|
||
* @throws ServletException if a servlet-specific error occurs
|
||
* @throws IOException if an I/O error occurs
|
||
*/
|
||
@Override
|
||
protected void doGet(HttpServletRequest request, HttpServletResponse response)
|
||
throws ServletException, IOException {
|
||
processRequest(request, response);
|
||
}
|
||
|
||
/**
|
||
* Handles the HTTP
|
||
* <code>POST</code> method.
|
||
*
|
||
* @param request servlet request
|
||
* @param response servlet response
|
||
* @throws ServletException if a servlet-specific error occurs
|
||
* @throws IOException if an I/O error occurs
|
||
*/
|
||
@Override
|
||
protected void doPost(HttpServletRequest request, HttpServletResponse response)
|
||
throws ServletException, IOException {
|
||
processRequest(request, response);
|
||
}
|
||
|
||
/**
|
||
* Returns a short description of the servlet.
|
||
*
|
||
* @return a String containing servlet description
|
||
*/
|
||
@Override
|
||
public String getServletInfo() {
|
||
return "Short description";
|
||
}// </editor-fold>
|
||
}
|
DSeTa/DiscoveryPHI/src/main/java/fr/unicaen/iota/dphi/xacml/servlet/Response.java | ||
---|---|---|
/*
|
||
* This program is a part of the IoTa project.
|
||
*
|
||
* Copyright © 2008-2012 Université de Caen Basse-Normandie, GREYC
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation, either version 3 of the License, or
|
||
* (at your option) any later version.
|
||
*
|
||
* This program is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
* <http://www.gnu.org/licenses/>
|
||
*
|
||
* See AUTHORS for a list of contributors.
|
||
*/
|
||
package fr.unicaen.iota.dphi.xacml.servlet;
|
||
|
||
/**
|
||
*
|
||
*/
|
||
public class Response {
|
||
|
||
static public enum Value {
|
||
|
||
OK("1"),
|
||
ERROR("2");
|
||
private String str;
|
||
|
||
private Value(String str) {
|
||
this.str = str;
|
||
}
|
||
|
||
@Override
|
||
public String toString() {
|
||
return str;
|
||
}
|
||
}
|
||
private Value value;
|
||
private String desc;
|
||
|
||
public Response(Value value, String desc) {
|
||
this.value = value;
|
||
this.desc = desc;
|
||
}
|
||
|
||
/**
|
||
* @return the value
|
||
*/
|
||
public Value getValue() {
|
||
return value;
|
||
}
|
||
|
||
/**
|
||
* @param value the value to set
|
||
*/
|
||
public void setValue(Value value) {
|
||
this.value = value;
|
||
}
|
||
|
||
/**
|
||
* @return the desc
|
||
*/
|
||
public String getDesc() {
|
||
return desc;
|
||
}
|
||
|
||
/**
|
||
* @param desc the desc to set
|
||
*/
|
||
public void setDesc(String desc) {
|
||
this.desc = desc;
|
||
}
|
||
}
|
DSeTa/DiscoveryPHI/src/main/java/fr/unicaen/iota/dphi/xacml/servlet/RootAccountAuth.java | ||
---|---|---|
/*
|
||
* This program is a part of the IoTa project.
|
||
*
|
||
* Copyright © 2008-2013 Université de Caen Basse-Normandie, GREYC
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation, either version 3 of the License, or
|
||
* (at your option) any later version.
|
||
*
|
||
* This program is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
* <http://www.gnu.org/licenses/>
|
||
*
|
||
* See AUTHORS for a list of contributors.
|
||
*/
|
||
package fr.unicaen.iota.dphi.xacml.servlet;
|
||
|
||
import fr.unicaen.iota.dphi.auth.User;
|
||
import fr.unicaen.iota.mu.Utils;
|
||
import fr.unicaen.iota.dphi.utils.Constants;
|
||
import fr.unicaen.iota.dphi.utils.MapSessions;
|
||
import fr.unicaen.iota.ypsilon.client.YPSilonClient;
|
||
import fr.unicaen.iota.ypsilon.client.model.UserLookupOut;
|
||
import fr.unicaen.iota.ypsilon.client.soap.ImplementationExceptionResponse;
|
||
import java.io.IOException;
|
||
import javax.servlet.ServletException;
|
||
import javax.servlet.http.HttpServlet;
|
||
import javax.servlet.http.HttpServletRequest;
|
||
import javax.servlet.http.HttpServletResponse;
|
||
import org.apache.commons.logging.Log;
|
||
import org.apache.commons.logging.LogFactory;
|
||
|
||
/**
|
||
*
|
||
*/
|
||
public class RootAccountAuth extends HttpServlet {
|
||
|
||
private static final Log LOG = LogFactory.getLog(RootAccountAuth.class);
|
||
/**
|
||
* Processes requests for both HTTP
|
||
* <code>GET</code> and
|
||
* <code>POST</code> methods.
|
||
*
|
||
* @param request servlet request
|
||
* @param response servlet response
|
||
*/
|
||
|
||
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
|
||
throws ServletException, IOException {
|
||
if ("login".equals(request.getParameter("action"))) {
|
||
String login = (request.getUserPrincipal() != null)? request.getUserPrincipal().getName() : null;
|
||
if (login == null || login.isEmpty()) {
|
||
request.setAttribute("message", "You are not authenticated.");
|
||
} else {
|
||
login = Utils.formatId(login);
|
||
try {
|
||
YPSilonClient ypsilonClient = new YPSilonClient(Constants.YPSILON_ADDRESS, Constants.PKS_FILENAME,
|
||
Constants.PKS_PASSWORD, Constants.TRUST_PKS_FILENAME, Constants.TRUST_PKS_PASSWORD);
|
||
UserLookupOut userLookupOut = ypsilonClient.userLookup(login);
|
||
if (userLookupOut.getUserList().isEmpty()) {
|
||
throw new ImplementationExceptionResponse("User not found");
|
||
}
|
||
User user = new User();
|
||
user.setUserID(login);
|
||
user.setOwnerID(userLookupOut.getUserList().get(0).getOwner());
|
||
request.getSession().setAttribute("user", user);
|
||
request.getSession().setAttribute("cert", login);
|
||
} catch (ImplementationExceptionResponse ex) {
|
||
request.setAttribute("message", ex.getMessage());
|
||
LOG.error("impl", ex);
|
||
}
|
||
}
|
||
request.getRequestDispatcher("index.jsp").forward(request, response);
|
||
} else if ("logout".equals(request.getParameter("action"))) {
|
||
String cert = (String) (request.getSession().getAttribute("cert"));
|
||
MapSessions.releaseSession(cert);
|
||
request.getSession().setAttribute("user", null);
|
||
request.getSession().setAttribute("cert", null);
|
||
response.sendRedirect("index.jsp");
|
||
}
|
||
}
|
||
|
||
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
|
||
/**
|
||
* Handles the HTTP
|
||
* <code>GET</code> method.
|
||
*
|
||
* @param request servlet request
|
||
* @param response servlet response
|
||
*/
|
||
protected void doGet(HttpServletRequest request, HttpServletResponse response)
|
||
throws ServletException, IOException {
|
||
processRequest(request, response);
|
||
}
|
||
|
||
/**
|
||
* Handles the HTTP
|
||
* <code>POST</code> method.
|
||
*
|
||
* @param request servlet request
|
||
* @param response servlet response
|
||
*/
|
||
protected void doPost(HttpServletRequest request, HttpServletResponse response)
|
||
throws ServletException, IOException {
|
||
processRequest(request, response);
|
||
}
|
||
|
||
/**
|
||
* Returns a short description of the servlet.
|
||
*/
|
||
public String getServletInfo() {
|
||
return "Short description";
|
||
}// </editor-fold>
|
||
}
|
DSeTa/DiscoveryPHI/src/main/java/fr/unicaen/iota/dphi/xacml/servlet/ServiceErrorType.java | ||
---|---|---|
/*
|
||
* This program is a part of the IoTa project.
|
||
*
|
||
* Copyright © 2008-2012 Université de Caen Basse-Normandie, GREYC
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation, either version 3 of the License, or
|
||
* (at your option) any later version.
|
||
*
|
||
* This program is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
* <http://www.gnu.org/licenses/>
|
||
*
|
||
* See AUTHORS for a list of contributors.
|
||
*/
|
||
package fr.unicaen.iota.dphi.xacml.servlet;
|
||
|
||
/**
|
||
*
|
||
*/
|
||
public enum ServiceErrorType {
|
||
|
||
unknown,
|
||
xacml,
|
||
ds;
|
||
}
|
DSeTa/DiscoveryPHI/src/main/java/fr/unicaen/iota/dphi/xacml/servlet/ServiceException.java | ||
---|---|---|
/*
|
||
* This program is a part of the IoTa project.
|
||
*
|
||
* Copyright © 2008-2012 Université de Caen Basse-Normandie, GREYC
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation, either version 3 of the License, or
|
||
* (at your option) any later version.
|
||
*
|
||
* This program is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
* <http://www.gnu.org/licenses/>
|
||
*
|
||
* See AUTHORS for a list of contributors.
|
||
*/
|
||
package fr.unicaen.iota.dphi.xacml.servlet;
|
||
|
||
/**
|
||
*
|
||
*/
|
||
public class ServiceException extends Exception {
|
||
|
||
private ServiceErrorType type;
|
||
|
||
public ServiceException(String message, ServiceErrorType type) {
|
||
super(message);
|
||
this.type = type;
|
||
}
|
||
|
||
/**
|
||
* @return the type
|
||
*/
|
||
public ServiceErrorType getType() {
|
||
return type;
|
||
}
|
||
}
|
DSeTa/DiscoveryPHI/src/main/java/fr/unicaen/iota/dphi/xacml/servlet/Services.java | ||
---|---|---|
/*
|
||
* This program is a part of the IoTa project.
|
||
*
|
||
* Copyright © 2008-2013 Université de Caen Basse-Normandie, GREYC
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation, either version 3 of the License, or
|
||
* (at your option) any later version.
|
||
*
|
||
* This program is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
Version 2.1
- a few bugs fixed!
- uses the new DS events
- improves the session management
- the account creation by the web interface adds access policies to
the interface ("admin" policies), this is always done even if a
corresponding account exists in the LDAP directory
- simplifies the service
- upgrades Apache Tomcat to 7.0.42