Versions in this module Expand all Collapse all v0 v0.18.2 Jun 9, 2023 Changes in this version + const GrantTypeAuthorizationCode + const GrantTypeClientCredentials + const GrantTypeJWTBearer + const GrantTypePassword + const GrantTypeRefreshToken + const OAuth2TokenPropAccessToken + const OAuth2TokenPropExpiresIn + const OAuth2TokenPropRefreshToken + const OAuth2TokenPropTokenType + const PATH + const ParamAssertion + const ParamGrantType + const ParamPassword + const ParamRefreshToken + const ParamScope + const ParamUsername + const TestRedirectURL + const TokenBasic + const TokenBearer + const VERSION + var RelCredentialsDir = ".credentials" + func BasicAuthHeader(userid, password string) (string, error) + func BasicAuthToken(username, password string) (*oauth2.Token, error) + func ClientTLSInsecureSkipVerify(client *http.Client) *http.Client + func HandlerFuncWrapBasicAuth(handler http.HandlerFunc, username, password, realm, errmsg string) http.HandlerFunc + func NewClientAuthCode(conf oauth2.Config, authCode string) (*http.Client, error) + func NewClientAuthzTokenSimple(tokenType, accessToken string) *http.Client + func NewClientBasicAuth(username, password string, tlsInsecureSkipVerify bool) (*http.Client, error) + func NewClientBearerTokenSimpleOrJSON(ctx context.Context, tokenOrJSON []byte) (*http.Client, error) + func NewClientHeaderQuery(header http.Header, query url.Values, allowInsecure bool) *http.Client + func NewClientPassword(conf oauth2.Config, ctx context.Context, username, password string) (*http.Client, error) + func NewClientPasswordConf(conf oauth2.Config, username, password string) (*http.Client, error) + func NewClientTLSToken(ctx context.Context, tlsConfig *tls.Config, token *oauth2.Token) *http.Client + func NewClientToken(tokenType, tokenValue string, allowInsecure bool) *http.Client + func NewClientTokenBase64Encode(tokenType, tokenValue string, allowInsecure bool) *http.Client + func NewClientTokenJSON(ctx context.Context, tokenJSON []byte) (*http.Client, error) + func NewClientTokenOAuth2(token *oauth2.Token) *http.Client + func NewClientWebTokenStore(ctx context.Context, conf *oauth2.Config, tStore *TokenStoreFile, ...) (*http.Client, error) + func NewTokenCLIFromWeb(cfg *oauth2.Config, state string) (*oauth2.Token, error) + func NewTokenOAuth2JWT(tokenURL, clientID, clientSecret, jwtBase64Enc string) (*oauth2.Token, error) + func ParseJwtTokenString(tokenString string, secretKey string, claims jwt.Claims) (*jwt.Token, error) + func ParseToken(rawToken []byte) (*oauth2.Token, error) + func ParseTokenReader(r io.Reader) (*oauth2.Token, error) + func PathVersion() string + func RFC7617UserPass(userid, password string) (string, error) + func ReadTokenFile(fpath string) (*oauth2.Token, error) + func TokenClientCredentials(cfg clientcredentials.Config) (*oauth2.Token, error) + func UserCredentialsDir() (string, error) + func UserCredentialsDirMk(perm os.FileMode) (string, error) + func WriteTokenFile(fpath string, tok *oauth2.Token) error + type AppCredentials struct + AuthURI string + ClientID string + ClientSecret string + RedirectURIs []string + Scopes []string + Service string + TokenURI string + func (ac *AppCredentials) Config() *oauth2.Config + func (ac *AppCredentials) Defaultify() + type AppCredentialsWrapper struct + Installed *AppCredentials + Web *AppCredentials + func NewAppCredentialsWrapperFromBytes(data []byte) (AppCredentialsWrapper, error) + func (w *AppCredentialsWrapper) Config() (*oauth2.Config, error) + type AuthorizationType int + const Anonymous + const Basic + const Bearer + const Digest + const NTLM + const Negotiate + const OAuth + func (a AuthorizationType) String() string + type OAuth2Util interface + GetSCIMUser func() (scim.User, error) + SetClient func(*http.Client) + type Scope struct + Description string + Name string + type ServiceType int + const Aha + const Facebook + const Google + const RingCentral + type TokenStoreFile struct + Filepath string + Token *oauth2.Token + func NewTokenStoreFile(file string) *TokenStoreFile + func NewTokenStoreFileDefault(tokenPath string, useDefaultDir bool, perm os.FileMode) (*TokenStoreFile, error) + func (ts *TokenStoreFile) NewTokenCLIFromWeb(cfg *oauth2.Config, state string) (*oauth2.Token, error) + func (ts *TokenStoreFile) Read() error + func (ts *TokenStoreFile) Write() error + type UserCredentials struct + Password string + Username string