stsexchange
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Index¶
Constants¶
This section is empty.
Variables¶
This section is empty.
Functions¶
This section is empty.
Types¶
typeClientAuthentication¶
type ClientAuthentication struct {// AuthStyle can be either basic or request-bodyAuthStyleoauth2.AuthStyleClientIDstringClientSecretstring}ClientAuthentication represents an OAuth client ID and secret and the mechanism for passing these credentials as stated in rfc6749#2.3.1.
func (*ClientAuthentication)InjectAuthentication¶
func (c *ClientAuthentication) InjectAuthentication(valuesurl.Values, headershttp.Header)
InjectAuthentication is used to add authentication to a Secure Token Service exchangerequest. It modifies either the passed url.Values or http.Header depending on the desiredauthentication format.
typeResponse¶
type Response struct {AccessTokenstring `json:"access_token"`IssuedTokenTypestring `json:"issued_token_type"`TokenTypestring `json:"token_type"`ExpiresInint `json:"expires_in"`Scopestring `json:"scope"`RefreshTokenstring `json:"refresh_token"`}Response is used to decode the remote server response during an oauth2 token exchange.
funcExchangeToken¶
func ExchangeToken(ctxcontext.Context, endpointstring, request *TokenExchangeRequest, authenticationClientAuthentication, headershttp.Header, options map[string]any) (*Response,error)
ExchangeToken performs an oauth2 token exchange with the provided endpoint.The first 4 fields are all mandatory. headers can be used to pass additionalheaders beyond the bare minimum required by the token exchange. options canbe used to pass additional JSON-structured options to the remote server.
typeTokenExchangeRequest¶
type TokenExchangeRequest struct {ActingParty struct {ActorTokenstringActorTokenTypestring}GrantTypestringResourcestringAudiencestringScope []stringRequestedTokenTypestringSubjectTokenstringSubjectTokenTypestring}TokenExchangeRequest contains fields necessary to make an oauth2 token exchange.