From 187add9b84f26a4ba2086e3444032cd2b2210a9e Mon Sep 17 00:00:00 2001 From: SongLiangChen <462039091@qq.com> Date: Wed, 10 Oct 2018 11:02:45 +0800 Subject: [PATCH 1/5] add sessionid prefix --- session/session.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/session/session.go b/session/session.go index cf647521..f33c48e7 100644 --- a/session/session.go +++ b/session/session.go @@ -96,6 +96,7 @@ type ManagerConfig struct { EnableSidInHTTPHeader bool `json:"EnableSidInHTTPHeader"` SessionNameInHTTPHeader string `json:"SessionNameInHTTPHeader"` EnableSidInURLQuery bool `json:"EnableSidInURLQuery"` + SessionIDPrefix string `json:"sessionIDPrefix"` } // Manager contains Provider and its configuration. @@ -331,7 +332,11 @@ func (manager *Manager) sessionID() (string, error) { if n != len(b) || err != nil { return "", fmt.Errorf("Could not successfully read from the system CSPRNG") } - return hex.EncodeToString(b), nil + sid := hex.EncodeToString(b) + if manager.config.SessionIDPrefix != "" { + sid = manager.config.SessionIDPrefix + sid + } + return sid, nil } // Set cookie with https. From abc8b780656e548a5cafbc3b31df582096dc5ccc Mon Sep 17 00:00:00 2001 From: SongLiang <462039091@qq.com> Date: Mon, 29 Oct 2018 12:18:06 +0800 Subject: [PATCH 2/5] add sessionId prefix --- session/session.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/session/session.go b/session/session.go index f33c48e7..908b7f37 100644 --- a/session/session.go +++ b/session/session.go @@ -334,7 +334,7 @@ func (manager *Manager) sessionID() (string, error) { } sid := hex.EncodeToString(b) if manager.config.SessionIDPrefix != "" { - sid = manager.config.SessionIDPrefix + sid + return manager.config.SessionIDPrefix + sid } return sid, nil } From d3ad810f16a4599f8fffdb9ebf692bf119ab85b4 Mon Sep 17 00:00:00 2001 From: SongLiang <462039091@qq.com> Date: Mon, 29 Oct 2018 13:35:31 +0800 Subject: [PATCH 3/5] add sessionId prefix --- session/session.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/session/session.go b/session/session.go index 908b7f37..af8c47bc 100644 --- a/session/session.go +++ b/session/session.go @@ -334,7 +334,7 @@ func (manager *Manager) sessionID() (string, error) { } sid := hex.EncodeToString(b) if manager.config.SessionIDPrefix != "" { - return manager.config.SessionIDPrefix + sid + return manager.config.SessionIDPrefix + sid, nil } return sid, nil } From 501d8a97f6eac3ba3e89a7f60e3d1bc2c7fc72e5 Mon Sep 17 00:00:00 2001 From: SongLiang <462039091@qq.com> Date: Mon, 5 Nov 2018 09:50:19 +0800 Subject: [PATCH 4/5] add sessionId prefix --- session/session.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/session/session.go b/session/session.go index af8c47bc..74eb3b12 100644 --- a/session/session.go +++ b/session/session.go @@ -333,10 +333,7 @@ func (manager *Manager) sessionID() (string, error) { return "", fmt.Errorf("Could not successfully read from the system CSPRNG") } sid := hex.EncodeToString(b) - if manager.config.SessionIDPrefix != "" { - return manager.config.SessionIDPrefix + sid, nil - } - return sid, nil + return manager.config.SessionIDPrefix + sid, nil } // Set cookie with https. From c8da875f833bfc82e4aaa81a4c2dd9ade9106f67 Mon Sep 17 00:00:00 2001 From: SongLiang <462039091@qq.com> Date: Mon, 5 Nov 2018 09:51:27 +0800 Subject: [PATCH 5/5] add sessionId prefix --- session/session.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/session/session.go b/session/session.go index 74eb3b12..ec5d004f 100644 --- a/session/session.go +++ b/session/session.go @@ -332,8 +332,7 @@ func (manager *Manager) sessionID() (string, error) { if n != len(b) || err != nil { return "", fmt.Errorf("Could not successfully read from the system CSPRNG") } - sid := hex.EncodeToString(b) - return manager.config.SessionIDPrefix + sid, nil + return manager.config.SessionIDPrefix + hex.EncodeToString(b), nil } // Set cookie with https.