Skip to content

Commit

Permalink
Merge release branch
Browse files Browse the repository at this point in the history
  • Loading branch information
hplahar committed Sep 10, 2015
2 parents 0b25dd6 + 1af9848 commit 98e8ab4
Show file tree
Hide file tree
Showing 121 changed files with 4,893 additions and 3,606 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
language: java
jdk:
- oraclejdk7
- oraclejdk8
5 changes: 3 additions & 2 deletions jetty-debug.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@
<New class="org.mortbay.jetty.security.SslSocketConnector">
<Set name="Port">8443</Set>
<Set name="maxIdleTime">30000</Set>
<Set name="keystore"><SystemProperty name="jetty.home" default="."/>/.keystore
</Set>
<Set name="keystore"><SystemProperty name="jetty.home" default="."/>/.keystore</Set>
<Set name="password">changeit</Set>
<Set name="keyPassword">changeit</Set>
<Set name="truststore"><SystemProperty name="jetty.home" default="."/>/.keystore</Set>
<Set name="trustPassword">changeit</Set>
</New>

</Item>
Expand Down
66 changes: 37 additions & 29 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>org.jbei</groupId>
<artifactId>ice</artifactId>
<packaging>war</packaging>
<version>4.3.6</version>
<version>4.4.0</version>
<name>ice</name>
<description>Inventory of Composable Elements (ICE) for Synthetic Biology</description>
<repositories>
Expand Down Expand Up @@ -37,9 +37,9 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>postgresql</groupId>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.1-901.jdbc4</version>
<version>9.4-1201-jdbc41</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
Expand All @@ -55,7 +55,7 @@
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.4</version>
<version>2.3.1</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand All @@ -79,34 +79,19 @@
<version>4.3.10.Final</version>
</dependency>
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>commons-pool</groupId>
<artifactId>commons-pool</artifactId>
<version>1.6</version>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.10</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>org.mod4j.org.apache.commons</groupId>
<artifactId>lang</artifactId>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-email</artifactId>
<version>1.3.1</version>
<version>1.3.3</version>
</dependency>
<dependency>
<groupId>com.opencsv</groupId>
Expand All @@ -116,18 +101,41 @@
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.0.13</version>
<version>1.1.3</version>
</dependency>
<dependency>
<groupId>org.biojava</groupId>
<artifactId>core</artifactId>
<version>1.8.5</version>
<version>1.9.2</version>
</dependency>
<dependency>
<groupId>org.sbolstandard</groupId>
<artifactId>libSBOLj</artifactId>
<version>2.0-beta</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.2.2</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.2.1</version>
</dependency>
<!-- mockito -->
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.10.19</version>
<scope>test</scope>
</dependency>
<!-- guava -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>18.0</version>
</dependency>
</dependencies>
<build>
<outputDirectory>target</outputDirectory>
Expand Down Expand Up @@ -164,10 +172,10 @@
<inherited>true</inherited>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<version>3.3</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
Expand All @@ -184,7 +192,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<version>2.10.3</version>
<configuration>
</configuration>
</plugin>
Expand Down
36 changes: 36 additions & 0 deletions src/main/java/org/jbei/auth/Authorization.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package org.jbei.auth;

/**
* An object specifying if a request is valid, and for which user.
*
* @author wcmorrell
* @version 1.0
*/
public interface Authorization {

/**
* Pre-made invalid authorization object.
*/
public static final Authorization INVALID = new Authorization() {
@Override
public boolean isValid() {
return false;
}

@Override
public String getUserId() {
return null;
}
};

/**
* @return the user ID valid for the request
*/
public String getUserId();

/**
* @return {@code true} only if the request is validated
*/
public boolean isValid();

}
20 changes: 20 additions & 0 deletions src/main/java/org/jbei/auth/KeyTable.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
*
*/
package org.jbei.auth;

import java.security.Key;

/**
* @author wcmorrell
* @version 1.0
*/
public interface KeyTable {

/**
* @param keyId
* @return the matching Key object, or {@code null} if not found
*/
public abstract Key getKey(final String keyId);

}
62 changes: 62 additions & 0 deletions src/main/java/org/jbei/auth/MemoryKeyTable.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/**
*
*/
package org.jbei.auth;

import java.security.Key;
import java.util.HashMap;
import java.util.Map;

/**
* Simple KeyTable stores mapping of KeyID => Key in memory.
*
* @author wcmorrell
* @version 1.0
*/
public class MemoryKeyTable extends HashMap<String, Key> implements KeyTable {

private static final long serialVersionUID = 460597881793784549L;

/**
* Calls super HashMap constructor.
*/
public MemoryKeyTable() {
super();
}

/**
* Calls super HashMap constructor.
*
* @param initialCapacity the initial capacity
* @param loadFactor the load factor
* @throws IllegalArgumentException if the initial capacity is negative or the load factor is nonpositive
*/
public MemoryKeyTable(final int initialCapacity, final float loadFactor) {
super(initialCapacity, loadFactor);
}

/**
* Calls super HashMap constructor.
*
* @param initialCapacity the initial capacity.
* @throws IllegalArgumentException if the initial capacity is negative.
*/
public MemoryKeyTable(final int initialCapacity) {
super(initialCapacity);
}

/**
* Calls super HashMap constructor.
*
* @param m the map whose mappings are to be placed in this map
* @throws NullPointerException if the specified map is null
*/
public MemoryKeyTable(final Map<? extends String, ? extends Key> m) {
super(m);
}

@Override
public Key getKey(final String keyId) {
return get(keyId);
}
}
55 changes: 55 additions & 0 deletions src/main/java/org/jbei/auth/hmac/DefaultHmacSignature.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package org.jbei.auth.hmac;

import org.apache.commons.codec.binary.Base64;

import javax.crypto.Mac;
import java.io.InputStream;
import java.io.OutputStream;

/**
* TODO
*
* @author wcmorrell
* @version 1.0
*/
public final class DefaultHmacSignature implements HmacSignature {

private final Mac mac;
private final String userId;

private String signature = null;

/**
* @param mac
* @param userId
*/
public DefaultHmacSignature(final Mac mac, final String userId) {
this.mac = mac;
this.userId = userId;
}

@Override
public InputStream filterInput(final InputStream stream) {
return new HmacInputStream(stream, mac);
}

@Override
public OutputStream filterOutput(final OutputStream stream) {
return new HmacOutputStream(stream, mac);
}

@Override
public String generateSignature() {
if (signature == null) {
final byte[] rawSignature = mac.doFinal();
signature = Base64.encodeBase64String(rawSignature);
}
return signature;
}

@Override
public String getUserId() {
return userId;
}

}
Loading

0 comments on commit 98e8ab4

Please sign in to comment.