Skip to content

Commit

Permalink
Merge branch 'hotfix/UV_Core_v2.0.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
peterklimo committed May 29, 2015
2 parents 30c6446 + 365c7cf commit 2c2603b
Show file tree
Hide file tree
Showing 27 changed files with 548 additions and 37 deletions.
2 changes: 1 addition & 1 deletion backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>eu.unifiedviews</groupId>
<artifactId>uv-core</artifactId>
<version>2.0.1</version>
<version>2.0.2</version>
</parent>
<artifactId>backend</artifactId>
<packaging>jar</packaging>
Expand Down
2 changes: 1 addition & 1 deletion backend/src/main/resources/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<logger name="httpclient.wire.header" level="WARN"/>
<logger name="httpclient.wire.content" level="WARN"/>

<root level="ALL">
<root level="INFO">
<appender-ref ref="STDOUT"/>
</root>

Expand Down
2 changes: 1 addition & 1 deletion commons-app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>eu.unifiedviews</groupId>
<artifactId>uv-core</artifactId>
<version>2.0.1</version>
<version>2.0.2</version>
</parent>
<artifactId>commons-app</artifactId>
<name>commons-app</name>
Expand Down
2 changes: 1 addition & 1 deletion dataunit-file-impl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>eu.unifiedviews</groupId>
<artifactId>uv-core</artifactId>
<version>2.0.1</version>
<version>2.0.2</version>
</parent>
<artifactId>dataunit-file-impl</artifactId>
<name>dataunit-file-impl</name>
Expand Down
2 changes: 1 addition & 1 deletion dataunit-file/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>eu.unifiedviews</groupId>
<artifactId>uv-core</artifactId>
<version>2.0.1</version>
<version>2.0.2</version>
</parent>
<artifactId>dataunit-file</artifactId>
<name>dataunit-file</name>
Expand Down
2 changes: 1 addition & 1 deletion dataunit-rdf-impl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>uv-core</artifactId>
<groupId>eu.unifiedviews</groupId>
<version>2.0.1</version>
<version>2.0.2</version>
</parent>
<artifactId>dataunit-rdf-impl</artifactId>
<name>dataunit-rdf-impl</name>
Expand Down
2 changes: 1 addition & 1 deletion dataunit-rdf/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>eu.unifiedviews</groupId>
<artifactId>uv-core</artifactId>
<version>2.0.1</version>
<version>2.0.2</version>
</parent>
<artifactId>dataunit-rdf</artifactId>
<name>dataunit-rdf</name>
Expand Down
4 changes: 2 additions & 2 deletions dataunit-relational-impl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>uv-core</artifactId>
<groupId>eu.unifiedviews</groupId>
<version>2.0.1</version>
<version>2.0.2</version>
</parent>

<groupId>eu.unifiedviews</groupId>
Expand Down Expand Up @@ -46,4 +46,4 @@
<scope>test</scope>
</dependency>
</dependencies>
</project>
</project>
2 changes: 1 addition & 1 deletion dataunit/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>eu.unifiedviews</groupId>
<artifactId>uv-core</artifactId>
<version>2.0.1</version>
<version>2.0.2</version>
</parent>
<artifactId>dataunit</artifactId>
<description>Base project for new DataUnit's implementations.</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@
import eu.unifiedviews.dataunit.WritableMetadataDataUnit;

/**
*
*
* @author Michal Klempa
* @author Škoda Petr
*/
Expand Down Expand Up @@ -105,7 +103,7 @@ public abstract class AbstractWritableMetadataDataUnit implements WritableMetada
final AtomicInteger entryCounter = new AtomicInteger(0);

/**
*Services from core.
* Services from core.
*/
protected final CoreServiceBus coreServices;

Expand Down Expand Up @@ -358,22 +356,22 @@ public void execute(RepositoryConnection connection) throws RepositoryException,
}

/**
*
* @return New unique URI for an entry.
*/
protected URI creatEntitySubject() {
return connectionSource.getValueFactory().createURI(
writeContext
+ "/entry/"
+ Integer.toString(entryCounter.incrementAndGet()));
writeContext
+ "/entry/"
+ Integer.toString(entryCounter.incrementAndGet()));
}

