oauth

package
v0.0.0-...-4946764 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 19, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultHost is the default host for autodesk api
	DefaultHost = "https://developer.api.autodesk.com"
	// DefaultAuthenticationPath is the default AuthPath for autodesk api
	DefaultAuthenticationPath = "authentication/v1"

	HeaderAuthorization = "Authorization"
	HeaderXUserID       = "x-user-id"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthData

type AuthData struct {
	ClientID           string `json:"client_id,omitempty"`
	ClientSecret       string `json:"client_secret,omitempty"`
	Host               string `json:"host,omitempty"`
	AuthenticationPath string `json:"auth_path"`
}

AuthData reflects the data common to 2-legged and 3-legged api calls

func AuthDataForClient

func AuthDataForClient(id, secret string) AuthData

AuthDataForClient will create a new AuthData object with client info

func (AuthData) AuthPath

func (a AuthData) AuthPath(rest ...string) []string

Path will return a host and auth path prepended to rest

func (AuthData) Path

func (a AuthData) Path(rest ...string) string

type Bearer

type Bearer struct {
	TokenType    string `json:"token_type"`              // Will always be Bearer
	ExpiresIn    int32  `json:"expires_in"`              // Access token expiration time (in seconds)
	AccessToken  string `json:"access_token"`            // The access token
	RefreshToken string `json:"refresh_token,omitempty"` // The refresh token used in 3-legged oauth
}

Bearer reflects the response when acquiring a 2-legged token or in 3-legged context for exchanging the authorization code for a token + refresh token and when exchanging the refresh token for a new token

type ForgeAuthenticator

type ForgeAuthenticator interface {

	// Path returns the full url path with the given compentents
	Path(...string) string

	// SetAuthHeader should set the appropriate http headers for auth
	// It should refresh any tokens it may have
	SetAuthHeader(scope scopes.Scope, header http.Header) error
}

ForgeAuthenticator defines an interface that allows abstraction from a 2-legged and a 3-legged context.

This provides useful when an API accepts both 2-legged and 3-legged context tokens

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL