Documentation
¶
Index ¶
- Constants
- func NewFactory() auth.IAuthFactory
- func Register()
- func Scan(src []interface{}, dest ...interface{}) ([]interface{}, error)
- type AuthorizeHandler
- type Client
- type Config
- type Error
- type Handler
- type IHandler
- type Manager
- type Pattern
- type Scanner
- type Token
- type TokenData
- type TokenHandler
- type TokenResponse
- type User
Constants ¶
View Source
const ( ResponseTypeCode = "code" ResponseTypeToken = "token" )
View Source
const ( GrantAuthorizationCode = "authorization_code" GrantClientCredentials = "client_credentials" GrantRefreshToken = "refresh_token" )
Variables ¶
This section is empty.
Functions ¶
func Scan ¶
func Scan(src []interface{}, dest ...interface{}) ([]interface{}, error)
Scan copies from src to the values pointed at by dest.
Scan uses RedisScan if available otherwise:
The values pointed at by dest must be an integer, float, boolean, string, []byte, interface{} or slices of these types. Scan uses the standard strconv package to convert bulk strings to numeric and boolean types.
If a dest value is nil, then the corresponding src value is skipped.
If a src element is nil, then the corresponding dest value is not modified.
To enable easy use of Scan in a loop, Scan returns the slice of src following the copied values.
Types ¶
type AuthorizeHandler ¶
type AuthorizeHandler struct {
// contains filtered or unexported fields
}
func NewAuthorizeHandler ¶
func NewAuthorizeHandler() *AuthorizeHandler
func (*AuthorizeHandler) Handle ¶
func (a *AuthorizeHandler) Handle(ctx http_context.IHttpContext, client *Client, params url.Values)
type Config ¶
type Config struct { application.Auth Users []*User `json:"users" label:"用户列表"` }
type IHandler ¶
type IHandler interface {
Handle(ctx http_context.IHttpContext, client *Client, params url.Values)
}
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager 管理oauth2配置
func NewManager ¶
func NewManager() *Manager
type Pattern ¶
type Pattern struct { ClientId string `json:"client_id"` ClientSecret string `json:"client_secret"` ClientType string `json:"client_type"` HashSecret bool `json:"hash_secret"` RedirectUrls []string `json:"redirect_urls" label:"重定向URL"` Scopes []string `json:"scopes" label:"授权范围"` MandatoryScope bool `json:"mandatory_scope" label:"强制授权"` ProvisionKey string `json:"provision_key" label:"Provision Key"` TokenExpiration int `json:"token_expiration" label:"令牌过期时间"` RefreshTokenTTL int `json:"refresh_token_ttl" label:"刷新令牌TTL"` EnableAuthorizationCode bool `json:"enable_authorization_code" label:"启用授权码模式"` EnableImplicitGrant bool `json:"enable_implicit_grant" label:"启用隐式授权模式"` EnableClientCredentials bool `json:"enable_client_credentials" label:"启用客户端凭证模式"` AcceptHttpIfAlreadyTerminated bool `json:"accept_http_if_already_terminated" label:"如果已终止,则接受HTTP"` ReuseRefreshToken bool `json:"reuse_refresh_token" label:"重用刷新令牌"` PersistentRefreshToken bool `json:"persistent_refresh_token" label:"持久刷新令牌"` }
type Scanner ¶
type Scanner interface { // RedisScan assigns a value from a Redis value. The argument src is one of // the reply types listed in the section `Executing Commands`. // // An error should be returned if the value cannot be stored without // loss of information. RedisScan(src interface{}) error }
type TokenData ¶
type TokenData struct { AuthenticatedUserid interface{} `json:"authenticated_userid"` Credential struct { Id string `json:"id"` } `json:"credential"` AccessToken string `json:"access_token"` Service interface{} `json:"service"` CreatedAt int64 `json:"created_at"` RefreshToken interface{} `json:"refresh_token"` Scope interface{} `json:"scope"` Ttl int `json:"ttl"` TokenType string `json:"token_type"` ExpiresIn int `json:"expires_in"` ClientID string `json:"client_id"` }
type TokenHandler ¶
type TokenHandler struct {
// contains filtered or unexported fields
}
func NewTokenHandler ¶
func NewTokenHandler() *TokenHandler
func (*TokenHandler) Handle ¶
func (t *TokenHandler) Handle(ctx http_service.IHttpContext, client *Client, params url.Values)
func (*TokenHandler) ServeHTTP ¶
func (t *TokenHandler) ServeHTTP(writer http.ResponseWriter, request *http.Request)
type TokenResponse ¶
Click to show internal directories.
Click to hide internal directories.