Skip to content
Snippets Groups Projects
Commit be16ad95 authored by mbrodhu's avatar mbrodhu
Browse files

tets

parent 22854802
No related branches found
No related tags found
No related merge requests found
......@@ -38,21 +38,11 @@
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
......@@ -74,8 +64,6 @@
<artifactId>httpclients</artifactId>
<version>${textgrid.httpclients.version}</version>
</dependency>
<!-- >dependency> <groupId>org.openrdf.sesame</groupId> <artifactId>sesame-runtime</artifactId>
<version>2.5.0</version> </dependency -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
......@@ -111,8 +99,6 @@
<enabled>true</enabled>
</snapshots>
</repository>
<!-- repository> <id>aduna</id> <name>Aduna Software</name> <url>http://repo.aduna-software.org/maven2/releases/</url>
</repository -->
</repositories>
<build>
<pluginManagement>
......@@ -156,53 +142,6 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.3</version>
<executions>
<execution>
<id>do-get</id>
<phase>initialize</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<!-- download wsdl task -->
<get usetimestamp="true" src="${tgauth.wsdl}" dest="tgextra.wsdl" />
<!--get usetimestamp="true" src="https://develop.sub.uni-goettingen.de/repos/textgrid/trunk/middleware/tgauth/info.textgrid.middleware.tgauth.rbac/rbacSoap/wsdl-productive/tgextra.wsdl"
dest="tgextra.wsdl"/ -->
</tasks>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>${cxf.version}</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<wsdlOptions>
<wsdlOption>
<wsdl>tgextra.wsdl</wsdl>
<extraargs>
<extraarg>-fe</extraarg>
<extraarg>jaxws21</extraarg>
</extraargs>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
package info.textgrid.middleware;
import info.textgrid.middleware.oaipmh.HeaderType;
import info.textgrid.middleware.oaipmh.ListIdentifiersType;
import info.textgrid.middleware.oaipmh.RequestType;
import java.text.ParseException;
import javax.xml.datatype.DatatypeConfigurationException;
......@@ -11,9 +17,7 @@ import org.elasticsearch.index.query.QueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.SearchHit;
import info.textgrid.middleware.oaipmh.HeaderType;
import info.textgrid.middleware.oaipmh.ListIdentifiersType;
import info.textgrid.middleware.oaipmh.RequestType;
/**
* Class to build the Element for a ListIdentifiers request
......@@ -173,18 +177,18 @@ public class IdentifierListDeliverer {
if (this.textgrid && hit.getFields().get(formatField).getValue()
.toString().equals(formatToFilter)) {
System.out.println("textgrid!!!!");
datestamp = hit.getFields().get(dateOfObjectCreation)
.getValue().toString();
/*try {
try {
// XMLGregorianCalendar convertedDateFormat=
// OAIPMHUtillities.convertDateFormat(datestamp);
datestamp = OAIPMHUtillities.convertDateFormat(
datestamp).toXMLFormat();
} catch (DatatypeConfigurationException e) {
log.debug(e);
}*/
}
try {
......
package info.textgrid.middleware.oaipmh.auth;
import java.util.List;
public interface AuthClient {
List<String> filterUris(String sessionId, List<String> uris);
List<String> getUrisForProject(String sid, String id);
List<String> getProjectsForSID(String sid);
boolean isProjectAuth();
}
package info.textgrid.middleware.oaipmh.auth;
import info.textgrid.namespaces.middleware.tgauth.AuthenticationFault;
import info.textgrid.namespaces.middleware.tgauth.FilterBySidRequest;
import info.textgrid.namespaces.middleware.tgauth.FilterResponse;
import info.textgrid.namespaces.middleware.tgauth.GetObjectsRequest;
import info.textgrid.namespaces.middleware.tgauth.PortTgextra;
import info.textgrid.namespaces.middleware.tgauth.ResourcesetResponse;
import info.textgrid.namespaces.middleware.tgauth.RolesetResponse;
import info.textgrid.namespaces.middleware.tgauth.TgAssignedProjectsRequest;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class TGAuthClient implements AuthClient {
static final boolean PROJECT_AUTH = true;
private PortTgextra tgp;
private Log log = LogFactory.getLog(TGAuthClient.class);
public TGAuthClient(PortTgextra tgExtraClient){
tgp = tgExtraClient;
}
/**
*
*/
@Override
public List<String> filterUris(String sessionId, List<String> uris) {
// do not modify incoming list, copy for retainAll operation
List<String> response = new ArrayList<String>(uris);
FilterBySidRequest filterBySidInput = new FilterBySidRequest();
filterBySidInput.setAuth(sessionId);
filterBySidInput.setOperation("read");
//TODO: set logstring
filterBySidInput.setLog("");
filterBySidInput.getResource().addAll(response);
List<String> allowed = null;
try {
log.debug("start filterUris: "+ new Date());
FilterResponse res = tgp.filterBySid(filterBySidInput);
allowed = res.getResource();
log.debug("end filterUris: "+ new Date());
} catch (AuthenticationFault e) {
//log.error(e);
log.error("filterUris: Failure regarding to sid ", e);
}
// we need to keep the order of the list, tgauth doesn't guarantee this, so intersect
response.retainAll(allowed);
return response;
}
@Override
public List<String> getUrisForProject(String sessionId, String projectId) {
GetObjectsRequest getObjectsInput = new GetObjectsRequest();
getObjectsInput.setAuth(sessionId);
//getObjectsInput.setLog(tglog.getLoginfo());
getObjectsInput.setProject(projectId);
log.debug("start getObjects: "+ new Date());
ResourcesetResponse res = tgp.getObjects(getObjectsInput);
log.debug("end getObjects: "+ new Date());
List<String> uris = new ArrayList<String>(res.getResource());
return uris;
}
@Override
public List<String> getProjectsForSID(String sid) {
TgAssignedProjectsRequest tgAssignedProjectsInput = new TgAssignedProjectsRequest();
tgAssignedProjectsInput.setAuth(sid);
RolesetResponse res = tgp.tgAssignedProjects(tgAssignedProjectsInput);
return res.getRole();
}
@Override
public boolean isProjectAuth() {
// TODO Auto-generated method stub
return TGAuthClient.PROJECT_AUTH;
}
}
......@@ -46,21 +46,8 @@
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-security-cors</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>info.textgrid.middleware</groupId>
<artifactId>oaipmh-core</artifactId>
......
......@@ -7,9 +7,7 @@
<packaging>pom</packaging>
<name>TextGrid :: TG-OAI-PMH :: Parent</name>
<properties>
<tgauth.wsdl>https://textgridlab.org/1.0/tgauth/rbacSoap/wsdl/tgextra.wsdl</tgauth.wsdl>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<sonar.host.url>https://ci.bibforge.org/sonar</sonar.host.url>
<cxf.version>3.0.3</cxf.version>
<tgcrud.version>5.5.9-SNAPSHOT</tgcrud.version>
<spring.version>4.0.2.RELEASE</spring.version>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment