1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-25 20:10:56 +00:00

Merge pull request #3352 from SongLiangChen/develop

add sessionid prefix
This commit is contained in:
astaxie 2018-11-08 23:29:05 +08:00 committed by GitHub
commit 9fdc1eaf3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -96,6 +96,7 @@ type ManagerConfig struct {
EnableSidInHTTPHeader bool `json:"EnableSidInHTTPHeader"` EnableSidInHTTPHeader bool `json:"EnableSidInHTTPHeader"`
SessionNameInHTTPHeader string `json:"SessionNameInHTTPHeader"` SessionNameInHTTPHeader string `json:"SessionNameInHTTPHeader"`
EnableSidInURLQuery bool `json:"EnableSidInURLQuery"` EnableSidInURLQuery bool `json:"EnableSidInURLQuery"`
SessionIDPrefix string `json:"sessionIDPrefix"`
} }
// Manager contains Provider and its configuration. // Manager contains Provider and its configuration.
@ -331,7 +332,7 @@ func (manager *Manager) sessionID() (string, error) {
if n != len(b) || err != nil { if n != len(b) || err != nil {
return "", fmt.Errorf("Could not successfully read from the system CSPRNG") return "", fmt.Errorf("Could not successfully read from the system CSPRNG")
} }
return hex.EncodeToString(b), nil return manager.config.SessionIDPrefix + hex.EncodeToString(b), nil
} }
// Set cookie with https. // Set cookie with https.