Documentation ¶
Overview ¶
Package session provides session storage and management.
Copyright (c) 2018 - 2024 PhotoPrism UG. All rights reserved.
This program is free software: you can redistribute it and/or modify it under Version 3 of the GNU Affero General Public License (the "AGPL"): <https://docs.photoprism.app/license/agpl> This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. The AGPL is supplemented by our Trademark and Brand Guidelines, which describe how our Brand Assets may be used: <https://www.photoprism.app/trademark>
Feel free to send an email to hello@photoprism.app if you have questions, want to support our work, or just want to say hello.
Additional information can be found in our Developer Guide: <https://docs.photoprism.app/developer-guide/>
Index ¶
- Variables
- func Cleanup(interval time.Duration)
- func Shutdown()
- type Session
- func (s *Session) Create(u *entity.User, c *gin.Context, data *entity.SessionData) (m *entity.Session, err error)
- func (s *Session) Delete(id string) error
- func (s *Session) Exists(id string) bool
- func (s *Session) Get(id string) (m *entity.Session, err error)
- func (s *Session) New(c *gin.Context) (m *entity.Session)
- func (s *Session) Public() *entity.Session
- func (s *Session) Save(m *entity.Session) (*entity.Session, error)
Constants ¶
This section is empty.
Variables ¶
var CleanupAction = func() { if n := entity.DeleteExpiredSessions(); n > 0 { event.AuditInfo([]string{"deleted %s"}, english.Plural(n, "expired session", "expired sessions")) } else { event.AuditDebug([]string{"found no expired sessions"}) } }
CleanupAction deletes sessions that have expired.
var PublicAuthToken = "234200000000000000000000000000000000000000000000"
PublicAuthToken is a static authentication token used in public mode.
var PublicID = rnd.SessionID(PublicAuthToken)
PublicID is the SHA256 hash of the PublicAuthToken: a9b8ff820bf40ab451910f8bbfe401b2432446693aa539538fbd2399560a722f
Functions ¶
Types ¶
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session represents a session store.
func (*Session) Create ¶
func (s *Session) Create(u *entity.User, c *gin.Context, data *entity.SessionData) (m *entity.Session, err error)
Create initializes a new client session and returns it.