本文整理匯總了Golang中github.com/RangelReale/osin.AuthorizeData.ExpireAt方法的典型用法代碼示例。如果您正苦於以下問題:Golang AuthorizeData.ExpireAt方法的具體用法?Golang AuthorizeData.ExpireAt怎麽用?Golang AuthorizeData.ExpireAt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/RangelReale/osin.AuthorizeData
的用法示例。
在下文中一共展示了AuthorizeData.ExpireAt方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: LoadAuthorize
// LoadAuthorize looks up AuthorizeData by a code.
// Client information MUST be loaded together.
// Optionally can return error if expired.
func (s *Storage) LoadAuthorize(code string) (*osin.AuthorizeData, error) {
var data osin.AuthorizeData
var extra string
var cid string
if err := s.db.QueryRow("SELECT client, code, expires_in, scope, redirect_uri, state, created_at, extra FROM authorize WHERE code=$1 LIMIT 1", code).Scan(&cid, &data.Code, &data.ExpiresIn, &data.Scope, &data.RedirectUri, &data.State, &data.CreatedAt, &extra); err == sql.ErrNoRows {
return nil, pkg.ErrNotFound
} else if err != nil {
return nil, errors.New(err)
}
data.UserData = extra
c, err := s.GetClient(cid)
if err != nil {
return nil, err
}
if data.ExpireAt().Before(time.Now()) {
return nil, errors.Errorf("Token expired at %s.", data.ExpireAt().String())
}
data.Client = c
return &data, nil
}