Documentation
¶
Overview ¶
Package registration implements the OAuth 2.0 Dynamic Client Registration Protocol.
This should be used when a client needs to dynamically or programmatically register with the authorization server.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientInformationResponse ¶
type ClientInformationResponse struct {
// RegistrationClientURI is the string containing the fully qualified URL of the client configuration endpoint for this client.
RegistrationClientURI string `json:"registration_client_uri"`
// RegistrationAccessToken is the string containing the access token to be used at the client configuration endpoint.
RegistrationAccessToken string `json:"registration_access_token"`
// ClientID is the OAuth 2.0 client identifier string.
ClientID string `json:"client_id"`
// ClientSecret is the OAuth 2.0 client secret string.
ClientSecret string `json:"client_secret,omitempty"`
// ClientIDIssuedAt is the time at which the client identifier was issued.
ClientIDIssuedAt int64 `json:"client_id_issued_at,omitempty"`
// ClientSecretExpiresAt is the time at which the client secret will expire or 0 if it will not expire.
ClientSecretExpiresAt int64 `json:"client_secret_expires_at,omitempty"`
// ClientMetadata contains all of the registered metadata about the client.
ClientMetadata
}
ClientInformationResponse contains the client identifier as well as the client secret, if the client is confidential client.
type ClientMetadata ¶
type ClientMetadata struct {
// RedirectURIs is the array of redirection URIs for use in redirect-based flows such as the authorization code and implicit flows.
RedirectURIs []string `json:"redirect_uris"`
// GrantTypes is the array of OAuth 2.0 grant type strings that the client case use at the token endpoint.
GrantTypes []string `json:"grant_types"`
// ResponseTypes is the array of OAuth 2.0 response type strings that the client use at the authorization endpoint.
ResponseTypes []string `json:"response_types"`
// ClientName is the human-readable string name of the client to be presented to the end-user during authorization.
ClientName string `json:"client_name"`
// Scope is the string containing a space-separated list of scope values that the client can use when requesting access tokens.
Scope string `json:"scope,omitempty"`
}
ClientMetadata is the set of metadata values associated with the client.
type ClientRegistrationErrorResponse ¶
type ClientRegistrationErrorResponse struct {
// ErrorCode is the single ASCII error code string.
ErrorCode string `json:"error"`
// ErrorDescription is the human-readable ASCII test description of the error used for debugging.
ErrorDescription string `json:"error_description,omitempty"`
}
ClientRegistrationErrorResponse is returned when an OAuth 2.0 error condition occurs.
func (*ClientRegistrationErrorResponse) Error ¶
func (e *ClientRegistrationErrorResponse) Error() string
Error returns the string representation of the error response for debugging.
type Config ¶
type Config struct {
// RegistrationURL is the URL of the client registration endpoint
RegistrationURL string
// InitialToken is an optional token used to make registration requests. If not specified, it may be necessary
// to configure the HTTP client to perform the appropriate authorization out of the scope of this configuration.
InitialToken *oauth2.Token
}
Config describes a client registration process, including the initial authorization and the server's endpoint URL.
func (*Config) Register ¶
func (c *Config) Register(ctx context.Context, client *ClientMetadata) (*ClientInformationResponse, error)
Register uses the initial access token to register a client.