diff --git a/go.mod b/go.mod
new file mode 100644
index 0000000..4af323a
--- /dev/null
+++ b/go.mod
@@ -0,0 +1,28 @@
+module github.com/atcoder/revel-csrf
+
+go 1.14
+
+require (
+ github.com/BurntSushi/toml v0.3.1 // indirect
+ github.com/davecgh/go-spew v1.1.1 // indirect
+ github.com/fsnotify/fsnotify v1.4.9 // indirect
+ github.com/go-stack/stack v1.8.0 // indirect
+ github.com/inconshreveable/log15 v0.0.0-20200109203555-b30bc20e4fd1 // indirect
+ github.com/kr/pretty v0.1.0 // indirect
+ github.com/mattn/go-colorable v0.1.7 // indirect
+ github.com/myesui/uuid v1.0.0 // indirect
+ github.com/revel/config v1.0.0 // indirect
+ github.com/revel/log15 v2.11.20+incompatible // indirect
+ github.com/revel/pathtree v0.0.0-20140121041023-41257a1839e9 // indirect
+ github.com/revel/revel v1.0.0
+ github.com/stretchr/testify v1.5.1 // indirect
+ github.com/twinj/uuid v1.0.0 // indirect
+ github.com/xeonx/timeago v1.0.0-rc4 // indirect
+ golang.org/x/net v0.0.0-20200707034311-ab3426394381 // indirect
+ golang.org/x/sys v0.0.0-20200728102440-3e129f6d46b1 // indirect
+ gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
+ gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
+ gopkg.in/stack.v0 v0.0.0-20141108040640-9b43fcefddd0 // indirect
+ gopkg.in/stretchr/testify.v1 v1.2.2 // indirect
+ gopkg.in/yaml.v2 v2.3.0 // indirect
+)
diff --git a/go.sum b/go.sum
new file mode 100644
index 0000000..01da818
--- /dev/null
+++ b/go.sum
@@ -0,0 +1,47 @@
+github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
+github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
+github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
+github.com/inconshreveable/log15 v0.0.0-20200109203555-b30bc20e4fd1/go.mod h1:cOaXtrgN4ScfRrD9Bre7U1thNq5RtJ8ZoP4iXVGRj6o=
+github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
+github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
+github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
+github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
+github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
+github.com/myesui/uuid v1.0.0/go.mod h1:2CDfNgU0LR8mIdO8vdWd8i9gWWxLlcoIGGpSNgafq84=
+github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+github.com/revel/config v1.0.0/go.mod h1:GT4a9px5kDGRqLizcw/md0QFErrhen76toz4qS3oIoI=
+github.com/revel/log15 v2.11.20+incompatible/go.mod h1:l0WmLRs+IM1hBl4noJiBc2tZQiOgZyXzS1mdmFt+5Gc=
+github.com/revel/pathtree v0.0.0-20140121041023-41257a1839e9/go.mod h1:TmlwoRLDvgRjoTe6rbsxIaka/CulzYrgfef7iNJcEWY=
+github.com/revel/revel v1.0.0/go.mod h1:VZWJnHjpDEtuGUuZJ2NO42XryitrtwsdVaJxfDeo5yc=
+github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
+github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
+github.com/twinj/uuid v1.0.0/go.mod h1:mMgcE1RHFUFqe5AfiwlINXisXfDGro23fWdPUfOMjRY=
+github.com/xeonx/timeago v1.0.0-rc4/go.mod h1:qDLrYEFynLO7y5Ho7w3GwgtYgpy5UfhcXIIQvMKVDkA=
+golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
+golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
+golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
+golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200728102440-3e129f6d46b1 h1:sIky/MyNRSHTrdxfsiUSS4WIAMvInbeXljJz+jDjeYE=
+golang.org/x/sys v0.0.0-20200728102440-3e129f6d46b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
+gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
+gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
+gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8=
+gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k=
+gopkg.in/stack.v0 v0.0.0-20141108040640-9b43fcefddd0 h1:lMH45EKqD8Nf6LwoF+43YOKjOAEEHQRVgDyG8RCV4MU=
+gopkg.in/stack.v0 v0.0.0-20141108040640-9b43fcefddd0/go.mod h1:kl/bNzW/jgTgUOCGDj3XPn9/Hbfhw6pjfBRUnaTioFQ=
+gopkg.in/stretchr/testify.v1 v1.2.2 h1:yhQC6Uy5CqibAIlk1wlusa/MJ3iAN49/BsR/dCCKz3M=
+gopkg.in/stretchr/testify.v1 v1.2.2/go.mod h1:QI5V/q6UbPmuhtm10CaFZxED9NreB8PnFYN9JcR6TxU=
+gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
+gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
diff --git a/samples/demo/.gitignore b/samples/demo/.gitignore
deleted file mode 100644
index dae67d0..0000000
--- a/samples/demo/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-test-results/
-tmp/
-routes/
diff --git a/samples/demo/app/controllers/app.go b/samples/demo/app/controllers/app.go
deleted file mode 100644
index 5b67673..0000000
--- a/samples/demo/app/controllers/app.go
+++ /dev/null
@@ -1,34 +0,0 @@
-package controllers
-
-import (
- "github.com/revel/revel"
- "github.com/cbonello/revel-csrf/samples/demo/app/routes"
- "fmt"
-)
-
-type App struct {
- *revel.Controller
-}
-
-func (c App) Index() revel.Result {
- return c.Render()
-}
-
-func (c App) Hello(name string) revel.Result {
- route := c.Request.Request.URL.Path
- exempted := (route == "/HelloExempted")
- return c.Render(name, exempted)
-}
-
-func (c App) Hello123Exempted(name string) revel.Result {
- return c.Render(name)
-}
-
-func (c App) Logout(name string) revel.Result {
- fmt.Printf("Deleting session keys...\n")
- for k := range c.Session {
- fmt.Printf("Deleting Session[%s]: '%s'\n", k, c.Session[k])
- delete(c.Session, k)
- }
- return c.Redirect(routes.App.Index())
-}
diff --git a/samples/demo/app/init.go b/samples/demo/app/init.go
deleted file mode 100644
index 1c0d7ee..0000000
--- a/samples/demo/app/init.go
+++ /dev/null
@@ -1,26 +0,0 @@
-package app
-
-import (
- "github.com/cbonello/revel-csrf"
- "github.com/revel/revel"
-)
-
-func init() {
- // Filters is the default set of global filters.
- revel.Filters = []revel.Filter{
- revel.PanicFilter, // Recover from panics and display an error page instead.
- revel.RouterFilter, // Use the routing table to select the right Action
- revel.FilterConfiguringFilter, // A hook for adding or removing per-Action filters.
- revel.ParamsFilter, // Parse parameters into Controller.Params.
- revel.SessionFilter, // Restore and write the session cookie.
- revel.FlashFilter, // Restore and write the flash cookie.
- csrf.CSRFFilter, // CSRF prevention.
- revel.ValidationFilter, // Restore kept validation errors and save new ones from cookie.
- revel.I18nFilter, // Resolve the requested language
- revel.InterceptorFilter, // Run interceptors around the action.
- revel.ActionInvoker, // Invoke the action.
- }
-
- csrf.ExemptedFullPath("/HelloExempted")
- csrf.ExemptedGlob("/Hello[0-9]?3/Exempted")
-}
diff --git a/samples/demo/app/views/App/Hello.html b/samples/demo/app/views/App/Hello.html
deleted file mode 100644
index cb8ac47..0000000
--- a/samples/demo/app/views/App/Hello.html
+++ /dev/null
@@ -1,60 +0,0 @@
-{{set . "title" "Home"}}
-{{template "header.html" .}}
-
-{{if .name}}Hello {{ .name }}{{else}}Hello anonymous user{{end}}
-
-
- See github.com/cbonello/revel-csrf/samples/demo/app/init.go: csrf.ExemptedFullPath("/HelloExempted") -
-- Clicking on the Go Back link will trigger generation of a new index - page and reset the CSRF token to a valid value. Click on your browser's - Back button if you want to keep the altered CSRF token. This behaviour - is caused by the demo implementation and does not exhibits any bug in - revel-csrf. -
-- Note: Clicking on Go Back is your best option if you reached - this page through an AJAX call. But that will reset the CSRF token to - a valid value! -
-- Note: Clicking on Go Back is your best option if you reached - this page through an AJAX call. -
-- See github.com/cbonello/revel-csrf/samples/demo/app/init.go: csrf.ExemptedGlob("/Hello[0-9]?3/Exempted") -
-- Clicking on the Go Back link will trigger generation of a new index - page and reset the CSRF token to a valid value. Click on your browser's - Back button if you want to keep the altered CSRF token. This behaviour - is caused by the demo implementation and does not exhibits any bug in - revel-csrf. -
-- Note: Clicking on Go Back is your best option if you reached - this page through an AJAX call. But that will reset the CSRF token to - a valid value! -
-{{.help1}}
-{{.help2}}
-- The /HelloExempted and /Hello123/Exempted routes are - exempted from CSRF checking and should be functional even if the - CSRF token has been tampered. -
-- {{.Description}} -
- {{end}} -{{end}} - - diff --git a/samples/demo/app/views/errors/500.html b/samples/demo/app/views/errors/500.html deleted file mode 100644 index 0cef4de..0000000 --- a/samples/demo/app/views/errors/500.html +++ /dev/null @@ -1,16 +0,0 @@ - - - -- This exception has been logged. -
- {{end}} - - diff --git a/samples/demo/app/views/flash.html b/samples/demo/app/views/flash.html deleted file mode 100644 index 9c9ade9..0000000 --- a/samples/demo/app/views/flash.html +++ /dev/null @@ -1,18 +0,0 @@ -{{if .flash.success}} -