Documentation ¶
Index ¶
- func SHA256(sources ...string) string
- type OauthAccess
- type OauthAuthorize
- type OauthClient
- type OauthExpires
- type OauthRefresh
- type Storage
- func (s *Storage) AddExpireAtData(code string, expireAt time.Time) error
- func (s *Storage) Clone() osin.Storage
- func (s *Storage) Close()
- func (s *Storage) CreateClient(c osin.Client) error
- func (s *Storage) CreateClientWithInformation(id string, secret string, redirectURI string, userData interface{}) osin.Client
- func (s *Storage) CreateSchemas() error
- func (s *Storage) GetClient(id string) (osin.Client, error)
- func (s *Storage) LoadAccess(code string) (*osin.AccessData, error)
- func (s *Storage) LoadAuthorize(code string) (*osin.AuthorizeData, error)
- func (s *Storage) LoadRefresh(code string) (*osin.AccessData, error)
- func (s *Storage) RemoveAccess(code string) (err error)
- func (s *Storage) RemoveAuthorize(code string) (err error)
- func (s *Storage) RemoveClient(id string) error
- func (s *Storage) RemoveExpireAtData(code string) error
- func (s *Storage) RemoveRefresh(code string) error
- func (s *Storage) SaveAccess(data *osin.AccessData) (err error)
- func (s *Storage) SaveAuthorize(data *osin.AuthorizeData) error
- func (s *Storage) UpdateClient(c osin.Client) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type OauthAccess ¶
type OauthAccess struct { AccessToken string `json:"access_token" xorm:"pk VARCHAR(255) NOT NULL"` Client string `json:"client" xorm:"VARCHAR(255) NOT NULL"` Authorize *string `json:"authorize" xorm:"VARCHAR(255) NULL"` Previous *string `json:"previous" xorm:"VARCHAR(255) NULL"` RefreshToken *string `json:"refresh_token" xorm:"VARCHAR(255) NULL"` ExpiresIn int64 `json:"expires_in" xorm:"INT(20) NOT NULL"` Scope *string `json:"scope" xorm:"VARCHAR(255) NULL"` RedirectUri *string `json:"redirect_uri" xorm:"VARCHAR(255) NOT NULL"` Extra *string `json:"extra" xorm:"VARCHAR(255) NULL"` CreatedAt int64 `json:"created_at" xorm:"INT(20) NOT NULL"` }
type OauthAuthorize ¶
type OauthAuthorize struct { Client string `json:"client" xorm:"VARCHAR(255) NOT NULL"` Code string `json:"code" xorm:"pk VARCHAR(255) NOT NULL"` ExpiresIn int64 `json:"expires_in" xorm:"INT(20) NOT NULL"` Scope *string `json:"scope" xorm:"VARCHAR(255) NULL"` RedirectUri *string `json:"redirect_uri" xorm:"VARCHAR(255) NOT NULL"` State *string `json:"state" xorm:"VARCHAR(255) NULL"` Extra *string `json:"extra" xorm:"VARCHAR(255) NULL"` CreatedAt int64 `json:"created_at" xorm:"INT(20) NOT NULL"` }
type OauthClient ¶
type OauthClient struct { Id string `json:"id" xorm:"pk VARCHAR(255) NOT NULL"` Secret string `json:"secret" xorm:"VARCHAR(255) NOT NULL"` Extra *string `json:"extra" xorm:"VARCHAR(255) NULL"` RedirectUri *string `json:"redirect_uri" xorm:"VARCHAR(255) NULL"` }
func (*OauthClient) ClientSecretMatches ¶
func (this *OauthClient) ClientSecretMatches(secret string) bool
func (*OauthClient) GetRedirectUri ¶
func (this *OauthClient) GetRedirectUri() string
Base client uri
func (*OauthClient) GetUserData ¶
func (this *OauthClient) GetUserData() interface{}
Data to be passed to storage. Not used by the library.
type OauthExpires ¶
type OauthRefresh ¶
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage implements interface "github.com/RangelReale/osin".Storage and interface "github.com/felipeweb/osin-mysql/storage".Storage
func (*Storage) AddExpireAtData ¶
AddExpireAtData add info in expires table
func (*Storage) Clone ¶
Clone the storage if needed. For example, using mgo, you can clone the session with session.Clone to avoid concurrent access problems. This is to avoid cloning the connection at each method access. Can return itself if not a problem.
func (*Storage) Close ¶
func (s *Storage) Close()
Close the resources the Storage potentially holds (using Clone for example)
func (*Storage) CreateClient ¶
CreateClient stores the client in the database and returns an error, if something went wrong.
func (*Storage) CreateClientWithInformation ¶
func (s *Storage) CreateClientWithInformation(id string, secret string, redirectURI string, userData interface{}) osin.Client
CreateClientWithInformation Makes easy to create a osin.DefaultClient
func (*Storage) CreateSchemas ¶
CreateSchemas creates the schemata, if they do not exist yet in the database. Returns an error if something went wrong.
func (*Storage) LoadAccess ¶
func (s *Storage) LoadAccess(code string) (*osin.AccessData, error)
LoadAccess retrieves access data by token. Client information MUST be loaded together. AuthorizeData and AccessData DON'T NEED to be loaded if not easily available. Optionally can return error if expired.
func (*Storage) LoadAuthorize ¶
func (s *Storage) LoadAuthorize(code string) (*osin.AuthorizeData, error)
LoadAuthorize looks up AuthorizeData by a code. Client information MUST be loaded together. Optionally can return error if expired.
func (*Storage) LoadRefresh ¶
func (s *Storage) LoadRefresh(code string) (*osin.AccessData, error)
LoadRefresh retrieves refresh AccessData. Client information MUST be loaded together. AuthorizeData and AccessData DON'T NEED to be loaded if not easily available. Optionally can return error if expired.
func (*Storage) RemoveAccess ¶
RemoveAccess revokes or deletes an AccessData.
func (*Storage) RemoveAuthorize ¶
RemoveAuthorize revokes or deletes the authorization code.
func (*Storage) RemoveClient ¶
RemoveClient removes a client (identified by id) from the database. Returns an error if something went wrong.
func (*Storage) RemoveExpireAtData ¶
RemoveExpireAtData remove info in expires table
func (*Storage) RemoveRefresh ¶
RemoveRefresh revokes or deletes refresh AccessData.
func (*Storage) SaveAccess ¶
func (s *Storage) SaveAccess(data *osin.AccessData) (err error)
SaveAccess writes AccessData. If RefreshToken is not blank, it must save in a way that can be loaded using LoadRefresh.
func (*Storage) SaveAuthorize ¶
func (s *Storage) SaveAuthorize(data *osin.AuthorizeData) error
SaveAuthorize saves authorize data.