Documentation ¶
Index ¶
- Variables
- func ClientBasicHandler(r *http.Request) (string, string, error)
- func ClientFormHandler(r *http.Request) (string, string, error)
- func DefPasswordAuthorizationHandler(username, password string) (string, error)
- func DefUserAuthorizationHandler(w http.ResponseWriter, r *http.Request) (string, error)
- func DefValidateURIHandler(baseURI string, redirectURI string) error
- func GetDefaultStore() store.Store
- func GetDefaultTokenConfig() map[api.GrantType]*TokenConfig
- type AuthCodeOption
- type AuthorizeRequest
- type AuthorizeScopeHandler
- type ClientAuthorizedHandler
- type ClientInfoHandler
- type ClientScopeHandler
- type ExtensionFieldsHandler
- type Generates
- type MacRequest
- type Oauth2
- func (o *Oauth2) HandleAuthorizeRequest(w http.ResponseWriter, r *http.Request) error
- func (o *Oauth2) HandleTokenRequest(w http.ResponseWriter, r *http.Request) error
- func (o *Oauth2) SaveClient(ctx context.Context, client *stores.Client)
- func (o *Oauth2) SetAccessGenerate(accessGenerate generates.AccessGenerate)
- func (o *Oauth2) SetAuthorizeGenerate(authorizeGenerate generates.AuthorizeGenerate)
- func (o *Oauth2) SetClientAuthorizedHandler(clientAuthorizedHandler ClientAuthorizedHandler)
- func (o *Oauth2) SetClientScopeHandler(clientScopeHandler ClientScopeHandler)
- func (o *Oauth2) SetClientStore(clientStore *stores.ClientStore)
- func (o *Oauth2) SetExtensionFieldsHandler(extensionFieldsHandler ExtensionFieldsHandler)
- func (o *Oauth2) SetRefreshingScopeHandler(refreshingScopeHandler RefreshingScopeHandler)
- func (o *Oauth2) SetTokenStore(tokenStore *stores.TokenStore)
- func (o *Oauth2) SetValidateURIHandler(validateURIHandler ValidateURIHandler)
- func (o *Oauth2) ValidationBearerToken(r *http.Request) (*token.Token, error)
- func (o *Oauth2) ValidationMACToken(r *http.Request) (*token.Token, error)
- type Options
- type PasswordAuthorizationHandler
- type RefreshingConfig
- type RefreshingScopeHandler
- type Request
- type Response
- type TokenConfig
- type TokenRequest
- type UserAuthorizationHandler
- type ValidateClientHandler
- type ValidateURIHandler
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultCodeExp = time.Minute * 10 DefaultAuthorizeCodeTokenCfg = &TokenConfig{AccessTokenExp: time.Hour * 2, RefreshTokenExp: time.Hour * 24 * 3, IsGenerateRefresh: true} DefaultImplicitTokenCfg = &TokenConfig{AccessTokenExp: time.Hour * 1} DefaultPasswordTokenCfg = &TokenConfig{AccessTokenExp: time.Hour * 2, RefreshTokenExp: time.Hour * 24 * 7, IsGenerateRefresh: true} DefaultClientTokenCfg = &TokenConfig{AccessTokenExp: time.Hour * 2} DefaultRefreshTokenCfg = &RefreshingConfig{IsGenerateRefresh: true, IsRemoveAccess: true, IsRemoveRefreshing: true} )
Functions ¶
func DefValidateURIHandler ¶
func GetDefaultStore ¶
func GetDefaultTokenConfig ¶
func GetDefaultTokenConfig() map[api.GrantType]*TokenConfig
Types ¶
type AuthCodeOption ¶
type AuthCodeOption interface {
// contains filtered or unexported methods
}
var ( AccessTypeOnline AuthCodeOption = SetAuthURLParam("access_type", "online") AccessTypeOffline AuthCodeOption = SetAuthURLParam("access_type", "offline") ApprovalForce AuthCodeOption = SetAuthURLParam("prompt", "consent") )
func SetAuthURLParam ¶
func SetAuthURLParam(key, value string) AuthCodeOption
type AuthorizeRequest ¶
type AuthorizeScopeHandler ¶
type ClientAuthorizedHandler ¶
type ClientInfoHandler ¶
type ClientScopeHandler ¶
type ExtensionFieldsHandler ¶
type Generates ¶
type Generates struct { TokenType string MacAlgorithm string AllowedGrantTypes []api.GrantType ClientStore *stores.ClientStore TokenStore *stores.TokenStore AuthorizeGenerate generates.AuthorizeGenerate AccessGenerate generates.AccessGenerate ValidateURIHandler ValidateURIHandler ExtensionFieldsHandler ExtensionFieldsHandler ClientAuthorizedHandler ClientAuthorizedHandler ClientScopeHandler ClientScopeHandler RefreshingScopeHandler RefreshingScopeHandler // contains filtered or unexported fields }
func (*Generates) GetAccessToken ¶
func (*Generates) GetAuthorizeToken ¶
type MacRequest ¶
type MacRequest struct {
// contains filtered or unexported fields
}
type Oauth2 ¶
type Oauth2 struct { ClientInfoHandler ClientInfoHandler UserAuthorizationHandler UserAuthorizationHandler PasswordAuthorizationHandler PasswordAuthorizationHandler AuthorizeScopeHandler AuthorizeScopeHandler ValidateClientHandler ValidateClientHandler // contains filtered or unexported fields }
func (*Oauth2) HandleAuthorizeRequest ¶
func (*Oauth2) HandleTokenRequest ¶
func (*Oauth2) SetAccessGenerate ¶
func (o *Oauth2) SetAccessGenerate(accessGenerate generates.AccessGenerate)
func (*Oauth2) SetAuthorizeGenerate ¶
func (o *Oauth2) SetAuthorizeGenerate(authorizeGenerate generates.AuthorizeGenerate)
func (*Oauth2) SetClientAuthorizedHandler ¶
func (o *Oauth2) SetClientAuthorizedHandler(clientAuthorizedHandler ClientAuthorizedHandler)
func (*Oauth2) SetClientScopeHandler ¶
func (o *Oauth2) SetClientScopeHandler(clientScopeHandler ClientScopeHandler)
func (*Oauth2) SetClientStore ¶
func (o *Oauth2) SetClientStore(clientStore *stores.ClientStore)
func (*Oauth2) SetExtensionFieldsHandler ¶
func (o *Oauth2) SetExtensionFieldsHandler(extensionFieldsHandler ExtensionFieldsHandler)
func (*Oauth2) SetRefreshingScopeHandler ¶
func (o *Oauth2) SetRefreshingScopeHandler(refreshingScopeHandler RefreshingScopeHandler)
func (*Oauth2) SetTokenStore ¶
func (o *Oauth2) SetTokenStore(tokenStore *stores.TokenStore)
func (*Oauth2) SetValidateURIHandler ¶
func (o *Oauth2) SetValidateURIHandler(validateURIHandler ValidateURIHandler)
func (*Oauth2) ValidationBearerToken ¶
ValidationBearerToken validation the bearer tokens https://tools.ietf.org/html/rfc6750
type Options ¶
type Options struct { TokenType string AllowGetAccessRequest bool AllowedResponseTypes []api.ResponseType AllowedGrantTypes []api.GrantType MacAlgorithm string // contains filtered or unexported fields }
func (*Options) SetCodeExp ¶
func (*Options) SetRefreshConfig ¶
func (opt *Options) SetRefreshConfig(refreshingConfig *RefreshingConfig)
func (*Options) SetTokenConfig ¶
func (opt *Options) SetTokenConfig(gt api.GrantType, tc *TokenConfig)
type RefreshingConfig ¶
type RefreshingScopeHandler ¶
type Request ¶
type Request struct { Request *http.Request AllowedResponseTypes []api.ResponseType AllowGetAccessRequest bool ClientInfoHandler ClientInfoHandler PasswordAuthorizationHandler PasswordAuthorizationHandler }
func (*Request) BearerAuth ¶
func (*Request) MacAuth ¶
func (re *Request) MacAuth() (*MacRequest, error)
id / ts / nonce / ext / mac
func (*Request) ValidationAuthorizeRequest ¶
func (re *Request) ValidationAuthorizeRequest() (*AuthorizeRequest, error)
func (*Request) ValidationTokenRequest ¶
func (re *Request) ValidationTokenRequest() (*TokenRequest, error)
type Response ¶
type Response struct {
Writer http.ResponseWriter
}
func (*Response) OutputToken ¶
func (*Response) OutputTokenError ¶
type TokenConfig ¶
type TokenRequest ¶
type ValidateClientHandler ¶
type ValidateURIHandler ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.