token

package
v0.0.0-...-732a6c7 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2018 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service to handle tokens

func New

func New(conf *config.Config, db *sqlx.DB) *Service

New - create a new service for tokens

func (*Service) Add

func (s *Service) Add(person, source, externalAccessToken, externalRefreshToken string, externalExpiresIn int64, externalTokenType string) (string, error)

Add a token

func (*Service) Remove

func (s *Service) Remove(accessToken string) error

Remove a token

func (*Service) Validate

func (s *Service) Validate(accessToken string) (bool, string, error)

Validate a token

type Token

type Token struct {
	ID                   string    `db:"id" json:"id,omitempty"`
	Person               string    `db:"person" json:"person,omitempty"`
	Source               string    `db:"source" json:"source,omitempty"`
	AccessToken          string    `db:"access_token" json:"access_token,omitempty"`
	ExpiresIn            int       `db:"expires_in" json:"expires_in,omitempty"`
	ExternalAccessToken  string    `db:"external_access_token" json:"external_access_token,omitempty"`
	ExternalRefreshToken string    `db:"external_refresh_token" json:"external_refresh_token,omitempty"`
	ExternalExpiresIn    int       `db:"external_expires_in" json:"external_expires_in,omitempty"`
	ExternalTokenType    string    `db:"external_token_type" json:"external_token_type,omitempty"`
	Deleted              bool      `db:"deleted" json:"deleted,omitempty"`
	CreatedAt            time.Time `db:"created_at" json:"created_at,omitempty"`
	UpdatedAt            time.Time `db:"updated_at" json:"updated_at,omitempty"`
}

Token saves token details for a user

Jump to

Keyboard shortcuts

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