• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang osin.AuthorizeData类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/RangelReale/osin.AuthorizeData的典型用法代码示例。如果您正苦于以下问题:Golang AuthorizeData类的具体用法?Golang AuthorizeData怎么用?Golang AuthorizeData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了AuthorizeData类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: transfer

func (old *AuthorizeData) transfer() *osin.AuthorizeData {
	var authorizeData osin.AuthorizeData = osin.AuthorizeData{}
	authorizeData.Client = &old.Client
	authorizeData.Code = old.Code
	authorizeData.ExpiresIn = old.ExpiresIn
	authorizeData.Scope = old.Scope
	authorizeData.RedirectUri = old.RedirectUri
	authorizeData.State = old.State
	authorizeData.CreatedAt = old.CreatedAt
	authorizeData.UserData = old.UserData
	return &authorizeData
}
开发者ID:zhangbaitong,项目名称:ark-ucenter,代码行数:12,代码来源:types.go


示例2: LoadAuthorize

func (s *Storage) LoadAuthorize(code string) (*osin.AuthorizeData, error) {
	var data osin.AuthorizeData
	var userData string
	var cid string
	row := s.db.QueryRow("SELECT client, code, expires_in, scope, redirect_uri, state, created_at, extra FROM authorize WHERE code=$1 LIMIT 1", code)
	if err := row.Scan(&cid, &data.Code, &data.ExpiresIn, &data.Scope, &data.RedirectUri, &data.State, &data.CreatedAt, &userData); err != nil {
		return nil, err
	}
	data.UserData = userData

	c, err := s.GetClient(cid)
	if err != nil {
		return nil, err
	}

	data.Client = c
	return &data, nil
}
开发者ID:galeone,项目名称:osin-storage,代码行数:18,代码来源:postgres.go


示例3: 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
	}

	data.Client = c
	return &data, nil
}
开发者ID:guitou4573,项目名称:osin-storage,代码行数:22,代码来源:postgres.go


示例4: LoadAuthorize

// LoadAuthorize loads auth data from redis
func (r RedisOsinStorageInterface) LoadAuthorize(code string) (*osin.AuthorizeData, error) {
	key := AUTH_PREFIX + code
	log.Debug("Loading auth code: ", key)
	authJSON, storeErr := r.store.GetKey(key)

	if storeErr != nil {
		log.Error("Failure retreiving auth code key")
		log.Error(storeErr)
		return nil, storeErr
	}

	thisAuthData := osin.AuthorizeData{}
	thisAuthData.Client = new(osin.DefaultClient)
	if marshalErr := json.Unmarshal([]byte(authJSON), &thisAuthData); marshalErr != nil {
		log.Error("Couldn't unmarshal OAuth auth data object (LoadAuthorize)")
		log.Error(marshalErr)
		return nil, marshalErr
	}

	return &thisAuthData, nil
}
开发者ID:alexpopero,项目名称:tyk,代码行数:22,代码来源:oauth_manager.go


示例5: createAuthorizeData

func (store *MongoStorage) createAuthorizeData(copyFrom *AuthorizeData, osinData *osin.AuthorizeData) *osin.AuthorizeData {
	osinData.Code = copyFrom.Code
	osinData.ExpiresIn = copyFrom.ExpiresIn
	osinData.Scope = copyFrom.Scope
	osinData.RedirectUri = copyFrom.RedirectUri
	osinData.State = copyFrom.State
	osinData.CreatedAt = copyFrom.CreatedAt
	osinData.UserData = copyFrom.UserData

	client, err := store.GetClientWithUserData(copyFrom.UserData)
	if err != nil || client == nil {
		osinData.Client = &osin.DefaultClient{}
	} else {
		osinData.Client = client
	}

	return osinData
}
开发者ID:koding,项目名称:koding,代码行数:18,代码来源:authorization.go


示例6: 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

	args := map[string]interface{}{
		"code": code,
	}
	nstmt, err := s.db.PrepareNamed("SELECT client, code, expires_in, scope, redirect_uri, state, created_at, extra FROM authorize WHERE code=:code LIMIT 1")
	if err := nstmt.QueryRowx(args).Scan(&cid, &data.Code, &data.ExpiresIn, &data.Scope, &data.RedirectUri, &data.State, &data.CreatedAt, &extra); err == sql.ErrNoRows {
		return nil, errors.New("not found")
	} else if err != nil {
		return nil, errors.New(err)
	}
	data.UserData = extra

	c, err := s.GetClient(cid)
	if err != nil {
		return nil, err
	}

	data.Client = c
	return &data, nil
}
开发者ID:guitou4573,项目名称:osin-storage,代码行数:27,代码来源:mysql.go



注:本文中的github.com/RangelReale/osin.AuthorizeData类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang osin.AuthorizeRequest类代码示例发布时间:2022-05-28
下一篇:
Golang osin.AccessData类代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap