Documentation ¶
Index ¶
- Constants
- Variables
- func RandomToken() (string, error)
- type Application
- type ApplicationParams
- type ApplicationsService
- type Client
- type Config
- type Database
- type DatabaseConfig
- type LocalApplicationsService
- func (s *LocalApplicationsService) Authorize(a *Application, scope string) (*Token, error)
- func (s *LocalApplicationsService) ExchangeAuthCode(a *Application, code, redirectUri string) (*Token, error)
- func (s *LocalApplicationsService) FindByClientId(id string) (*Application, error)
- func (s *LocalApplicationsService) FindByCredentials(id, secret string) (*Application, error)
- func (s *LocalApplicationsService) New(name, description, website, logo, clientType string) (*Application, error)
- type LocalTokensService
- type LocalUsersService
- func (s *LocalUsersService) Authorize(userId, clientId int64, scope string, refresh bool) (string, error)
- func (s *LocalUsersService) FindByCredentials(email, password string) (u *User, err error)
- func (s *LocalUsersService) FindByEmail(email string) (u *User, err error)
- func (s *LocalUsersService) FindByRefreshToken(clientId int64, token string) (u *User, err error)
- func (s *LocalUsersService) FindByToken(token string) (u *User, err error)
- func (s *LocalUsersService) New(params *UserParams) (*User, error)
- type SqlxDatabase
- type SqlxTx
- type Token
- type TokenParams
- type TokensService
- type Tx
- type User
- type UserParams
- type UsersService
Constants ¶
View Source
const DefaultClientSecretCost = 12
View Source
const DefaultPasswordCost = 12
Variables ¶
View Source
var (
ErrNotUnique = errors.New("duplicate key value violates unique key constraint")
)
Functions ¶
func RandomToken ¶
Types ¶
type Application ¶
type Application struct { Id int64 `json:"id"` Name string `json:"name"` Description string `json:"description"` Website string `json:"website"` Logo string `json:"logo"` ClientType string `json:"client_type"` ClientId string `json:"client_id"` ClientSecret string `json:"client_secret,omitempty"` HashedClientSecret string `json:"-"` }
type ApplicationParams ¶
type ApplicationParams struct { }
type ApplicationsService ¶
type ApplicationsService interface { Authorize(a *Application, scope string) (*Token, error) ExchangeAuthCode(a *Application, code, redirectUri string) (*Token, error) FindByCredentials(email, password string) (*Application, error) New(name, description, website, logo, clientType string) (*Application, error) }
type Client ¶
type Client struct { Apps ApplicationsService Tokens TokensService Users UsersService // contains filtered or unexported fields }
type Config ¶
type Config struct {
Database DatabaseConfig
}
type Database ¶
type Database interface { Close() error Begin() (Tx, error) Exec(query string, args ...interface{}) (sql.Result, error) Get(dest interface{}, query string, args ...interface{}) error QueryRow(query string, args ...interface{}) *sql.Row Rebind(query string) string Select(dest interface{}, query string, args ...interface{}) error }
func NewDatabase ¶
type DatabaseConfig ¶
type LocalApplicationsService ¶
type LocalApplicationsService struct {
// contains filtered or unexported fields
}
func (*LocalApplicationsService) Authorize ¶
func (s *LocalApplicationsService) Authorize(a *Application, scope string) (*Token, error)
func (*LocalApplicationsService) ExchangeAuthCode ¶
func (s *LocalApplicationsService) ExchangeAuthCode(a *Application, code, redirectUri string) (*Token, error)
func (*LocalApplicationsService) FindByClientId ¶
func (s *LocalApplicationsService) FindByClientId(id string) (*Application, error)
func (*LocalApplicationsService) FindByCredentials ¶
func (s *LocalApplicationsService) FindByCredentials(id, secret string) (*Application, error)
func (*LocalApplicationsService) New ¶
func (s *LocalApplicationsService) New(name, description, website, logo, clientType string) (*Application, error)
type LocalTokensService ¶
type LocalTokensService struct {
// contains filtered or unexported fields
}
func (*LocalTokensService) FindById ¶
func (s *LocalTokensService) FindById(userId, labelId int64) (*Token, error)
func (*LocalTokensService) New ¶
func (s *LocalTokensService) New(userId int64, params *TokenParams) (*Token, error)
type LocalUsersService ¶
type LocalUsersService struct {
// contains filtered or unexported fields
}
func (*LocalUsersService) FindByCredentials ¶
func (s *LocalUsersService) FindByCredentials(email, password string) (u *User, err error)
func (*LocalUsersService) FindByEmail ¶
func (s *LocalUsersService) FindByEmail(email string) (u *User, err error)
func (*LocalUsersService) FindByRefreshToken ¶
func (s *LocalUsersService) FindByRefreshToken(clientId int64, token string) (u *User, err error)
func (*LocalUsersService) FindByToken ¶
func (s *LocalUsersService) FindByToken(token string) (u *User, err error)
func (*LocalUsersService) New ¶
func (s *LocalUsersService) New(params *UserParams) (*User, error)
type SqlxDatabase ¶
func (*SqlxDatabase) Begin ¶
func (db *SqlxDatabase) Begin() (Tx, error)
type TokenParams ¶
type TokenParams struct { }
type TokensService ¶
type UserParams ¶
type UsersService ¶
type UsersService interface { FindByCredentials(email, password string) (*User, error) FindByEmail(email string) (*User, error) FindByToken(token string) (*User, error) FindByRefreshToken(clientId int64, token string) (*User, error) New(params *UserParams) (*User, error) Authorize(userId, clientId int64, scope string, refresh bool) (string, error) }
Click to show internal directories.
Click to hide internal directories.