Documentation
¶
Index ¶
- Constants
- Variables
- func BasicAuthHeader(userid, password string) (string, error)
- func BasicAuthToken(username, password string) (*oauth2.Token, error)
- func ClientTLSInsecureSkipVerify(client *http.Client) *http.Client
- func NewClientAuthCode(conf oauth2.Config, authCode string) (*http.Client, error)
- func NewClientBasicAuth(username, password string, tlsInsecureSkipVerify bool) (*http.Client, error)
- func NewClientBearerTokenSimple(accessToken string) *http.Client
- func NewClientBearerTokenSimpleOrJson(ctx context.Context, tokenOrJson []byte) (*http.Client, error)
- func NewClientHeaders(headersMap map[string]string, tlsInsecureSkipVerify 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, tlsInsecureSkipVerify bool) *http.Client
- func NewClientTokenBase64Encode(tokenType, tokenValue string, tlsInsecureSkipVerify 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 NewTokenFromWeb(cfg *oauth2.Config) (*oauth2.Token, error)
- func ParseJwtTokenString(tokenString string, secretKey string, claims jwt.Claims) (*jwt.Token, error)
- func ParseToken(rawToken []byte) (*oauth2.Token, error)
- func PathVersion() string
- func RFC7617UserPass(userid, password string) (string, error)
- func ReadTokenFile(fpath string) (*oauth2.Token, error)
- func UserCredentialsDir() (string, error)
- func UserCredentialsDirMk(perm os.FileMode) (string, error)
- func WriteTokenFile(fpath string, tok *oauth2.Token) error
- type AppCredentials
- type AppCredentialsWrapper
- type ApplicationCredentials
- type AuthorizationType
- type OAuth2Util
- type ServiceType
- type TokenStoreFile
- type UserCredentials
Constants ¶
View Source
const ( VERSION = "0.2.0" PATH = "github.com/grokify/oauth2more" BasicPrefix = "Basic" BearerPrefix = "Bearer" )
Variables ¶
View Source
var (
RelCredentialsDir = ".credentials"
)
Functions ¶
func BasicAuthHeader ¶ added in v0.3.0
func BasicAuthToken ¶
BasicAuthToken provides Basic Authentication support via an oauth2.Token.
func ClientTLSInsecureSkipVerify ¶ added in v0.3.0
func NewClientAuthCode ¶
func NewClientBasicAuth ¶ added in v0.3.1
func NewClientBasicAuth(username, password string, tlsInsecureSkipVerify bool) (*http.Client, error)
NewClientBasicAuth returns a *http.Client given a basic auth username and password.
func NewClientBearerTokenSimple ¶ added in v0.3.0
NewClientBearerTokenSimple return a *http.Client given a bearer token string
func NewClientBearerTokenSimpleOrJson ¶ added in v0.3.0
func NewClientHeaders ¶ added in v0.3.1
func NewClientPassword ¶ added in v0.3.0
func NewClientPasswordConf ¶
func NewClientTLSToken ¶
func NewClientToken ¶ added in v0.3.0
func NewClientTokenBase64Encode ¶ added in v0.3.0
func NewClientTokenJSON ¶ added in v0.3.0
func NewClientTokenOAuth2 ¶ added in v0.3.1
func NewClientWebTokenStore ¶
func ParseJwtTokenString ¶ added in v0.3.1
func ParseToken ¶ added in v0.3.1
ParseToken parses a JSON token and returns an `*oauth2.Token` with custom properties.
func PathVersion ¶ added in v0.3.0
func PathVersion() string
func RFC7617UserPass ¶
RFC7617UserPass base64 encodes a user-id and password per: https://tools.ietf.org/html/rfc7617#section-2
func ReadTokenFile ¶
ReadTokenFile retrieves a Token from a given filepath.
func UserCredentialsDir ¶
Types ¶
type AppCredentials ¶
type AppCredentials struct {
Service string `json:"service,omitempty"`
ClientID string `json:"client_id"`
ClientSecret string `json:"client_secret"`
RedirectURIs []string `json:"redirect_uris"`
AuthURI string `json:"auth_uri"`
TokenURI string `json:"token_uri"`
Scopes []string `json:"scopes"`
}
func (*AppCredentials) Config ¶
func (c *AppCredentials) Config() *oauth2.Config
func (*AppCredentials) Defaultify ¶
func (ac *AppCredentials) Defaultify()
type AppCredentialsWrapper ¶
type AppCredentialsWrapper struct {
Web *AppCredentials `json:"web"`
Installed *AppCredentials `json:"installed"`
}
func NewAppCredentialsWrapperFromBytes ¶
func NewAppCredentialsWrapperFromBytes(data []byte) (AppCredentialsWrapper, error)
type ApplicationCredentials ¶
type ApplicationCredentials struct {
ServerURL string
ClientID string
ClientSecret string
Endpoint oauth2.Endpoint
}
ApplicationCredentials represents information for an app.
type AuthorizationType ¶ added in v0.3.0
type AuthorizationType int
const ( Anonymous AuthorizationType = iota Basic Bearer Digest NTLM Negotiate OAuth )
func (AuthorizationType) String ¶ added in v0.3.0
func (a AuthorizationType) String() string
String returns the English name of the authorizationTypes ("Basic", "Bearer", ...).
type OAuth2Util ¶
type ServiceType ¶ added in v0.3.0
type ServiceType int
const ( Google ServiceType = iota Facebook RingCentral Aha )
type TokenStoreFile ¶
func NewTokenStoreFile ¶
func NewTokenStoreFile(file string) *TokenStoreFile
func (*TokenStoreFile) NewTokenFromWeb ¶
func (*TokenStoreFile) Read ¶
func (ts *TokenStoreFile) Read() error
func (*TokenStoreFile) Write ¶
func (ts *TokenStoreFile) Write() error
type UserCredentials ¶
UserCredentials represents a user's credentials.
Directories
¶
| Path | Synopsis |
|---|---|
|
examples/scim_user
command
|
|
|
auth0 contains a Go implementation of Auth0's PKCE support: https://auth0.com/docs/api-auth/tutorials/authorization-code-grant-pkce
|
auth0 contains a Go implementation of Auth0's PKCE support: https://auth0.com/docs/api-auth/tutorials/authorization-code-grant-pkce |
|
examples/auth-code-pkce
command
|
|
|
examples
|
|
|
interface_function
command
|
|
|
jwt
command
|
|
|
examples/get_token
command
|
|
|
examples/query_card
command
|
|
|
examples/get_account
command
|
|
|
examples/get_token
command
|
|
|
examples/glipbot_auth
command
|
|
|
examples/salesforce_versions
command
|
|
|
examples/send_ics
command
This package posts an ICS file to Gmail.
|
This package posts an ICS file to Gmail. |
|
examples/send_one
command
|
|
|
util
|
|
|
examples/get_me
command
|
|
|
examples/jwt_zoom
command
|
Click to show internal directories.
Click to hide internal directories.