Documentation
¶
Overview ¶
Package auth provides functionality and types used for authorization providers.
Index ¶
Constants ¶
View Source
const ( // BearerToken represents the bearer token authorization scheme that the // bearer who holds the access token can access authorized resources. // // This is used for the on-premise Oracle NoSQL server that authorizes // requests by itself, and the Oracle NoSQL cloud simulator. BearerToken string = "Bearer" // Signature authorization scheme. // This is used for NoSQL cloud service that uses OCI IAM for request authorization. Signature string = "Signature" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ProviderOptions ¶
type ProviderOptions struct { // Timeout specifies the timeout for requests. // If not set, or set to a value that is less than 1 millisecond, // use the default timeout that depends on the concrete implementation of // authorization provider. Timeout time.Duration // ExpiryWindow specifies a duration of time that determines how far ahead // of access token expiry the provider is allowed to renew the access token. // If not set, or set to a value that is less than 1 millisecond, // use the default expiry window that depends on the concrete implementation // of authorization provider. // If set to a duration that is greater than the access token's lifetime, // the provider does not renew cached tokens. ExpiryWindow time.Duration // Logger specifies a logger for the provider. // If not set, use logger.DefaultLogger by default. Logger *logger.Logger // HTTPClient specifies an HTTP client for the provider. // If not set, use httputil.DefaultHTTPClient by default. HTTPClient *httputil.HTTPClient }
ProviderOptions represents options for an authorization provider.
type Request ¶
type Request interface { // Request-dependent value. // The authorization provider is supposed to be able to interpret the value. Value() string }
Request is an interface that wraps the request dependent value for an authorization request.
type Token ¶
type Token struct { // The access token issued by the authorization server. AccessToken string `json:"access_token"` // Token type. // If not set, this is "Bearer" by default. Type string `json:"token_type,omitempty"` // The duration of time the access token is granted for. // A zero value of ExpiresIn means the access token does not expire. ExpiresIn time.Duration `json:"expires_in,omitempty"` // The time when the access token expires. // A zero value of Expiry means the access token does not expire. Expiry time.Time `json:"expiry,omitempty"` }
Token represents the credentials used to authorize the requests to access protected resources.
func NewToken ¶
NewToken creates a token with the specified access token, token type and expiresIn duration.
func NewTokenWithExpiry ¶
NewTokenWithExpiry creates a token with the specified access token, token type and expiry.
func (Token) AuthString ¶
AuthString returns a string that will be set in the HTTP "Authorization" header.
Directories
¶
Path | Synopsis |
---|---|
Package cloudsim provides authorization provider implementations for clients that connect to cloud simulator.
|
Package cloudsim provides authorization provider implementations for clients that connect to cloud simulator. |
Package iam provides authorization provider implementations for clients that connect to cloud via IAM (Oracle Identity and Access Management).
|
Package iam provides authorization provider implementations for clients that connect to cloud via IAM (Oracle Identity and Access Management). |
Package kvstore provides authorization provider implementations for clients that connect to on-premise NoSQL servers.
|
Package kvstore provides authorization provider implementations for clients that connect to on-premise NoSQL servers. |
Click to show internal directories.
Click to hide internal directories.