tickets

package
v0.0.0-...-6dfde0d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 8, 2017 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SocketTicket

type SocketTicket struct {
	ID      string    `json:"id" gorm:"primary_key" sql:"type:uuid;default:uuid_generate_v4()"`
	UserID  string    `json:"user_id"`
	Expires time.Time `json:"expires"`
}

SocketTicket exists because the Javascript WebSocket API doesn't allow headers to be modified. This isn't a problem on the web, as we have cookies, but on mobile we usuall send a header with an authentication token. The SocketTicket acts as a temporary authentication to allow authenticated websocket transactions.

func GetByID

func GetByID(id string, db *gorm.DB) (t SocketTicket, err error)

func GetByUserID

func GetByUserID(userID string, db *gorm.DB) (t SocketTicket, err error)

func NewSocketTicket

func NewSocketTicket(userID string) SocketTicket

NewSocketTicket generates a new socket with a key

func (*SocketTicket) IsValid

func (s *SocketTicket) IsValid() bool

IsValid returns whether a ticket is still good. They expire after 24 hours

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL