Documentation
¶
Overview ¶
Package httpoauth implements the protocol boundary for customer-configured HTTP OAuth apps.
Index ¶
- Variables
- func NewVerifier() (string, error)
- func ValidateDestination(destination, raw string) error
- type Client
- func (c *Client) AuthorizationURL(state, verifier string) (string, error)
- func (c *Client) ClientCredentials(ctx context.Context) (TokenSet, error)
- func (c *Client) Exchange(ctx context.Context, code, verifier, issuer string) (TokenSet, error)
- func (c *Client) Refresh(ctx context.Context, refreshToken string, grantedScopes []string) (TokenSet, error)
- func (c *Client) Revoke(ctx context.Context, token string) error
- type Config
- type TokenSet
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrConfig = xerror.New(xerror.KindInvalidInput, "HTTP_OAUTH_CONFIG_INVALID", "HTTP OAuth configuration is invalid") ErrGrant = xerror.New(xerror.KindInvalidInput, "HTTP_OAUTH_INVALID_GRANT", "HTTP OAuth grant was rejected") ErrProvider = xerror.New(xerror.KindUnavailable, "HTTP_OAUTH_PROVIDER_UNAVAILABLE", "HTTP OAuth provider request failed") )
Functions ¶
func NewVerifier ¶
NewVerifier uses the same cryptographic randomness as OAuth state, meeting RFC 7636's minimum length.
func ValidateDestination ¶
ValidateDestination binds bearer use to the configured origin and base path.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func New ¶
func New(config Config, secret, redirectURI, destination string, allowPrivateHosts bool) (*Client, error)
New applies deployment private-host policy to the pinned transport, with no proxy or redirects.
func (*Client) AuthorizationURL ¶
AuthorizationURL requires a per-install verifier which the credential lifecycle must store encrypted.
func (*Client) ClientCredentials ¶
func (*Client) Exchange ¶
Exchange verifies the callback issuer against the stored app before sending a code.
type Config ¶
type Config struct {
Issuer string `json:"issuer"`
AuthorizationEndpoint string `json:"authorization_endpoint,omitempty"`
TokenEndpoint string `json:"token_endpoint"`
RevocationEndpoint string `json:"revocation_endpoint,omitempty"`
ClientID string `json:"client_id"`
GrantType string `json:"grant_type"`
Scopes []string `json:"scopes,omitempty"`
Audience string `json:"audience,omitempty"`
}
Config contains public app settings; client secrets are supplied separately from encrypted storage.
Click to show internal directories.
Click to hide internal directories.