summaryrefslogtreecommitdiffstats
path: root/model/session_test.go
diff options
context:
space:
mode:
authorDaniel Schalla <daniel@schalla.me>2018-08-02 00:16:04 +0200
committerChristopher Speller <crspeller@gmail.com>2018-08-01 15:16:04 -0700
commit2936dc87d074e6d83147c9e6cf4ae8bac4e4af8d (patch)
tree2e843f8fdf8382b13fe0a902e7b6183f1f4475bd /model/session_test.go
parent90e84d76efa775cdf7c54363218bf6817cd1bf33 (diff)
downloadchat-2936dc87d074e6d83147c9e6cf4ae8bac4e4af8d.tar.gz
chat-2936dc87d074e6d83147c9e6cf4ae8bac4e4af8d.tar.bz2
chat-2936dc87d074e6d83147c9e6cf4ae8bac4e4af8d.zip
CSRF Token Implementation for Plugins (#9192)
deleted test config fix test config Dont wipe the session token for plugins Simplified Tokens; Generate CSRF for other sessions Remove CSRF from Access Token; Remove Getter/Setter from Context fix removed setter remove getcsrf helper from plugin api enforce csrf only for cookie auth
Diffstat (limited to 'model/session_test.go')
-rw-r--r--model/session_test.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/model/session_test.go b/model/session_test.go
index 5f4a4730d..bf32d2f09 100644
--- a/model/session_test.go
+++ b/model/session_test.go
@@ -63,3 +63,18 @@ func TestSessionJson(t *testing.T) {
session.SetExpireInDays(10)
}
+
+func TestSessionCSRF(t *testing.T) {
+ s := Session{}
+ token := s.GetCSRF()
+ assert.Empty(t, token)
+
+ token = s.GenerateCSRF()
+ assert.NotEmpty(t, token)
+
+ token2 := s.GetCSRF()
+ assert.NotEmpty(t, token2)
+ assert.Equal(t, token, token2)
+}
+
+