6e3db2c Add Lucee support (exact clone of Railo support).
readme.md | 1 +
src/sorcerersisle/cfpassphrase/lucee/PassphraseCheck.java (new) | 41 +++++++++
src/sorcerersisle/cfpassphrase/lucee/PassphraseHash.java (new) | 57 ++++++++++++
src/sorcerersisle/cfpassphrase/lucee/PassphraseInfo.java (new) | 44 +++++++++
src/sorcerersisle/cfpassphrase/lucee/PassphraseTag.java (new) | 93 ++++++++++++++++++++
src/sorcerersisle/cfpassphrase/lucee/cfPassphrase.fld (new) | 40 +++++++++
src/sorcerersisle/cfpassphrase/lucee/cfPassphrase.tld (new) | 61 +++++++++++++
7 files changed, 337 insertions(+)
diff --git a/readme.md b/readme.md
index fdd43ec..a2b5b72 100644
--- a/readme.md
+++ b/readme.md
@@ -34,6 +34,7 @@ At present, it has been tested with:
* ColdFusion 9 (9,0,1,274733)
* OpenBD 3.1 (nightly 2013-03-12)
* Railo 4.0 (4.0.2.002)
+* Lucee 4.5 (4.5.1.000)
It may or not work with other versions.
diff --git a/src/sorcerersisle/cfpassphrase/lucee/PassphraseCheck.java b/src/sorcerersisle/cfpassphrase/lucee/PassphraseCheck.java
new file mode 100644
index 0000000..233f3d5
--- /dev/null
+++ b/src/sorcerersisle/cfpassphrase/lucee/PassphraseCheck.java
@@ -0,0 +1,41 @@
+// cfPassphrase v0.1-rc | (c) Peter Boughton | License: LGPLv3 | Website: sorcerersisle.com/projects:cfpassphrase.html
+package sorcerersisle.cfpassphrase.lucee;
+
+import sorcerersisle.cfpassphrase.*;
+import lucee.runtime.ext.function.Function;
+import lucee.runtime.PageContext;
+import lucee.runtime.exp.PageException;
+import lucee.loader.engine.CFMLEngineFactory;
+
+
+@SuppressWarnings("serial")
+public final class PassphraseCheck
+ implements Function
+{
+
+
+ public static Boolean call
+ ( PageContext pc , String Passphrase , String Hash )
+ throws PageException
+ { return call(pc,Passphrase,Hash,null); }
+
+
+ public static Boolean call
+ ( PageContext pc
+ , String Passphrase
+ , String Hash
+ , String Algorithm
+ )
+ throws PageException
+ {
+ try
+ {
+ return Impl.check( Passphrase , Hash , Algorithm );
+ }
+ catch(Exception Ex)
+ {
+ throw CFMLEngineFactory.getInstance().getCastUtil().toPageException( Ex );
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/src/sorcerersisle/cfpassphrase/lucee/PassphraseHash.java b/src/sorcerersisle/cfpassphrase/lucee/PassphraseHash.java
new file mode 100644
index 0000000..0323d06
--- /dev/null
+++ b/src/sorcerersisle/cfpassphrase/lucee/PassphraseHash.java
@@ -0,0 +1,57 @@
+// cfPassphrase v0.1-rc | (c) Peter Boughton | License: LGPLv3 | Website: sorcerersisle.com/projects:cfpassphrase.html
+package sorcerersisle.cfpassphrase.lucee;
+
+import sorcerersisle.cfpassphrase.*;
+import lucee.runtime.ext.function.Function;
+import lucee.runtime.PageContext;
+import lucee.runtime.exp.PageException;
+import lucee.loader.engine.CFMLEngineFactory;
+import lucee.runtime.type.Struct;
+import lucee.runtime.util.Cast;
+
+
+@SuppressWarnings("serial")
+public final class PassphraseHash
+ implements Function
+{
+
+
+ public static String call
+ ( PageContext pc , String Passphrase )
+ throws PageException
+ { return call(pc,Passphrase,null,null); }
+
+ public static String call
+ ( PageContext pc , String Passphrase , String Algorithm )
+ throws PageException
+ { return call(pc,Passphrase,Algorithm,null); }
+
+
+ @SuppressWarnings("unchecked")
+ public static String call
+ ( PageContext pc
+ , String Passphrase
+ , String Algorithm
+ , Struct AlgorithmParams
+ )
+ throws PageException
+ {
+ Cast Caster = CFMLEngineFactory.getInstance().getCastUtil();
+
+ try
+ {
+ return Impl.hash
+ ( Passphrase
+ , Algorithm
+ , Caster.toMap(AlgorithmParams,null)
+ );
+ }
+ catch(Exception Ex)
+ {
+ throw Caster.toPageException( Ex );
+ }
+
+ }
+
+
+}
\ No newline at end of file
diff --git a/src/sorcerersisle/cfpassphrase/lucee/PassphraseInfo.java b/src/sorcerersisle/cfpassphrase/lucee/PassphraseInfo.java
new file mode 100644
index 0000000..3ff3a49
--- /dev/null
+++ b/src/sorcerersisle/cfpassphrase/lucee/PassphraseInfo.java
@@ -0,0 +1,44 @@
+// cfPassphrase v0.1-rc | (c) Peter Boughton | License: LGPLv3 | Website: sorcerersisle.com/projects:cfpassphrase.html
+package sorcerersisle.cfpassphrase.lucee;
+
+import sorcerersisle.cfpassphrase.*;
+import lucee.runtime.ext.function.Function;
+import lucee.runtime.PageContext;
+import lucee.runtime.exp.PageException;
+import lucee.runtime.type.Struct;
+import lucee.runtime.util.Cast;
+import lucee.loader.engine.CFMLEngineFactory;
+
+
+@SuppressWarnings("serial")
+public final class PassphraseInfo
+ implements Function
+{
+
+
+ public static Struct call
+ ( PageContext pc , String Passphrase )
+ throws PageException
+ { return call(pc,Passphrase,null); }
+
+
+ public static Struct call
+ ( PageContext pc
+ , String Hash
+ , String Algorithm
+ )
+ throws PageException
+ {
+ Cast Caster = CFMLEngineFactory.getInstance().getCastUtil();
+
+ try
+ {
+ return Caster.toStruct( Impl.info(Hash,Algorithm) );
+ }
+ catch(Exception Ex)
+ {
+ throw Caster.toPageException( Ex );
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/src/sorcerersisle/cfpassphrase/lucee/PassphraseTag.java b/src/sorcerersisle/cfpassphrase/lucee/PassphraseTag.java
new file mode 100644
index 0000000..2f95382
--- /dev/null
+++ b/src/sorcerersisle/cfpassphrase/lucee/PassphraseTag.java
@@ -0,0 +1,93 @@
+// cfPassphrase v0.1-rc | (c) Peter Boughton | License: LGPLv3 | Website: sorcerersisle.com/projects:cfpassphrase.html
+package sorcerersisle.cfpassphrase.lucee;
+
+import lucee.runtime.ext.tag.TagSupport;
+import lucee.runtime.ext.tag.DynamicAttributes;
+import lucee.runtime.type.Collection.Key;
+import lucee.runtime.type.Struct;
+import lucee.runtime.exp.PageException;
+import lucee.loader.engine.CFMLEngineFactory;
+
+@SuppressWarnings("deprecation")
+public final class PassphraseTag
+ extends TagSupport
+ implements DynamicAttributes
+{
+
+
+ private Struct Attributes = CFMLEngineFactory.getInstance().getCreationUtil().createStruct();
+
+
+ public int doStartTag()
+ throws PageException
+ {
+ String Action = (String)Attributes.get("action",null);
+ String Variable = (String)Attributes.get("variable",null);
+ String Passphrase = (String)Attributes.get("passphrase",null);
+ String Algorithm = (String)Attributes.get("algorithm",null);
+ Object Result;
+
+ if (Action.equalsIgnoreCase("hash"))
+ {
+ Struct AlgorithmParams = Attributes.containsKey("algorithmparams") ? (Struct)Attributes.get("algorithmparams") : null;
+
+ Result = PassphraseHash.call
+ ( pageContext
+ , Passphrase
+ , Algorithm
+ , AlgorithmParams
+ );
+ }
+ else if (Action.equalsIgnoreCase("check"))
+ {
+ String Hash = (String)Attributes.get("hash",null);
+
+ Result = PassphraseCheck.call
+ ( pageContext
+ , Passphrase
+ , Hash
+ , Algorithm
+ );
+ }
+ else if (Action.equalsIgnoreCase("info"))
+ {
+ String Hash = (String)Attributes.get("hash",null);
+
+ Result = PassphraseCheck.call
+ ( pageContext
+ , Hash
+ , Algorithm
+ );
+ }
+ else
+ {
+ throw CFMLEngineFactory.getInstance().getCastUtil().toPageException
+ ( new Exception("Invalid value for [Action] attribute. Accepted values are 'hash','check', or [info].")
+ );
+ }
+
+ pageContext.setVariable( Variable , Result );
+
+
+ return SKIP_BODY;
+ }
+
+
+ public void setDynamicAttribute(String uri, String localName, Object value)
+ {
+ Attributes.setEL(localName,value);
+ }
+
+ public void setDynamicAttribute(String uri, Key localName, Object value)
+ {
+ Attributes.setEL(localName,value);
+ }
+
+
+ public void release()
+ {
+ super.release();
+ Attributes.clear();
+ }
+
+}
\ No newline at end of file
diff --git a/src/sorcerersisle/cfpassphrase/lucee/cfPassphrase.fld b/src/sorcerersisle/cfpassphrase/lucee/cfPassphrase.fld
new file mode 100644
index 0000000..644cfda
--- /dev/null
+++ b/src/sorcerersisle/cfpassphrase/lucee/cfPassphrase.fld
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE func-lib PUBLIC "-//Lucee//DTD CFML Function Library 1.0//EN" "dtd/web-cfmfunctionlibrary_1_0.dtd">
+<func-lib>
+ <flib-version>1.00</flib-version>
+
+ <short-name>cfpassphrase-functions</short-name>
+ <uri>http://sorcerersisle.com/projects:cfpassphrase.html</uri>
+ <display-name>cfPassphrase Functions</display-name>
+ <description>Provides functions PassphraseHash and PassphraseCheck to Lucee.</description>
+
+ <function>
+ <name>PassphraseHash</name>
+ <class>sorcerersisle.cfpassphrase.lucee.PassphraseHash</class>
+ <description>PassphraseHash returns a hash using the specified KDF algorithm.</description>
+ <argument><name>Passphrase</name> <type>String</type> <required>yes</required> <description>The passphrase to hash.</description> </argument>
+ <argument><name>Algorithm</name> <type>String</type> <required>no</required> <description>The algorithm to use. ()Default is bcrypt</description> </argument>
+ <argument><name>AlgorithmParams</name> <type>Struct</type> <required>no</required> <description>Any parameters to pass into the algorithm.</description></argument>
+ <return><type>String</type></return>
+ </function>
+
+ <function>
+ <name>PassphraseCheck</name>
+ <class>sorcerersisle.cfpassphrase.lucee.PassphraseCheck</class>
+ <description>PassphraseCheck returns true/false depending on whether the passphrase matches the provided hash, according to the algorithm provided.</description>
+ <argument><name>Passphrase</name> <type>String</type> <required>yes</required> <description>The passphrase to check.</description> </argument>
+ <argument><name>Hash</name> <type>String</type> <required>yes</required> <description>The existing passphrase hash.</description> </argument>
+ <argument><name>Algorithm</name> <type>String</type> <required>no</required> <description>The algorithm to use. (Default depends on hash signature.)</description></argument>
+ <return><type>Boolean</type></return>
+ </function>
+
+ <function>
+ <name>PassphraseInfo</name>
+ <class>sorcerersisle.cfpassphrase.lucee.PassphraseInfo</class>
+ <description>PassphraseInfo Identifies the algorithm and parameters for the specified hash.</description>
+ <argument><name>Hash</name> <type>String</type> <required>yes</required> <description>The hash to return info about.</description> </argument>
+ <argument><name>Algorithm</name> <type>String</type> <required>no</required> <description>The algorithm to use. (Default depends on hash signature.)</description></argument>
+ <return><type>Struct</type></return>
+ </function>
+
+</func-lib>
\ No newline at end of file
diff --git a/src/sorcerersisle/cfpassphrase/lucee/cfPassphrase.tld b/src/sorcerersisle/cfpassphrase/lucee/cfPassphrase.tld
new file mode 100644
index 0000000..a8ae3d9
--- /dev/null
+++ b/src/sorcerersisle/cfpassphrase/lucee/cfPassphrase.tld
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE taglib PUBLIC "-//Lucee//DTD CFML Tag Library 1.0//EN" "dtd/web-cfmtaglibrary_1_0.dtd">
+<taglib>
+ <tlib-version>1.00</tlib-version>
+
+ <short-name>cfpassphrase-tag</short-name>
+ <uri>http://sorcerersisle.com/projects:cfpassphrase.html</uri>
+ <display-name>cfPassphrase Tag</display-name>
+ <description>Provides tag cfpassphrase to Lucee.</description>
+
+ <name-space>cf</name-space>
+ <name-space-separator/>
+
+ <tag>
+ <name>passphrase</name>
+ <tag-class>sorcerersisle.cfpassphrase.lucee.PassphraseTag</tag-class>
+ <body-content>empty</body-content>
+ <body-rtexprvalue>false</body-rtexprvalue>
+ <description>Checks or calculates a hash using the specified KDF algorithm.</description>
+ <attribute-type>dynamic</attribute-type>
+ <attribute-min>3</attribute-min>
+ <attribute-max>6</attribute-max>
+ <attribute>
+ <name>Action</name>
+ <type>string</type>
+ <required>true</required>
+ <description>Specify [hash], [check], or [info] to determine what action tag takes.</description>
+ </attribute>
+ <attribute>
+ <name>Variable</name>
+ <type>string</type>
+ <required>true</required>
+ <description>Name of variable to contain result of action.</description>
+ </attribute>
+ <attribute>
+ <name>Passphrase</name>
+ <type>string</type>
+ <required>false</required>
+ <description>The passphrase to be hashed or checked. (action=hash,action=check)</description>
+ </attribute>
+ <attribute>
+ <name>Hash</name>
+ <type>string</type>
+ <required>false</required>
+ <description>The existing hash to be checked against. (action=check,action=info)</description>
+ </attribute>
+ <attribute>
+ <name>Algorithm</name>
+ <type>string</type>
+ <required>false</required>
+ <description>Algorithm to be used.</description>
+ </attribute>
+ <attribute>
+ <name>AlgorithmParams</name>
+ <type>struct</type>
+ <required>false</required>
+ <description>Optional parameters to be used by algorithm. (action=hash)</description>
+ </attribute>
+ </tag>
+
+</taglib>
\ No newline at end of file