Documentation
¶
Index ¶
- Constants
- Variables
- type Code
- type Session
- func (s *Session) Delete(i *instance.Instance) *http.Cookie
- func (s *Session) DocType() string
- func (s *Session) ID() string
- func (s *Session) OlderThan(t time.Duration) bool
- func (s *Session) Rev() string
- func (s *Session) SetID(v string)
- func (s *Session) SetRev(v string)
- func (s *Session) ToAppCookie(domain string) (*http.Cookie, error)
- func (s *Session) ToCookie() (*http.Cookie, error)
Constants ¶
View Source
const CodeLen = 16
CodeLen is the number of random bytes used for the session codes
View Source
const SessionContextKey = "session"
SessionContextKey name of the session in echo.Context
View Source
const SessionCookieName = "cozysessid"
SessionCookieName : name of the cookie created by cozy
View Source
const SessionMaxAge = 7 * 24 * 60 * 60
SessionMaxAge : duration of the session
Variables ¶
View Source
var ( // ErrNoCookie is returned by GetSession if there is no cookie ErrNoCookie = errors.New("No session cookie") // ErrInvalidID is returned by GetSession if the cookie contains wrong ID ErrInvalidID = errors.New("Session cookie has wrong ID") )
Functions ¶
This section is empty.
Types ¶
type Code ¶
A Code is used to transfer a session from the domain with the stack to a subdomain of an application, when the flat subdomains structure is used. The code is valid:
- only once
- for a short time span (1 minute)
- just for one application.
type Session ¶
type Session struct {
Instance *instance.Instance `json:"-"`
DocID string `json:"_id,omitempty"`
DocRev string `json:"_rev,omitempty"`
LastSeen time.Time `json:"last_seen,omitempty"`
Closed bool `json:"closed"`
}
A Session is an instance opened in a browser
func GetSession ¶
GetSession retrieves the session from a echo.Context
func (*Session) Delete ¶
Delete is a function to delete the session in couchdb, and returns a cookie with a negative MaxAge to clear it
func (*Session) ToAppCookie ¶
ToAppCookie returns an http.Cookie for this Session on an app subdomain
Click to show internal directories.
Click to hide internal directories.