Documentation ¶
Index ¶
- Variables
- type ByName
- type ByOwner
- type Client
- func (c *Client) DisableScopeAccess(scopes ...string)
- func (c *Client) DisableTenantAccess(tenantIDs ...string)
- func (c *Client) EnableScopeAccess(scopes ...string)
- func (c *Client) EnableTenantAccess(tenantIDs ...string)
- func (c Client) Equal(x Client) bool
- func (c *Client) GetGrantTypes() fosite.Arguments
- func (c *Client) GetHashedSecret() []byte
- func (c *Client) GetID() string
- func (c *Client) GetOwner() string
- func (c *Client) GetRedirectURIs() []string
- func (c *Client) GetResponseTypes() fosite.Arguments
- func (c *Client) GetScopes() fosite.Arguments
- func (c *Client) IsDisabled() bool
- func (c Client) IsEmpty() bool
- func (c *Client) IsPublic() bool
- type Manager
- type MongoManager
- func (m MongoManager) Authenticate(id string, secret []byte) (*Client, error)
- func (m *MongoManager) CreateClient(c *Client) error
- func (m *MongoManager) DeleteClient(id string) error
- func (m MongoManager) GetClient(ctx context.Context, id string) (fosite.Client, error)
- func (m MongoManager) GetClients() (clients map[string]Client, err error)
- func (m MongoManager) GetConcreteClient(id string) (*Client, error)
- func (m *MongoManager) UpdateClient(client *Client) error
- type Storer
Constants ¶
This section is empty.
Variables ¶
var (
ErrClientExists = errors.New("client already exists")
)
Functions ¶
This section is empty.
Types ¶
type ByName ¶ added in v0.7.1
type ByName []Client
ByName enables sorting Client applications by the client application Name A-Z
type ByOwner ¶ added in v0.7.1
type ByOwner []Client
ByOwner enables sorting Client applications by the client application Owner A-Z
type Client ¶
type Client struct { // ID is the id for this client. ID string `bson:"_id" json:"id" xml:"id"` // AllowedTenantAccess contains the Tenant IDs that the client has been given rights to access AllowedTenantAccess []string `bson:"allowedTenantAccess" json:"allowedTenantAccess" xml:"allowedTenantAccess"` // Name is the human-readable string name of the client to be presented to the // end-user during authorization. Name string `bson:"clientName" json:"clientName" xml:"clientName"` // Secret is the client's secret. The secret will be included in the create request as cleartext, and then // never again. The secret is stored using BCrypt so it is impossible to recover it. Tell your users // that they need to write the secret down as it will not be made available again. Secret []byte `bson:"clientSecret,omitempty" json:"clientSecret,omitempty" xml:"clientSecret,omitempty"` // RedirectURIs is an array of allowed redirect urls for the client, for example: // http://mydomain/oauth/callback. RedirectURIs []string `bson:"redirectUris" json:"redirectUris" xml:"redirectUris"` // GrantTypes is an array of grant types the client is allowed to use. // // Pattern: client_credentials|authorize_code|implicit|refresh_token GrantTypes []string `bson:"grantTypes" json:"grantTypes" xml:"grantTypes"` // ResponseTypes is an array of the OAuth 2.0 response type strings that the client can // use at the authorization endpoint. // // Pattern: id_token|code|token ResponseTypes []string `bson:"responseTypes" json:"responseTypes" xml:"responseTypes"` // Scope is a string containing a space-separated list of scope values (as // described in Section 3.3 of OAuth 2.0 [RFC6749]) that the client // can use when requesting access tokens. // // Pattern: ([a-zA-Z0-9\.]+\s)+ Scopes []string `bson:"scopes" json:"scopes" xml:"scopes"` // Owner is a string identifying the owner of the OAuth 2.0 Client. Owner string `bson:"owner" json:"owner" xml:"owner"` // PolicyURI is a URL string that points to a human-readable privacy policy document // that describes how the deployment organization collects, uses, // retains, and discloses personal data. PolicyURI string `bson:"policyUri" json:"policyUri" xml:"policyUri"` // TermsOfServiceURI is a URL string that points to a human-readable terms of service // document for the client that describes a contractual relationship // between the end-user and the client that the end-user accepts when // authorizing the client. TermsOfServiceURI string `bson:"termsOfServiceUri" json:"termsOfServiceUri" xml:"termsOfServiceUri"` // ClientURI is an URL string of a web page providing information about the client. // If present, the server SHOULD display this URL to the end-user in // a clickable fashion. ClientURI string `bson:"clientUri" json:"clientUri" xml:"clientUri"` // LogoURI is an URL string that references a logo for the client. LogoURI string `bson:"logoUri" json:"logoUri" xml:"logoUri"` // Contacts is a array of strings representing ways to contact people responsible // for this client, typically email addresses. Contacts []string `bson:"contacts" json:"contacts" xml:"contacts"` // Public is a boolean that identifies this client as public, meaning that it // does not have a secret. It will disable the client_credentials grant type for this client if set. Public bool `bson:"public" json:"public" xml:"public"` // Disabled is a boolean that identifies whether the client has had it's access disabled. Disabled bool `bson:"disabled" json:"disabled" xml:"disabled"` }
Client provides the underlying structured make up of an OAuth2.0 Client. In order to update mongo records efficiently omitempty is used for all bson casting, with exception to ID, as this should always be provided in queries and updates.
func (*Client) DisableScopeAccess ¶ added in v0.9.0
DisableScopeAccess disables client scope access.
func (*Client) DisableTenantAccess ¶ added in v0.9.0
RemoveTenants removes a single or multiple tenantIDs from the given client
func (*Client) EnableScopeAccess ¶ added in v0.9.0
EnableScopeAccess enables client scope access
func (*Client) EnableTenantAccess ¶ added in v0.9.0
EnableTenantAccess adds a single or multiple tenantIDs to the given client
func (Client) Equal ¶ added in v0.7.4
Equal enables checking equality as having a byte array in a struct stops allowing equality checks.
func (*Client) GetGrantTypes ¶
GetGrantTypes returns an array of strings, wrapped as `fosite.Arguments` to provide functions that allow verifying the Client's Grant Types against incoming requests.
func (*Client) GetHashedSecret ¶
GetHashedSecret returns the Client's Hashed Secret for authenticating with the Identity Provider.
func (*Client) GetOwner ¶
GetOwner returns a string which contains the OAuth Client owner's name.Generally speaking, this will be a developer or an organisation.
func (*Client) GetRedirectURIs ¶
GetRedirectURIs returns the OAuth2.0 authorized Client redirect URIs.
func (*Client) GetResponseTypes ¶
GetResponseTypes returns an array of strings, wrapped as `fosite.Arguments` to provide functions that allow verifying the Client's Response Types against incoming requests.
func (*Client) GetScopes ¶
GetScopes returns an array of strings, wrapped as `fosite.Arguments` to provide functions that allow verifying the Client's scopes against incoming requests.
func (*Client) IsDisabled ¶ added in v0.7.2
Disabled returns a boolean as to whether the Client itself has had it's access disabled.
type MongoManager ¶
MongoManager cares for the managing of the Mongo Session instance of a Client.
func (MongoManager) Authenticate ¶
func (m MongoManager) Authenticate(id string, secret []byte) (*Client, error)
Authenticate compares a client secret with the client's stored hashed secret
func (*MongoManager) CreateClient ¶
func (m *MongoManager) CreateClient(c *Client) error
CreateClient adds a new OAuth2.0 Client to the client store.
func (*MongoManager) DeleteClient ¶
func (m *MongoManager) DeleteClient(id string) error
DeleteClient removes an OAuth 2.0 Client from the client store
func (MongoManager) GetClients ¶
func (m MongoManager) GetClients() (clients map[string]Client, err error)
GetClients returns a map of clients mapped by client ID
func (MongoManager) GetConcreteClient ¶
func (m MongoManager) GetConcreteClient(id string) (*Client, error)
GetConcreteClient finds a Client based on ID and returns it, if found in Mongo.
func (*MongoManager) UpdateClient ¶
func (m *MongoManager) UpdateClient(client *Client) error
UpdateClient updates an OAuth 2.0 Client record. This is done using the equivalent of an object replace.