Documentation
¶
Index ¶
- Variables
- type AccessItem
- type AccessItems
- type AccessResponse
- type Client
- func (c *Client) AuthUrl(state string, opts ...oauth2.AuthCodeOption) string
- func (c *Client) Authentication(_ context.Context, accessToken string, accessItems []*AccessItem) ([]*AccessItem, error)
- func (c *Client) Exchange(ctx context.Context, code string, opts ...oauth2.AuthCodeOption) (*UserInfo, error)
- func (c *Client) ExpirationSoon(_ context.Context, userInfo *UserInfo, failureInterval float64) bool
- func (c *Client) LogoutUrl(returnUrl string) string
- func (c *Client) PasswordCredentials(ctx context.Context, username, password string) (*UserInfo, error)
- func (c *Client) RefreshToken(ctx context.Context, userInfo *UserInfo) error
- type Config
- type UserInfo
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrorNilAccessItems = errors.New("no access items")
View Source
var ErrorRequestFailed = errors.New("access request failed")
View Source
var FetchUserInfoErr = errors.New("fetch user info error")
Functions ¶
This section is empty.
Types ¶
type AccessItem ¶
type AccessResponse ¶
type AccessResponse struct { Code int64 `json:"code"` Msg string `json:"msg"` Data []*AccessItem `json:"data"` }
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) AuthUrl ¶
func (c *Client) AuthUrl(state string, opts ...oauth2.AuthCodeOption) string
AuthUrl use auth code mode
func (*Client) Authentication ¶
func (c *Client) Authentication(_ context.Context, accessToken string, accessItems []*AccessItem) ([]*AccessItem, error)
Authentication batch authentication
func (*Client) Exchange ¶
func (c *Client) Exchange(ctx context.Context, code string, opts ...oauth2.AuthCodeOption) (*UserInfo, error)
Exchange fetch user info
func (*Client) ExpirationSoon ¶
func (c *Client) ExpirationSoon(_ context.Context, userInfo *UserInfo, failureInterval float64) bool
ExpirationSoon judge how long there is more to ask for token
type Config ¶
type Config struct { Endpoint string `json:"endpoint" form:"endpoint" yaml:"endpoint" toml:"endpoint"` ClientId string `json:"client_id" form:"client_id" yaml:"client_id" toml:"client_id"` ClientSecret string `json:"client_secret" form:"client_secret" yaml:"client_secret" toml:"client_secret"` RedirectUrl string `json:"redirect_url" form:"redirect_url" yaml:"redirect_url" toml:"redirect_url"` Scopes []string `json:"scopes" form:"scopes" yaml:"scopes" toml:"scopes"` }
Click to show internal directories.
Click to hide internal directories.