oauth

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: May 24, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	ID                   uint        `json:"id,omitempty"`
	Name                 string      `json:"name"`
	Code                 string      `json:"code,omitempty"`
	Secret               string      `json:"secret,omitempty"`
	RedirectURI          string      `json:"redirect_uri" db:"redirect_uri"`
	UserData             interface{} `json:"-" db:"userdata"`
	CreatedAt            time.Time   `json:"created,omitempty" db:"created"`
	AllowedGrantTypes    StringSlice `json:"grant_types,omitempty" db:"grant_types" `
	AllowedResponseTypes StringSlice `json:"response_types,omitempty" db:"response_types"`
	AllowedScopes        StringSlice `json:"scopes,omitempty" db:"scopes"`
}

Client of oauth2 app

func NewClient

func NewClient(name, code, secret, redirectURI string) *Client

NewClient build a client

func (*Client) GetId

func (c *Client) GetId() string

GetId osin.Client.GetId

func (*Client) GetRedirectUri

func (c *Client) GetRedirectUri() string

GetRedirectUri osin.Client.GetRedirectUri

func (*Client) GetSecret

func (c *Client) GetSecret() string

GetSecret osin.Client.GetSecret

func (*Client) GetUserData

func (c *Client) GetUserData() interface{}

GetUserData osin.Client.GetUserData

type ClientSpec added in v0.9.0

type ClientSpec struct {
	Page   int      `json:"page,omitempty" form:"page"`
	Limit  int      `json:"limit,omitempty" form:"limit"`
	Orders []string `json:"order,omitempty" form:"order"`
	Total  int      `json:"total,omitempty"` // for set value

	CountOnly bool `json:"count,omitempty" form:"count"`
}

ClientSpec 查询参数

type OSINStore added in v0.9.0

type OSINStore interface {
	osin.Storage

	LoadClients(spec *ClientSpec) ([]Client, error)
	CountClients() uint
	GetClientWithCode(code string) (*Client, error)
	GetClientWithID(id int) (*Client, error)
	SaveClient(client *Client) error

	LoadScopes() (scopes []Scope, err error)
	IsAuthorized(clientID, username string) bool
	SaveAuthorized(clientID, username string) error
}

type Scope

type Scope struct {
	Name        string
	Label       string
	Description string
	IsDefault   bool
}

type StringSlice added in v0.9.0

type StringSlice = types.StringSlice

Jump to

Keyboard shortcuts

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