Skip to content
This repository has been archived by the owner on Nov 9, 2023. It is now read-only.

Commit

Permalink
Request attestation if selected (#173)
Browse files Browse the repository at this point in the history
Move project to Maven and add Travis CI support (#166)

* Initial commit to begin moving the projects to maven

Moving the projects to maven will allow easier deployment
and build of the project.

* Remove Eclipse specific settings and fix pom.xml

Finish updating the project to use Maven.

* Add travis.yml file for continuous integration

* Update travis file for deployment

Build u2f-ref-code dependency. Deploy the standard 'noext' version of the
app, then replace the 'noext' specific code with the 'crxjs' specific
code before deploying the 'crxjs' app.

Additionally, remove the deployment page as the latest code will always
be live.

* Fix issue where origins.json wasn't included in WAR file
  • Loading branch information
cpiper committed May 30, 2018
1 parent d1a4b49 commit 7240ed1
Show file tree
Hide file tree
Showing 58 changed files with 493 additions and 175 deletions.
18 changes: 18 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
language: java
branches:
only:
- master
before_script:
- cd u2f-ref-code
- mvn install test -B
- cd ../u2f-gae-demo
- '[ "${TRAVIS_PULL_REQUEST}" = "false" ] && openssl aes-256-cbc -K $encrypted_03381351a0d5_key -iv $encrypted_03381351a0d5_iv
-in clientsecret.json.enc -out clientsecret.json -d'
script:
- mvn test -B
# Deploy "noext" version
- '[ "${TRAVIS_PULL_REQUEST}" = "false" ] && mvn appengine:update -Dappengine.additionalParams="--service_account_json_key_file=clientsecret.json"'
# Deploy "crxjs" version
- sed -i 's/kmendfapggjehodndflmmgagdbamhnfd/pfboblefjcgdjicmnffhdgionmgcdmne/' war/js/u2f-api.js
- sed -i 's/noext/crxjs/' war/WEB-INF/appengine-web.xml
- '[ "${TRAVIS_PULL_REQUEST}" = "false" ] && mvn appengine:update -Dappengine.additionalParams="--service_account_json_key_file=clientsecret.json"'
19 changes: 13 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,24 +50,31 @@ and includes packages for all crypto, utilities, etc. It does *not* need to run
in a container or application server like Tomcat. To run the demo server, run
the main class in ``com.google.u2f.tools.httpserver.U2fHttpServer``

To compile and run the server in Eclipse, import the project into your
To compile and run the server in Eclipse, import the Maven project into your
workspace. You may need to fix the classpath if your version of JDK is
different (this has been tested with Java 1.7). The simple demo web server is
in ``com.google.u2f.tools.httpserver.UtfHttpServer.java`` and runs on port
in ``com.google.u2f.tools.httpserver.U2fHttpServer.java`` and runs on port
8080. Run this class as a regular Java application (right click, select *Run
As* and *Java Application*). Note that you need to have the U2F extension
installed in Chrome in order for the demo app to talk to your U2F token.

To run directly with Maven, run `mvn compile exec:java` from the u2f-ref-code
directory.

### U2F-GAE-Demo

The u2f-gae-demo project is a sample application built on the Google App Engine
web platform which demonstrates a possible UX for user interaction with U2F in a
web page.

As above, after importing the project into Eclipse you might have to adjust JDK
versions, App Engine SDK version, etc. Once everything compiles, you can run the
App Engine server locally and point Google Chrome at http://localhost:8888/. The
built-in support for U2F in Google Chrome only works on HTTPS sites. To test
To start the development server with Maven, run `mvn appengine:devserver`. This
will run the server locally at `http://localhost:8888/`.

As above, if importing the Maven project into Eclipse you might have to adjust
JDK versions, App Engine SDK version, etc. Once everything compiles, you can run
the App Engine server locally and point Google Chrome at `http://localhost:8888/`.

The built-in support for U2F in Google Chrome only works on HTTPS sites. To test
the app on `http://localhost:8888`, which uses HTTP, you need to do one of the
following:

Expand Down
18 changes: 0 additions & 18 deletions deployment.md

This file was deleted.

23 changes: 0 additions & 23 deletions u2f-gae-demo/.classpath

This file was deleted.

4 changes: 4 additions & 0 deletions u2f-gae-demo/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
war/WEB-INF/appengine-generated/
war/WEB-INF/deploy/
war/WEB-INF/classes/
target/
.settings/
.classpath
.project
52 changes: 0 additions & 52 deletions u2f-gae-demo/.project

This file was deleted.

This file was deleted.

3 changes: 0 additions & 3 deletions u2f-gae-demo/.settings/com.google.gdt.eclipse.core.prefs

This file was deleted.

2 changes: 0 additions & 2 deletions u2f-gae-demo/.settings/com.google.gwt.eclipse.core.prefs

This file was deleted.

11 changes: 0 additions & 11 deletions u2f-gae-demo/.settings/org.eclipse.jdt.core.prefs

This file was deleted.

This file was deleted.

Binary file added u2f-gae-demo/clientsecret.json.enc
Binary file not shown.
147 changes: 147 additions & 0 deletions u2f-gae-demo/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>u2f-gae-demo</groupId>
<artifactId>u2f-gae-demo</artifactId>
<properties>
<appengine.app.version>1</appengine.app.version>
<appengine.sdk.version>1.9.54</appengine.sdk.version>
<objectify.version>5.1.5</objectify.version>
<guava.version>18.0</guava.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>u2f-gae-demo</name>
<description>u2f-gae-demo</description>
<build>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>src</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<filesets>
<fileset>
<directory>${basedir}/war/WEB-INF/appengine-generated</directory>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<archiveClasses>true</archiveClasses>
<webResources>
<!-- in order to interpolate version from pom into appengine-web.xml -->
<resource>
<directory>${basedir}/war/WEB-INF</directory>
<targetPath>WEB-INF</targetPath>
</resource>
<resource>
<directory>${basedir}/war/js</directory>
<targetPath>js</targetPath>
</resource>
<resource>
<directory>${basedir}/war/css</directory>
<targetPath>css</targetPath>
</resource>
<resource>
<directory>${basedir}/war/img</directory>
<targetPath>img</targetPath>
</resource>
<resource>
<directory>${basedir}/war/jquery</directory>
<targetPath>jquery</targetPath>
</resource>
<resource>
<directory>${basedir}/war</directory>
<includes>
<include>favicon.ico</include>
<include>origins.json</include>
</includes>
</resource>
</webResources>
</configuration>
</plugin>
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>${appengine.sdk.version}</version>
<configuration>
<enableJarClasses>false</enableJarClasses>
<port>8888</port>
<!-- Comment in the below snippet to bind to all IPs instead of just localhost -->
<!-- <address>0.0.0.0</address> -->
<!-- <port>8080</port> -->
<!-- Comment in the below snippet to enable local debugging with a remote
debugger like those included with Eclipse or IntelliJ -->
<!-- jvmFlags> <jvmFlag>-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n</jvmFlag>
</jvmFlags -->
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.googlecode.objectify</groupId>
<artifactId>objectify</artifactId>
<version>5.1.5</version>
</dependency>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-1.0-sdk</artifactId>
<version>${appengine.sdk.version}</version>
</dependency>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-endpoints</artifactId>
<version>${appengine.sdk.version}</version>
</dependency>
<dependency>
<groupId>com.google.template</groupId>
<artifactId>soy</artifactId>
<version>2015-03-06</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.inject.extensions</groupId>
<artifactId>guice-servlet</artifactId>
<version>4.1.0</version>
</dependency>
<dependency>
<groupId>u2f-ref-code</groupId>
<artifactId>u2f-ref-code</artifactId>
<version>0.0.1-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>com.google.collections</groupId>
<artifactId>google-collections</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</project>
2 changes: 1 addition & 1 deletion u2f-gae-demo/src/META-INF/jdoconfig.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<jdoconfig xmlns="http://java.sun.com/xml/ns/jdo/jdoconfig"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://java.sun.com/xml/ns/jdo/jdoconfig">
xsi:schemaLocation="http://java.sun.com/xml/ns/jdo/jdoconfig">

<persistence-manager-factory name="transactions-optional">
<property name="javax.jdo.PersistenceManagerFactoryClass"
Expand Down
3 changes: 2 additions & 1 deletion u2f-gae-demo/src/soy/main.soy
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@

<div id='sidebar'>
<div id="addToken" style="-webkit-user-select: none;">Register U2F Authenticator</div>
<label><input id="reregistration" type="checkbox" />allow re-registration</label>
<label><input id="reregistration" type="checkbox" />allow re-registration</label>
<label><input id="req-attestation" type="checkbox" />request attestation</label>
<div id="testAuth" style="-webkit-user-select: none;">Test Authentication</div>
<div id="downloadCrx">
<a href="https://chrome.google.com/webstore/detail/fido-u2f-universal-2nd-fa/pfboblefjcgdjicmnffhdgionmgcdmne">install the Chrome extension</a>
Expand Down
Binary file removed u2f-gae-demo/war/WEB-INF/lib/aopalliance.jar
Binary file not shown.
Binary file not shown.
Binary file removed u2f-gae-demo/war/WEB-INF/lib/appengine-api-labs.jar
Binary file not shown.
Binary file not shown.
Binary file removed u2f-gae-demo/war/WEB-INF/lib/appengine-endpoints.jar
Binary file not shown.
Binary file not shown.
Binary file removed u2f-gae-demo/war/WEB-INF/lib/asm-4.0.jar
Binary file not shown.
Binary file removed u2f-gae-demo/war/WEB-INF/lib/bcprov-jdk15on-150.jar
Binary file not shown.
Binary file removed u2f-gae-demo/war/WEB-INF/lib/commons-codec-1.9.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed u2f-gae-demo/war/WEB-INF/lib/gson-2.2.4.jar
Binary file not shown.
Binary file removed u2f-gae-demo/war/WEB-INF/lib/guava-17.0.jar
Binary file not shown.
Binary file removed u2f-gae-demo/war/WEB-INF/lib/guice-3.0.jar
Binary file not shown.
Binary file removed u2f-gae-demo/war/WEB-INF/lib/guice-servlet-3.0.jar
Binary file not shown.
Binary file removed u2f-gae-demo/war/WEB-INF/lib/jdo-api-3.0.1.jar
Binary file not shown.
Binary file removed u2f-gae-demo/war/WEB-INF/lib/joda-time-2.3.jar
Binary file not shown.
Binary file removed u2f-gae-demo/war/WEB-INF/lib/jsr107cache-1.1.jar
Binary file not shown.
Binary file removed u2f-gae-demo/war/WEB-INF/lib/jta-1.1.jar
Binary file not shown.
Binary file removed u2f-gae-demo/war/WEB-INF/lib/objectify-5.0.2.jar
Binary file not shown.
Binary file removed u2f-gae-demo/war/WEB-INF/lib/soy-latest.jar
Binary file not shown.
Loading

0 comments on commit 7240ed1

Please sign in to comment.