コード例 #1
0
ファイル: authorise.go プロジェクト: intfrr/sendto
// Setup authentication and authorization keys for this app
func Setup(s *server.Server) {

	// Set up our secret keys which we take from the config
	// NB these are hex strings which we convert to bytes, for ease of presentation in secrets file
	c := s.Configuration()
	auth.HMACKey = auth.HexToBytes(c["hmac_key"])
	auth.SecretKey = auth.HexToBytes(c["secret_key"])
	auth.SessionName = "sendto"

	// Enable https cookies on production server - we don't have https, so don't do this
	if s.Production() {
		s.Log("Using secure cookies")
		auth.SecureCookies = true
	}

}