/**
* Create a new entry.
*
*
* @param entrySubject
* @param symbolicName
* @param connection Connection used to add data. Will not be closed.
* @param connection
* Connection used to add data. Will not be closed.
* @return Subject of the new entry.
* @throws org.openrdf.repository.RepositoryException
* @throws DataUnitException
Expand Down Expand Up @@ -423,7 +421,7 @@ private void closeOpenedConnection() {

/**
* Check for duplicity for entry in given graphs.
*
*
* @param graphs
*/
private void checkForDuplicitEntries(Set<URI> graphs) throws DataUnitException {
Expand Down Expand Up @@ -457,7 +455,7 @@ public void execute(RepositoryConnection connection) throws RepositoryException,
final BindingSet bindingSet = result.next();
final String symbolicName = bindingSet.getValue(SYMBOLIC_NAME_BINDING).stringValue();
containDuplicity = true;
LOG.error("Duplicity entry found for symbollic name: %s", symbolicName);
LOG.error("Duplicate entry found for symbolic name: {}", symbolicName);
}
} catch (QueryEvaluationException ex) {
throw new DataUnitException(ex);
Expand All @@ -483,14 +481,15 @@ public void execute(RepositoryConnection connection) throws RepositoryException,

/**
* Read and return value of a single object.
*
*
* @param connection
* @param subject
* @param predicate
* @param graph
* @return Result of given query.
* @throws RepositoryException
* @throws DataUnitException In case that there is more than one object.
* @throws DataUnitException
* In case that there is more than one object.
*/
private Value getSingleObject(RepositoryConnection connection, URI subject, URI predicate, URI graph)
throws RepositoryException, DataUnitException {
Expand Down
2 changes: 1 addition & 1 deletion frontend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>eu.unifiedviews</groupId>
<artifactId>uv-core</artifactId>
<version>2.0.1</version>
<version>2.0.2</version>
</parent>
<artifactId>frontend</artifactId>
<packaging>war</packaging>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package cz.cuni.mff.xrg.odcs.frontend.auth;

import javax.servlet.http.HttpServletRequest;

import org.springframework.security.web.authentication.WebAuthenticationDetails;

public class UVAuthenticationDetails extends WebAuthenticationDetails {

private String forwardedHost;

private String host;

private String scheme;

private static final String HTTP_HEADER_FORWARDED_HOST = "X-Forwarded-Host";

private static final String HTTP_HEADER_HOST = "Host";

private static final String HTTP_HEADER_SCHEME = "Scheme";

public UVAuthenticationDetails(HttpServletRequest request) {
super(request);

this.forwardedHost = request.getHeader(HTTP_HEADER_FORWARDED_HOST);
this.host = request.getHeader(HTTP_HEADER_HOST);
this.scheme = request.getHeader(HTTP_HEADER_SCHEME);
}

public String getForwardedHost() {
return forwardedHost;
}

public String getHost() {
return host;
}

public String getScheme() {
return scheme;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
package cz.cuni.mff.xrg.odcs.frontend.auth;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.jasig.cas.client.util.CommonUtils;
import org.springframework.security.cas.web.CasAuthenticationEntryPoint;
import org.springframework.security.cas.web.CasAuthenticationFilter;

/**
* Used by the <code>ExceptionTranslationFilter</code> to commence authentication via the JA-SIG Central
* Authentication Service (CAS).
* <p>
* The user's browser will be redirected to the JA-SIG CAS enterprise-wide login page. This page is specified by the <code>loginUrl</code> property. Once login
* is complete, the CAS login page will redirect to the page indicated by the <code>service</code> property. The <code>service</code> is a HTTP URL belonging to
* the current application. The <code>service</code> URL is monitored by the {@link CasAuthenticationFilter}, which will validate the CAS login was successful.
*
* @author Ben Alex
* @author Scott Battaglia
*/
public class UVCasAuthenticationEntryPoint extends CasAuthenticationEntryPoint {

private static final String HTTP_HEADER_FORWARDED_HOST = "X-Forwarded-Host";

private static final String HTTP_HEADER_HOST = "Host";

private static final String HTTP_HEADER_SCHEME = "Scheme";

private boolean behindProxy = false;

/**
* Constructs a new Service Url. The default implementation relies on the CAS client to do the bulk of the work.
*
* @param request
* the HttpServletRequest
* @param response
* the HttpServlet Response
* @return the constructed service url. CANNOT be NULL.
*/

protected String createServiceUrl(final HttpServletRequest request, final HttpServletResponse response) {

String serviceUrl = null;

if (behindProxy) {

String forwardedHost = request.getHeader(HTTP_HEADER_FORWARDED_HOST);
String host = request.getHeader(HTTP_HEADER_HOST);
String scheme = request.getHeader(HTTP_HEADER_SCHEME) != null ? request.getHeader(HTTP_HEADER_SCHEME) : "http";

String resultingHost = null;

if (forwardedHost != null)
resultingHost = forwardedHost;
else if (host != null)
resultingHost = host;

if(resultingHost == null){
throw new IllegalStateException("if behindProxy=true please ensure that either header " + HTTP_HEADER_FORWARDED_HOST + " or " + HTTP_HEADER_HOST + " is sent!");
}

serviceUrl = scheme + "://" + resultingHost + this.getServiceProperties().getService();
}
else
serviceUrl = this.getServiceProperties().getService();

return CommonUtils.constructServiceUrl(null, response, serviceUrl, null, this.getServiceProperties().getArtifactParameter(), this.getEncodeServiceUrlWithSessionId());
}

public void setBehindProxy(boolean behindProxy) {
this.behindProxy = behindProxy;
}


}
Loading

0 comments on commit 2c2603b

Please sign in to comment.