forked from jruby/jruby
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add dir with samples for signed and unsigned jnlps
run ant to generate jnlp-sample keystore, copy jruby-complete.jar, and to copy and sign jruby-complete.jar git-svn-id: http://svn.codehaus.org/jruby/trunk/jruby@8486 961051c9-f516-0410-bf72-c9f7e237a7b7
- Loading branch information
Showing
5 changed files
with
160 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
There are two sample Java Web Start jnlp files in this directory for | ||
starting JRuby and displaying an IRB Console. | ||
|
||
jirb.jnlp | ||
|
||
jirb.jnlp uses an unsigned version of the jruby-complete.jar and | ||
is run with the standard minimal security permissions that Java | ||
Web Start assigns to an untrusted Web Start application. For example | ||
while running this version you won't be able to read or write to | ||
local directories. | ||
|
||
signed-jirb.jnlp | ||
|
||
signed-jirb.jnlp uses a signed version of the jruby-complete.jar | ||
and includes this declaration in the jnlp: | ||
|
||
<security> | ||
<all-permissions/> | ||
</security> | ||
|
||
Running signed-jirb.jnlp will start a JRuby IRB console with Java security | ||
permissions to interact with the local environment. | ||
|
||
In Java 1.5 the codebase attribute on the jnlp element does not support | ||
using a relative path spec to refer to the JRUBY_HOME/lib directory so | ||
the default ant task copies jruby-complete.jar to the jars/ directory | ||
and also places a signed copy in signed-jars/. | ||
|
||
Before running the ant task make sure you have a copy of jruby-complete.jar | ||
here: | ||
|
||
$JRUBY_HOME/lib/jruby-complete.jar | ||
|
||
If you have the JRuby source the jruby-complete.jar can built with this | ||
ant task: | ||
|
||
ant jar-complete | ||
|
||
Run the default ant task to prepare jruby-complete.jar for both the | ||
unsigned and signed sample jnlps. | ||
|
||
Running the unsigned jnlp sample: | ||
|
||
javaws jirb.jnlp | ||
|
||
Running the signed jnlp sample: | ||
|
||
javaws signed-jirb.jnlp | ||
|
||
The ant task will create a default jnlp-sample-keystore to use when | ||
signing the jar. | ||
|
||
You can create a keystore and certificate manually like this: | ||
|
||
keytool -genkey -keystore jnlp-sample-keystore -alias jnlp-sample-keystore | ||
keytool -selfcert -alias jnlp-sample-keystore -keystore jnlp-sample-keystore | ||
|
||
If you change the properties here or in the ant task generate-keystore | ||
also edit the values in the file default.properties to match the new values. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
keystore=jnlp-sample-keystore | ||
storepass=jnlp-sample-keystore | ||
keypass=jnlp-sample-keystore | ||
alias=jnlp-sample-keystore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project basedir="." default="default-task" name="jnlp"> | ||
<description> | ||
A testbed for getting JRuby to work with web start. | ||
</description> | ||
|
||
<!-- First try to load machine-specific properties. --> | ||
<property file="build.properties"/> | ||
|
||
<!-- And then load the defaults. It seems backwards to set defaults AFTER | ||
setting local overrides, but that's how Ant works. --> | ||
<property file="default.build.properties"/> | ||
|
||
<condition property="jnlp-sample-keystore.exists"> | ||
<available file="jnlp-sample-keystore"/> | ||
</condition> | ||
|
||
<target name="generate-keystore" unless="jnlp-sample-keystore.exists"> | ||
<genkey alias="jnlp-sample-keystore" keystore="jnlp-sample-keystore" storepass="jnlp-sample-keystore" keypass="jnlp-sample-keystore"> | ||
<dname> | ||
<param name="CN" value="JRuby"/> | ||
<param name="OU" value="JRuby"/> | ||
<param name="O" value="jruby.org"/> | ||
<param name="C" value="US"/> | ||
</dname> | ||
</genkey> | ||
</target> | ||
|
||
<target name="clean" description="delete signed-jars and jnlp-sample-keystore"> | ||
<delete file="jnlp-sample-keystore"/> | ||
<delete dir="jars"/> | ||
<delete dir="signed-jars"/> | ||
</target> | ||
|
||
<target name="copy-jars" description="copy selected jars to the jars directory"> | ||
<copy file="../../lib/jruby-complete.jar" todir="jars" /> | ||
</target> | ||
|
||
<target name="sign-jars" depends="copy-jars, generate-keystore"> | ||
<mkdir dir="signed-jars"/> | ||
<signjar destDir="signed-jars" | ||
keystore="${keystore}" | ||
storepass="${storepass}" | ||
keypass="${keypass}" | ||
alias="${alias}" | ||
lazy="false" | ||
preservelastmodified="true"> | ||
<path> | ||
<fileset dir="jars" includes="*.jar" /> | ||
</path> | ||
<flattenmapper /> | ||
</signjar> | ||
</target> | ||
|
||
<target name="default-task" depends="sign-jars"> | ||
<echo> | ||
Testing the jnlp samples: | ||
|
||
javaws jirb.jnlp | ||
|
||
javaws signed-jirb.jnlp | ||
</echo> | ||
</target> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<jnlp spec="1.0+" codebase="file:."> | ||
<information> | ||
<title>JRuby IRB Console</title> | ||
<vendor>The JRuby Team</vendor> | ||
<description>Sample WebStart Application with JRuby</description> | ||
<description kind="short">JRuby IRB Console Sample</description> | ||
<homepage href="http://jruby.codehaus.org/"/> | ||
</information> | ||
<resources> | ||
<j2se version="1.5+"/> | ||
<jar href="jars/jruby-complete.jar" download="eager"/> | ||
</resources> | ||
<application-desc main-class="org.jruby.demo.IRBConsole"/> | ||
</jnlp> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<jnlp spec="1.0+" codebase="file:."> | ||
<information> | ||
<title>JRuby IRB Console</title> | ||
<vendor>The JRuby Team</vendor> | ||
<description>Sample JRuby Signed Java Web Start Application</description> | ||
<description kind="short">JRuby IRB Console Sample</description> | ||
<homepage href="http://jruby.codehaus.org/"/> | ||
</information> | ||
<security> | ||
<all-permissions/> | ||
</security> | ||
<resources> | ||
<j2se version="1.5+"/> | ||
<jar href="signed-jars/jruby-complete.jar" download="eager"/> | ||
</resources> | ||
<application-desc main-class="org.jruby.demo.IRBConsole"/> | ||
</jnlp> |