diff --git a/.gitignore b/.gitignore
index 189de92..565e32a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,8 @@
.idea/
+.gradle/
+
*.iml
*.zip
@@ -12,9 +14,9 @@ target/
docs/
-grails-app/conf/*
+build/
-*.properties
+grails-app/conf/*
*.js
diff --git a/.travis.yml b/.travis.yml
index f5bf30c..bf04b9e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,19 +1,19 @@
language: java
jdk:
-- oraclejdk7
+- oraclejdk8
env:
-- GRAILS_VERSION=2.2.5 UPGRADE=upgrade
+- GRAILS_VERSION=3.1.1 UPGRADE=upgrade
before_install:
-- rm -rf ~/.gvm
-- curl -s get.gvmtool.net > ~/install_gvm.sh
-- chmod 775 ~/install_gvm.sh
-- ~/install_gvm.sh
-- echo "gvm_auto_answer=true" > ~/.gvm/etc/config
-- source ~/.gvm/bin/gvm-init.sh
-- gvm install grails $GRAILS_VERSION || true
+- rm -rf ~/.sdkman
+- curl -s "https://get.sdkman.io" > ~/install_sdk.sh
+- chmod 775 ~/install_sdk.sh
+- ~/install_sdk.sh
+- echo sdkman_auto_answer=true > ~/.sdkman/etc/config
+- source ~/.sdkman/bin/sdkman-init.sh
+- sdk install grails $GRAILS_VERSION || true
- chmod 775 ./build.sh
script: ./build.sh
diff --git a/README.md b/README.md
index 5678df7..4155bb5 100644
--- a/README.md
+++ b/README.md
@@ -14,4 +14,5 @@ Submit issues to the [GitHub Issue Tracker](https://github.com/michaelrice/WeakS
## Authors
* Shawn Hartsock -- Creator
-* Michael Rice -- Current Maintainer
+* Michael Rice -- Maintainer for grails 2.X
+* Sachin Verma -- Maintainer for grails 3.x
diff --git a/WeakSSLGrailsPlugin.groovy b/WeakSSLGrailsPlugin.groovy
deleted file mode 100644
index aebef0b..0000000
--- a/WeakSSLGrailsPlugin.groovy
+++ /dev/null
@@ -1,79 +0,0 @@
-import com.blogspot.hartsock.ssl.weak.GrailsAutoTrustModeSSL
-import org.codehaus.groovy.grails.commons.GrailsApplication
-import grails.util.Environment
-import com.blogspot.hartsock.ssl.weak.TrustingProvider
-import com.blogspot.hartsock.ssl.weak.WeakHostnameVerifier
-
-class WeakSSLGrailsPlugin {
-
- // the plugin version
- def version = "1.3"
- // the version or versions of Grails the plugin is designed for
- def grailsVersion = "1.3.6 > *"
- // the other plugins this plugin depends on
- def dependsOn = [:]
- // resources that are excluded from plugin packaging
- def pluginExcludes = [
- "grails-app"
- ]
-
- def author = "Shawn Hartsock"
- def authorEmail = "hartsock@acm.org"
- def title = "WeakSSL"
- def description = '''\\
-This plugin deliberately breaks SSL for you by accepting
-any SSL certificate.
-'''
-
- def developers = [
- [
- name: "Michael Rice",
- email: "michael@michaelrice.org"
- ]
- ]
- // URL to the plugin's documentation
- def documentation = "http://grails.org/plugin/weak-ssl"
-
- def doWithWebDescriptor = { xml ->
- }
-
- def doWithSpring = {
- }
-
- def doWithDynamicMethods = { ctx ->
- }
-
- def doWithApplicationContext = { applicationContext ->
- configSSLMode(application)
- }
-
- def onChange = { event ->
- configSSLMode(application)
- }
-
- def onConfigChange = { event ->
- configSSLMode(application)
- }
-
- void configSSLMode(GrailsApplication application) {
- GrailsAutoTrustModeSSL.init()
- def trustAll = application.config?.trustAll
- if(trustAll instanceof ConfigObject || trustAll == null) {
- log.trace "trustAll not set. If Environment not production setting trustAll = true"
- trustAll = ! Environment.PRODUCTION.equals(Environment.getCurrent())
- }
- if (trustAll) {
- if (Environment.PRODUCTION.equals(Environment.getCurrent())) {
- log.warn "You are using the TrustingProvider in PRODUCTION!"
- }
- TrustingProvider.registerTrustingProvider()
- }
- List hosts = ['localhost']
- if (application.config.weakssl?.trustedhosts instanceof List) {
- hosts = application.config.weakssl?.trustedhosts
- }
- String[] trustedHostsArray = (String[]) hosts.toArray();
- WeakHostnameVerifier.init(trustedHostsArray)
- }
-
-}
diff --git a/application.properties b/application.properties
deleted file mode 100644
index 056acad..0000000
--- a/application.properties
+++ /dev/null
@@ -1,4 +0,0 @@
-#Grails Metadata file
-#Mon Sep 08 15:43:57 CDT 2014
-app.grails.version=2.2.5
-app.name=WeakSSL
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 0000000..f5a0427
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,89 @@
+buildscript {
+ ext {
+ grailsVersion = project.grailsVersion
+ }
+ repositories {
+ mavenLocal()
+ maven { url "https://repo.grails.org/grails/core" }
+ }
+ dependencies {
+ classpath "org.grails:grails-gradle-plugin:$grailsVersion"
+ }
+}
+
+version "3.0-M1"
+group "org.grails.plugins"
+
+apply plugin: "eclipse"
+apply plugin: "idea"
+apply plugin: "org.grails.grails-plugin"
+apply plugin: "org.grails.grails-plugin-publish"
+apply plugin: "org.grails.grails-gsp"
+
+ext {
+ grailsVersion = project.grailsVersion
+ gradleWrapperVersion = project.gradleWrapperVersion
+}
+
+repositories {
+ mavenLocal()
+ maven { url "https://repo.grails.org/grails/core" }
+}
+
+dependencyManagement {
+ imports {
+ mavenBom "org.grails:grails-bom:$grailsVersion"
+ }
+ applyMavenExclusions false
+}
+
+dependencies {
+ compile "org.springframework.boot:spring-boot-starter-logging"
+ compile "org.springframework.boot:spring-boot-autoconfigure"
+ compile "org.grails:grails-core"
+ compile "org.springframework.boot:spring-boot-starter-actuator"
+ compile "org.springframework.boot:spring-boot-starter-tomcat"
+ compile "org.grails:grails-dependencies"
+ compile "org.grails:grails-web-boot"
+ compile "org.grails.plugins:cache"
+ compile "org.grails.plugins:scaffolding"
+ console "org.grails:grails-console"
+ profile "org.grails.profiles:web-plugin:3.1.1"
+ provided "org.grails:grails-plugin-services"
+ provided "org.grails:grails-plugin-domain-class"
+ testCompile "org.grails:grails-plugin-testing"
+ testCompile "org.grails.plugins:geb"
+ testRuntime "org.seleniumhq.selenium:selenium-htmlunit-driver:2.47.1"
+ testRuntime "net.sourceforge.htmlunit:htmlunit:2.18"
+}
+
+task wrapper(type: Wrapper) {
+ gradleVersion = gradleWrapperVersion
+}
+
+// enable if you wish to package this plugin as a standalone application
+bootRepackage.enabled = false
+grailsPublish {
+ githubSlug = 'michaelrice/WeakSSL'
+ license {
+ name = 'Apache-2.0'
+ }
+ title = "WeakSSL"
+ desc = '''\\
+This plugin deliberately breaks SSL for you by accepting
+any SSL certificate.
+'''
+ developers = [shawnhartsock: "Shawn Hartsock", michaelrice: "Michael Rice", sachinverma: "Sachin Verma"]
+}
+
+bintray {
+ pkg {
+ name = "$project.name"
+ issueTrackerUrl = "https://github.com/michaelrice/$project.name/issues"
+ vcsUrl = "https://github.com/michaelrice/$project.name"
+ version {
+ attributes = ['grails-plugin': "$project.group:$project.name"]
+ name = project.version
+ }
+ }
+}
diff --git a/build.sh b/build.sh
index 6af30bb..6d9f83a 100644
--- a/build.sh
+++ b/build.sh
@@ -1 +1 @@
-grails $UPGRADE --non-interactive && grails test-app unit: --non-interactive --stacktrace && grails package-plugin
+grails test-app unit: --non-interactive --stacktrace && grails package-plugin
diff --git a/gradle.properties b/gradle.properties
new file mode 100644
index 0000000..a2394e7
--- /dev/null
+++ b/gradle.properties
@@ -0,0 +1,2 @@
+grailsVersion=3.1.1
+gradleWrapperVersion=2.9
\ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..9411448
Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..3869368
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Fri Nov 27 23:09:32 CET 2015
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.9-bin.zip
diff --git a/gradlew b/gradlew
new file mode 100755
index 0000000..9d82f78
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,160 @@
+#!/usr/bin/env bash
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn ( ) {
+ echo "$*"
+}
+
+die ( ) {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+esac
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
+function splitJvmOpts() {
+ JVM_OPTS=("$@")
+}
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100644
index 0000000..8a0b282
--- /dev/null
+++ b/gradlew.bat
@@ -0,0 +1,90 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windowz variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+if "%@eval[2+2]" == "4" goto 4NT_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+goto execute
+
+:4NT_args
+@rem Get arguments from the 4NT Shell from JP Software
+set CMD_LINE_ARGS=%$
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/grails-app/conf/BuildConfig.groovy b/grails-app/conf/BuildConfig.groovy
deleted file mode 100644
index b7474c1..0000000
--- a/grails-app/conf/BuildConfig.groovy
+++ /dev/null
@@ -1,37 +0,0 @@
-grails.project.class.dir = "target/classes"
-grails.project.test.class.dir = "target/test-classes"
-grails.project.test.reports.dir = "target/test-reports"
-//grails.project.war.file = "target/${appName}-${appVersion}.war"
-grails.project.dependency.resolution = {
- // inherit Grails' default dependencies
- inherits("global") {
- // uncomment to disable ehcache
- // excludes 'ehcache'
- }
- log "warn" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
- repositories {
- grailsPlugins()
- grailsHome()
- grailsCentral()
-
- // uncomment the below to enable remote dependency resolution
- // from public Maven repositories
- //mavenLocal()
- mavenCentral()
- //mavenRepo "http://snapshots.repository.codehaus.org"
- //mavenRepo "http://repository.codehaus.org"
- //mavenRepo "http://download.java.net/maven/2/"
- //mavenRepo "http://repository.jboss.com/maven2/"
- }
- dependencies {
- }
- plugins {
- // specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes eg.
- build(":tomcat:$grailsVersion",
- ":release:2.2.1",
- ":rest-client-builder:1.0.3") {
- export = false
- }
- // runtime 'mysql:mysql-connector-java:5.1.13'
- }
-}
diff --git a/grails-app/conf/Config.groovy b/grails-app/conf/Config.groovy
deleted file mode 100644
index 698e3dd..0000000
--- a/grails-app/conf/Config.groovy
+++ /dev/null
@@ -1,26 +0,0 @@
-// configuration for plugin testing - will not be included in the plugin zip
-
-log4j = {
- // Example of changing the log pattern for the default console
- // appender:
- //
- //appenders {
- // console name:'stdout', layout:pattern(conversionPattern: '%c{2} %m%n')
- //}
-
- error 'org.codehaus.groovy.grails.web.servlet', // controllers
- 'org.codehaus.groovy.grails.web.pages', // GSP
- 'org.codehaus.groovy.grails.web.sitemesh', // layouts
- 'org.codehaus.groovy.grails.web.mapping.filter', // URL mapping
- 'org.codehaus.groovy.grails.web.mapping', // URL mapping
- 'org.codehaus.groovy.grails.commons', // core / classloading
- 'org.codehaus.groovy.grails.plugins', // plugins
- 'org.codehaus.groovy.grails.orm.hibernate', // hibernate integration
- 'org.springframework',
- 'org.hibernate',
- 'net.sf.ehcache.hibernate'
-
- warn 'org.mortbay.log'
-}
-grails.views.default.codec="none" // none, html, base64
-grails.views.gsp.encoding="UTF-8"
diff --git a/grails-app/conf/UrlMappings.groovy b/grails-app/conf/UrlMappings.groovy
deleted file mode 100644
index 713febc..0000000
--- a/grails-app/conf/UrlMappings.groovy
+++ /dev/null
@@ -1,13 +0,0 @@
-class UrlMappings {
-
- static mappings = {
- "/$controller/$action?/$id?" {
- constraints {
- // apply constraints here
- }
- }
-
- "/"(view: "/index")
- "500"(view: '/error')
- }
-}
diff --git a/grails-app/conf/application.yml b/grails-app/conf/application.yml
new file mode 100644
index 0000000..d7ed9cd
--- /dev/null
+++ b/grails-app/conf/application.yml
@@ -0,0 +1,74 @@
+---
+grails:
+ profile: web-plugin
+ codegen:
+ defaultPackage: com.blogspot.hartsock.ssl.weak
+ spring:
+ transactionManagement:
+ proxies: false
+info:
+ app:
+ name: '@info.app.name@'
+ version: '@info.app.version@'
+ grailsVersion: '@info.app.grailsVersion@'
+spring:
+
+ groovy:
+ template:
+ check-template-location: false
+
+---
+grails:
+ mime:
+ disable:
+ accept:
+ header:
+ userAgents:
+ - Gecko
+ - WebKit
+ - Presto
+ - Trident
+ types:
+ all: '*/*'
+ atom: application/atom+xml
+ css: text/css
+ csv: text/csv
+ form: application/x-www-form-urlencoded
+ html:
+ - text/html
+ - application/xhtml+xml
+ js: text/javascript
+ json:
+ - application/json
+ - text/json
+ multipartForm: multipart/form-data
+ pdf: application/pdf
+ rss: application/rss+xml
+ text: text/plain
+ hal:
+ - application/hal+json
+ - application/hal+xml
+ xml:
+ - text/xml
+ - application/xml
+ urlmapping:
+ cache:
+ maxsize: 1000
+ controllers:
+ defaultScope: singleton
+ converters:
+ encoding: UTF-8
+ views:
+ default:
+ codec: html
+ gsp:
+ encoding: UTF-8
+ htmlcodec: xml
+ codecs:
+ expression: html
+ scriptlets: html
+ taglib: none
+ staticparts: none
+endpoints:
+ jmx:
+ unique-names: true
diff --git a/grails-app/conf/logback.groovy b/grails-app/conf/logback.groovy
new file mode 100644
index 0000000..1c3fdeb
--- /dev/null
+++ b/grails-app/conf/logback.groovy
@@ -0,0 +1,23 @@
+import grails.util.BuildSettings
+import grails.util.Environment
+
+// See http://logback.qos.ch/manual/groovy.html for details on configuration
+appender('STDOUT', ConsoleAppender) {
+ encoder(PatternLayoutEncoder) {
+ pattern = "%level %logger - %msg%n"
+ }
+}
+
+root(ERROR, ['STDOUT'])
+
+def targetDir = BuildSettings.TARGET_DIR
+if (Environment.isDevelopmentMode() && targetDir) {
+ appender("FULL_STACKTRACE", FileAppender) {
+ file = "${targetDir}/stacktrace.log"
+ append = true
+ encoder(PatternLayoutEncoder) {
+ pattern = "%level %logger - %msg%n"
+ }
+ }
+ logger("StackTrace", ERROR, ['FULL_STACKTRACE'], false)
+}
\ No newline at end of file
diff --git a/grails-app/controllers/com/blogspot/hartsock/ssl/weak/UrlMappings.groovy b/grails-app/controllers/com/blogspot/hartsock/ssl/weak/UrlMappings.groovy
new file mode 100644
index 0000000..c6b6b57
--- /dev/null
+++ b/grails-app/controllers/com/blogspot/hartsock/ssl/weak/UrlMappings.groovy
@@ -0,0 +1,16 @@
+package com.blogspot.hartsock.ssl.weak
+
+class UrlMappings {
+
+ static mappings = {
+ "/$controller/$action?/$id?(.$format)?"{
+ constraints {
+ // apply constraints here
+ }
+ }
+
+ "/"(view:"/index")
+ "500"(view:'/error')
+ "404"(view:'/notFound')
+ }
+}
diff --git a/grails-app/init/com/blogspot/hartsock/ssl/weak/Application.groovy b/grails-app/init/com/blogspot/hartsock/ssl/weak/Application.groovy
new file mode 100644
index 0000000..6f3784a
--- /dev/null
+++ b/grails-app/init/com/blogspot/hartsock/ssl/weak/Application.groovy
@@ -0,0 +1,10 @@
+package com.blogspot.hartsock.ssl.weak
+
+import grails.boot.GrailsApp
+import grails.boot.config.GrailsAutoConfiguration
+
+class Application extends GrailsAutoConfiguration {
+ static void main(String[] args) {
+ GrailsApp.run(Application, args)
+ }
+}
\ No newline at end of file
diff --git a/grails-app/views/error.gsp b/grails-app/views/error.gsp
new file mode 100644
index 0000000..9a3bb8a
--- /dev/null
+++ b/grails-app/views/error.gsp
@@ -0,0 +1,31 @@
+
+
+
+ Grails Runtime ExceptionError
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - An error has occurred
+ - Exception: ${exception}
+ - Message: ${message}
+ - Path: ${path}
+
+
+
+
+
+ - An error has occurred
+
+
+
+
diff --git a/grails-app/views/index.gsp b/grails-app/views/index.gsp
new file mode 100644
index 0000000..7dda996
--- /dev/null
+++ b/grails-app/views/index.gsp
@@ -0,0 +1,79 @@
+
+
+
+
+ Welcome to Grails
+
+
+
+
+
+
+ Application Status
+
+
+
+ Artefacts
+
+
+
+ Installed Plugins
+
+
+
+
+
+
+
+
+ Welcome to Grails
+
+
+ Congratulations, you have successfully started your first Grails application! At the moment
+ this is the default page, feel free to modify it to either redirect to a controller or display
+ whatever content you may choose. Below is a list of controllers that are currently deployed in
+ this application, click on each to execute its default action:
+
+
+
+
Available Controllers:
+
+
+ -
+ ${c.fullName}
+
+
+
+
+
+
+
+
+
diff --git a/grails-app/views/layouts/main.gsp b/grails-app/views/layouts/main.gsp
new file mode 100644
index 0000000..753706a
--- /dev/null
+++ b/grails-app/views/layouts/main.gsp
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/grails-app/views/notFound.gsp b/grails-app/views/notFound.gsp
new file mode 100644
index 0000000..4c873ba
--- /dev/null
+++ b/grails-app/views/notFound.gsp
@@ -0,0 +1,14 @@
+
+
+
+ Page Not Found
+
+
+
+
+
+ - Error: Page Not Found (404)
+ - Path: ${request.forwardURI}
+
+
+
diff --git a/scripts/_Install.groovy b/scripts/_Install.groovy
deleted file mode 100644
index a212160..0000000
--- a/scripts/_Install.groovy
+++ /dev/null
@@ -1,10 +0,0 @@
-//
-// This script is executed by Grails after plugin was installed to project.
-// This script is a Gant script so you can use all special variables provided
-// by Gant (such as 'baseDir' which points on project base dir). You can
-// use 'ant' to access a global instance of AntBuilder
-//
-// For example you can create directory under project tree:
-//
-// ant.mkdir(dir:"${basedir}/grails-app/jobs")
-//
diff --git a/scripts/_Uninstall.groovy b/scripts/_Uninstall.groovy
deleted file mode 100644
index 7c53169..0000000
--- a/scripts/_Uninstall.groovy
+++ /dev/null
@@ -1,5 +0,0 @@
-//
-// This script is executed by Grails when the plugin is uninstalled from project.
-// Use this script if you intend to do any additional clean-up on uninstall, but
-// beware of messing up SVN directories!
-//
diff --git a/scripts/_Upgrade.groovy b/scripts/_Upgrade.groovy
deleted file mode 100644
index 6a1a4c9..0000000
--- a/scripts/_Upgrade.groovy
+++ /dev/null
@@ -1,10 +0,0 @@
-//
-// This script is executed by Grails during application upgrade ('grails upgrade'
-// command). This script is a Gant script so you can use all special variables
-// provided by Gant (such as 'baseDir' which points on project base dir). You can
-// use 'ant' to access a global instance of AntBuilder
-//
-// For example you can create directory under project tree:
-//
-// ant.mkdir(dir:"${basedir}/grails-app/jobs")
-//
diff --git a/settings.gradle b/settings.gradle
new file mode 100644
index 0000000..af72260
--- /dev/null
+++ b/settings.gradle
@@ -0,0 +1 @@
+rootProject.name='WeakSSL'
\ No newline at end of file
diff --git a/src/main/groovy/com/blogspot/hartsock/ssl/weak/WeakSSLGrailsPlugin.groovy b/src/main/groovy/com/blogspot/hartsock/ssl/weak/WeakSSLGrailsPlugin.groovy
new file mode 100644
index 0000000..4dce324
--- /dev/null
+++ b/src/main/groovy/com/blogspot/hartsock/ssl/weak/WeakSSLGrailsPlugin.groovy
@@ -0,0 +1,90 @@
+package com.blogspot.hartsock.ssl.weak
+
+import grails.plugins.Plugin
+import grails.util.Environment
+import grails.util.Holders
+import groovy.util.logging.Slf4j
+
+@Slf4j
+class WeakSSLGrailsPlugin extends Plugin {
+
+ // the version or versions of Grails the plugin is designed for
+ def grailsVersion = "3.1.1 > *"
+ // resources that are excluded from plugin packaging
+ def pluginExcludes = [
+ "grails-app"
+ ]
+
+ def profiles = ['web']
+
+ def dependsOn = [:]
+ // resources that are excluded from plugin packaging
+ def author = "Shawn Hartsock"
+ def authorEmail = "hartsock@acm.org"
+ def title = "WeakSSL"
+ def description = '''\\
+This plugin deliberately breaks SSL for you by accepting
+any SSL certificate.
+'''
+
+ def developers = [
+ [
+ name : "Michael Rice",
+ email: "michael@michaelrice.org"
+ ],
+ [
+ name : "Sachin Verma",
+ email: "v.sachin.v@gmail.com"
+ ]
+ ]
+ // URL to the plugin's documentation
+ def documentation = "http://grails.org/plugin/weak-ssl"
+
+
+ Closure doWithSpring() {
+ { ->
+
+ }
+ }
+
+ void doWithDynamicMethods() {
+
+ }
+
+ void doWithApplicationContext() {
+ configureSSLMode()
+ }
+
+ void onChange(Map event) {
+ configureSSLMode()
+ }
+
+ void onConfigChange(Map event) {
+ configureSSLMode()
+ }
+
+ void onShutdown(Map event) {
+
+ }
+
+ private void configureSSLMode() {
+ GrailsAutoTrustModeSSL.init()
+ def trustAll = Holders.config.getProperty('trustAll', Boolean)
+ if (trustAll == null) {
+ log.trace "trustAll not set. If Environment not production setting trustAll = true"
+ trustAll = Environment.PRODUCTION != Environment.getCurrent()
+ }
+ if (trustAll) {
+ if (Environment.PRODUCTION == Environment.getCurrent()) {
+ log.warn "You are using the TrustingProvider in PRODUCTION!"
+ }
+ TrustingProvider.registerTrustingProvider()
+ }
+ List hosts = ['localhost']
+ if (Holders.config.getProperty('weakssl.trustedhosts', List)) {
+ hosts = Holders.config.getProperty('weakssl.trustedhosts', List)
+ }
+ String[] trustedHostsArray = (String[]) hosts.toArray();
+ WeakHostnameVerifier.init(trustedHostsArray)
+ }
+}
diff --git a/src/java/com/blogspot/hartsock/ssl/weak/GrailsAutoTrustModeSSL.java b/src/main/java/com/blogspot/hartsock/ssl/weak/GrailsAutoTrustModeSSL.java
similarity index 76%
rename from src/java/com/blogspot/hartsock/ssl/weak/GrailsAutoTrustModeSSL.java
rename to src/main/java/com/blogspot/hartsock/ssl/weak/GrailsAutoTrustModeSSL.java
index d92ce36..b208509 100644
--- a/src/java/com/blogspot/hartsock/ssl/weak/GrailsAutoTrustModeSSL.java
+++ b/src/main/java/com/blogspot/hartsock/ssl/weak/GrailsAutoTrustModeSSL.java
@@ -3,17 +3,15 @@
import grails.util.Environment;
import grails.util.GrailsUtil;
import grails.util.Metadata;
+import org.apache.log4j.Logger;
import java.io.File;
-import java.security.Security;
import java.util.regex.Pattern;
-import org.apache.log4j.Logger;
/**
* Detects the Grails development environment running with a generated keystore and basically turns off SSL
* certificate validation. All SSL certificates will be trusted if the class detects you have a grails generated
* SSL keystore in your runtime environment.
- *
*
* Fixes:
* sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
@@ -23,9 +21,7 @@
*/
public class GrailsAutoTrustModeSSL {
- private static final Pattern V13X = Pattern.compile("1.3.\\d+?");
- //Pattern used for Grails version 2.x.x
- private static final Pattern V2X = Pattern.compile("2.\\d.\\d+?");
+ private static final Pattern V3X = Pattern.compile("3.\\d.\\d+?");
private static Logger log = Logger.getLogger(GrailsAutoTrustModeSSL.class);
/**
@@ -60,10 +56,10 @@ private static boolean invalidGrailsKeystore() {
/**
* @return Grail's SSL Keystore
* @author Shawn Hartsock
- *
+ *
* Depends on the system property 'user.home' and on the GrailsUtil.getGrailsVersion() method to
* properly feed to findGrailsKeystore
- *
+ *
*/
public static File openGrailsKeystore() {
String userHome = System.getProperty("user.home");
@@ -77,41 +73,34 @@ public static File openGrailsKeystore() {
* @param grailsVersion
* @return Grails' SSL Keystore
* @author Shawn Hartsock
- *
+ *
* Platform independent Java to find the keystore on the file system.
* Depends on the keystore being found at:
- *
+ *
*
+ *
* ~/.grails/$GRAILS_VERSION/ssl/keystore
+ *
*
*/
public static File findGrailsKeystore(String userHome, String grailsVersion) {
log.trace("Looking for grails keystore");
File baseDir = new File(new File(userHome, ".grails"), grailsVersion);
- if (V13X.matcher(grailsVersion).find()) {
- return
- new File(
- new File(
- baseDir,
- "ssl"
- ),
- "keystore"
- );
- } else if (V2X.matcher(grailsVersion).find()) {
+ if (V3X.matcher(grailsVersion).find()) {
return
- new File(
new File(
- new File(
new File(
- baseDir,
- "projects"
+ new File(
+ new File(
+ baseDir,
+ "projects"
+ ),
+ Metadata.getCurrent().getApplicationName()
+ ),
+ "ssl"
),
- Metadata.getCurrent().getApplicationName()
- ),
- "ssl"
- ),
- "keystore"
- );
+ "keystore"
+ );
}
return null;
}
diff --git a/src/java/com/blogspot/hartsock/ssl/weak/TrustingProvider.java b/src/main/java/com/blogspot/hartsock/ssl/weak/TrustingProvider.java
similarity index 100%
rename from src/java/com/blogspot/hartsock/ssl/weak/TrustingProvider.java
rename to src/main/java/com/blogspot/hartsock/ssl/weak/TrustingProvider.java
diff --git a/src/java/com/blogspot/hartsock/ssl/weak/WeakHostnameVerifier.java b/src/main/java/com/blogspot/hartsock/ssl/weak/WeakHostnameVerifier.java
similarity index 100%
rename from src/java/com/blogspot/hartsock/ssl/weak/WeakHostnameVerifier.java
rename to src/main/java/com/blogspot/hartsock/ssl/weak/WeakHostnameVerifier.java