controllers

package
v0.0.0-...-6019785 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccessToken

func AccessToken(context iris.Context)

*

  • 登录获取Token(可以任意次数重复登录以刷新AccessToken和RefreshToken)
  • @method AccessToken
  • @param iris.Context context [IRIS上下文]

func Cancel

func Cancel(context iris.Context)

func Check

func Check(context iris.Context)

func CheckRequestClient

func CheckRequestClient(context iris.Context) (bool, string)

*

  • 校验客户端配置信息是否符合标准
  • @method checkRequestClient
  • @param iris.Context context [IRIS上下文]

func RefreshToken

func RefreshToken(context iris.Context)

*

  • 根据RefreshToken刷新AccessToken
  • 1、若access_token已超时,那么进行refresh_token会获取一个新的access_token,新的超时时间;
  • 2、若access_token未超时,那么进行refresh_token不会改变access_token,但超时时间会刷新,相当于续期access_token
  • 3、refresh_token在执行刷新之后是不会变的
  • @method RefreshToken
  • @param iris.Context context [IRIS上下文]

Types

type ApiResponseJson

type ApiResponseJson struct {
	Status bool        `json:"status"`
	Msg    interface{} `json:"msg"`
	Data   interface{} `json:"data"`
}

func ApiResource

func ApiResource(status bool, objects interface{}, msg string) (apiJson *ApiResponseJson)

func ApiResourceError

func ApiResourceError(msg string) (apiJson *ApiResponseJson)

func ApiResourceSuccess

func ApiResourceSuccess(objects interface{}) (apiJson *ApiResponseJson)

type CancelTokenRequestJson

type CancelTokenRequestJson struct {
	GrantType string `json:"grant_type" validate:"required"`
}

type CheckTokenRequestJson

type CheckTokenRequestJson struct {
	AccessToken string `json:"access_token" validate:"required"`
	GrantType   string `json:"grant_type" validate:"required"`
}

type LoginRequestJson

type LoginRequestJson struct {
	Username  string `json:"username" validate:"required"`
	Password  string `json:"password" validate:"required"`
	GrantType string `json:"grant_type" validate:"required"`
	Scope     string `json:"scope" validate:"required"`
}

type LoginResponseJson

type LoginResponseJson struct {
	Username     string `json:"username"`
	AccessToken  string `json:"access_token"`
	TokenType    string `json:"token_type"`
	ExpiresIn    int    `json:"expires_in"`
	Scope        string `json:"scope"`
	RefreshToken string `json:"refresh_token"`
}

type RefreshTokenRequestJson

type RefreshTokenRequestJson struct {
	AccessToken  string `json:"access_token" validate:"required"`
	GrantType    string `json:"grant_type" validate:"required"`
	RefreshToken string `json:"refresh_token" validate:"required"`
}

Jump to

Keyboard shortcuts

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