Add TO tocookie generated-by data

Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/a54b0eff
Tree: 
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/a54b0eff
Diff: 
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/a54b0eff

Branch: refs/heads/master
Commit: a54b0eff53891d9dcc4f9912a4d3bf8e18cee844
Parents: 46d1f4b
Author: Robert Butts <robert.o.bu...@gmail.com>
Authored: Fri Jul 21 19:03:14 2017 -0600
Committer: Dewayne Richardson <dewr...@apache.org>
Committed: Thu Aug 10 09:46:03 2017 -0600

----------------------------------------------------------------------
 traffic_ops/tocookie/tocookie.go | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/a54b0eff/traffic_ops/tocookie/tocookie.go
----------------------------------------------------------------------
diff --git a/traffic_ops/tocookie/tocookie.go b/traffic_ops/tocookie/tocookie.go
index 658224d..a8a3f53 100644
--- a/traffic_ops/tocookie/tocookie.go
+++ b/traffic_ops/tocookie/tocookie.go
@@ -23,12 +23,14 @@ import (
        "time"
 )
 
+const GeneratedByStr = "trafficcontrol-go-tocookie"
 const Name = "mojolicious"
 const DefaultDuration = time.Hour
 
 type Cookie struct {
        AuthData    string `json:"auth_data"`
        ExpiresUnix int64  `json:"expires"`
+       By          string `json:"by"`
 }
 
 func checkHmac(message, messageMAC, key []byte) bool {
@@ -92,7 +94,7 @@ func NewRawMsg(msg, key []byte) string {
 }
 
 func New(user string, expiration time.Time, key string) string {
-       cookieMsg := Cookie{AuthData: user, ExpiresUnix: expiration.Unix()}
+       cookieMsg := Cookie{By: GeneratedByStr, AuthData: user, ExpiresUnix: 
expiration.Unix()}
        msg, _ := json.Marshal(cookieMsg)
        return NewRawMsg(msg, []byte(key))
 }

Reply via email to