Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var PolicyMap = map[string]policyInfo{ "developer": { // contains filtered or unexported fields }, "basic": { // contains filtered or unexported fields }, "standard": { // contains filtered or unexported fields }, "enterprise": { // contains filtered or unexported fields }, }
Policy map generated from API Guard service Must be kept in sync with the API Guard service
Functions ¶
func EmailFromTokenHeaderName ¶
func EmailFromTokenHeaderName() string
func GetBasicPolicyInfo ¶
func GetBasicPolicyInfo() (policyInfo, error)
This probably needs a revamp when we look at subscription based policy mapping
Types ¶
type Context ¶
type Context struct { // Remote client address RemoteAddr string // Request ID generated by the API Guard or passed by client RequestID string // Path as seen by the API Guard. This is important // to avoid parser differential vulnerabilities Path string // Secret shared between API Guard and Server. This enables // API servers to verify that the request is actually coming from API Guard // and not spoofed. TrustToken string // Meta Data stored in the API Key by client applications Key KeyInfo // Token info, available when JWT token is used Token TokenInfo }
Context represent the information passed by the API guard to the API handler (down stream servers).
type KeyInfo ¶
type KeyInfo struct { OrganizationID string `json:"org_id"` TeamID string `json:"team_id"` UserID string `json:"user_id"` KeyID string `json:"key_id"` }
These are metadata associated with the API key at the time of creation. This is useful to set application specific information that can be passed across the API Guard to the API server.
type ManagementClient ¶
type ManagementClient interface { // Create a key in the API Guard. We will also generate a custom key and // not depend on API Guard's key generation. CreateKey(context.Context, KeyArgs) (ApiKey, error) // Create a key with a custom supplied key string CreateCustomKey(context.Context, string, KeyArgs) (ApiKey, error) // Get a key by Key Hash. The actual API key is NOT included in the response GetKey(context.Context, string) (ApiKey, error) // List policies in the API Guard ListPolicies(context.Context) ([]Policy, error) // Delete an API key by key hash DeleteKey(context.Context, string) error }
Contract for a management client
func NewManagementClient ¶
func NewManagementClient(baseUrl, token string, opts ...ManagementClientOpts) (ManagementClient, error)
NewManagementClient creates a new management client for the API Guard.
func NewManagementClientFromEnvConfig ¶
func NewManagementClientFromEnvConfig() (ManagementClient, error)
Helper to standardize the creation of a management client from environment based configuration
type ManagementClientOpts ¶
type ManagementClientOpts func(*managementClient)
func WithHTTPClient ¶
func WithHTTPClient(httpClient http.Client) ManagementClientOpts
func WithKeyGen ¶
func WithKeyGen(keyGen KeyGen) ManagementClientOpts
type PolicyAccess ¶
Click to show internal directories.
Click to hide internal directories.