service

package
v0.0.0-...-d933f62 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2018 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package service implement the services required by the rest package

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(repo RepoInterface) *service

New return a new instance of the service

Types

type Access

type Access struct {
	gorm.Model
	Client       string `gorm:"NOT NULL"`
	UserId       uint   `gorm:"NOT NULL"`
	Authorize    string `gorm:"NOT NULL"`
	Previous     string `gorm:"NOT NULL"`
	AccessToken  string `gorm:"NOT NULL;PRIMARY KEY"`
	RefreshToken string `gorm:"NOT NULL"`
	ExpiresIn    int32  `gorm:"NOT NULL"`
	Scope        string `gorm:"NOT NULL"`
	RedirectUri  string `gorm:"NOT NULL"`
}

Access database object

type Authorize

type Authorize struct {
	gorm.Model
	Client      string `gorm:"NOT NULL"`
	UserId      uint   `gorm:"NOT NULL"`
	Code        string `gorm:"NOT NULL;PRIMARY KEY"`
	ExpiresIn   int32  `gorm:"NOT NULL"`
	Scope       string `gorm:"NOT NULL"`
	RedirectUri string `gorm:"NOT NULL"`
	State       string `gorm:"NOT NULL"`
}

Authorize database object

type Client

type Client struct {
	UserId      uint   `gorm:"NOT NULL"`
	Id          string `gorm:"NOT NULL;PRIMARY KEY"`
	Secret      string `gorm:"NOT NULL"`
	RedirectUri string `gorm:"NOT NULL"`
}

Client database object

type Refresh

type Refresh struct {
	gorm.Model
	Token  string `gorm:"NOT NULL;PRIMARY KEY"`
	Access string `gorm:"NOT NULL"`
}

Refresh database object

type RepoInterface

type RepoInterface interface {
	FindByAccessToken(token string) (Access, error)
}

RepoInterface is the model for the repo package of oauth2

Jump to

Keyboard shortcuts

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