Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
ErrClientNotFound = errors.New("client not found")
)
Functions ¶
This section is empty.
Types ¶
type ClientMetadata ¶
type ClientMetadata struct {
ID string
Name string
URI string
RedirectURIs []string
GrantTypes []string
ResponseTypes []string
Scope string
LogoURI string
Contacts []string
TermsOfServiceURI string
PolicyURI string
JSONWebKeysURI string
JSONWebKeys map[string]interface{}
SoftwareID string
SoftwareVersion string
TokenEndpointAuthMethod string
}
ClientMetadata contains the metadata for an OAuth2 client.
type Config ¶
type Config struct {
Store store
ProfileService profileService
}
Config defines configuration for client manager.
type ErrorCode ¶
type ErrorCode string
ErrorCode is an error code for client registration error response as defined in https://datatracker.ietf.org/doc/html/rfc7591#section-3.2.2.
const ( // ErrCodeInvalidRedirectURI defines error case when the value of one or more redirection URIs is invalid. ErrCodeInvalidRedirectURI ErrorCode = "invalid_redirect_uri" // ErrCodeInvalidClientMetadata defines error case when the value of one of the client metadata fields is invalid // and the server has rejected this request. ErrCodeInvalidClientMetadata ErrorCode = "invalid_client_metadata" // ErrCodeInvalidSoftwareStatement defines error case when the software statement presented is invalid. ErrCodeInvalidSoftwareStatement ErrorCode = "invalid_software_statement" // ErrCodeUnapprovedSoftwareStatement defines error case when the software statement presented is not approved for // use by the server. ErrCodeUnapprovedSoftwareStatement ErrorCode = "unapproved_software_statement" )
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager implements functionality to manage OAuth2 clients.
func (*Manager) Create ¶
func (m *Manager) Create(ctx context.Context, profileID, profileVersion string, data *ClientMetadata) (*oauth2client.Client, error)
Create creates an OAuth2 client and inserts it into the store.
type RegistrationError ¶
type RegistrationError struct {
Code ErrorCode `json:"error"`
InvalidValue string `json:"invalid_value,omitempty"`
Err error `json:"-"` // wrapped error
}
RegistrationError defines a registration error in client registration response. When a registration error occurs, the server returns an HTTP 400 status code.
func InvalidClientMetadataError ¶
func InvalidClientMetadataError(invalidValue string, err error) *RegistrationError
InvalidClientMetadataError creates a new RegistrationError with ErrCodeInvalidClientMetadata error code.
func (*RegistrationError) Error ¶
func (r *RegistrationError) Error() string
Error returns a string representation of the error.
type ServiceInterface ¶
type ServiceInterface interface {
Create(ctx context.Context, profileID, profileVersion string, data *ClientMetadata) (*oauth2client.Client, error)
Get(ctx context.Context, id string) (fosite.Client, error)
}
ServiceInterface defines an interface for OAuth2 client manager.