swagger

package
v0.11.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 7, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

README

Go API client for swagger

ORY Oathkeeper is a reverse proxy that checks the HTTP Authorization for validity against a set of rules. This service uses Hydra to validate access tokens and policies. Oathkeeper

Overview

This API client was generated by the swagger-codegen project. By using the swagger-spec from a remote server, you can easily generate an API client.

  • API version: Latest
  • Package version: 1.0.0
  • Build package: io.swagger.codegen.languages.GoClientCodegen For more information, please visit https://www.ory.am

Installation

Put the package under your project folder and add the following in import:

    "./swagger"

Documentation for API Endpoints

All URIs are relative to http://localhost

Class Method HTTP request Description
RuleApi CreateRule Post /rules Create a rule
RuleApi DeleteRule Delete /rules/{id} Delete a rule
RuleApi GetRule Get /rules/{id} Retrieve a rule
RuleApi ListRules Get /rules List all rules
RuleApi UpdateRule Put /rules/{id} Update a rule

Documentation For Models

Documentation For Authorization

All endpoints do not require authorization.

Author

hi@ory.am

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIClient

type APIClient struct {
	// contains filtered or unexported fields
}

func (*APIClient) CallAPI

func (c *APIClient) CallAPI(path string, method string,
	postBody interface{},
	headerParams map[string]string,
	queryParams url.Values,
	formParams map[string]string,
	fileName string,
	fileBytes []byte) (*resty.Response, error)

func (*APIClient) ParameterToString

func (c *APIClient) ParameterToString(obj interface{}, collectionFormat string) string

func (*APIClient) SelectHeaderAccept

func (c *APIClient) SelectHeaderAccept(accepts []string) string

func (*APIClient) SelectHeaderContentType

func (c *APIClient) SelectHeaderContentType(contentTypes []string) string

type APIResponse

type APIResponse struct {
	*http.Response `json:"-"`
	Message        string `json:"message,omitempty"`
	// Operation is the name of the swagger operation.
	Operation string `json:"operation,omitempty"`
	// RequestURL is the request URL. This value is always available, even if the
	// embedded *http.Response is nil.
	RequestURL string `json:"url,omitempty"`
	// Method is the HTTP method used for the request.  This value is always
	// available, even if the embedded *http.Response is nil.
	Method string `json:"method,omitempty"`
	// Payload holds the contents of the response body (which may be nil or empty).
	// This is provided here as the raw response.Body() reader will have already
	// been drained.
	Payload []byte `json:"-"`
}

func NewAPIResponse

func NewAPIResponse(r *http.Response) *APIResponse

func NewAPIResponseWithError

func NewAPIResponseWithError(errorMessage string) *APIResponse

type Configuration

type Configuration struct {
	Username      string            `json:"userName,omitempty"`
	Password      string            `json:"password,omitempty"`
	APIKeyPrefix  map[string]string `json:"APIKeyPrefix,omitempty"`
	APIKey        map[string]string `json:"APIKey,omitempty"`
	Debug         bool              `json:"debug,omitempty"`
	DebugFile     string            `json:"debugFile,omitempty"`
	OAuthToken    string            `json:"oAuthToken,omitempty"`
	BasePath      string            `json:"basePath,omitempty"`
	Host          string            `json:"host,omitempty"`
	Scheme        string            `json:"scheme,omitempty"`
	AccessToken   string            `json:"accessToken,omitempty"`
	DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
	UserAgent     string            `json:"userAgent,omitempty"`
	APIClient     *APIClient
	Transport     *http.Transport
	Timeout       *time.Duration `json:"timeout,omitempty"`
}

func NewConfiguration

func NewConfiguration() *Configuration

func (*Configuration) AddDefaultHeader

func (c *Configuration) AddDefaultHeader(key string, value string)

func (*Configuration) GetAPIKeyWithPrefix

func (c *Configuration) GetAPIKeyWithPrefix(APIKeyIdentifier string) string

func (*Configuration) GetBasicAuthEncodedString

func (c *Configuration) GetBasicAuthEncodedString() string

type InlineResponse401

type InlineResponse401 struct {
	Code int64 `json:"code,omitempty"`

	Details []map[string]interface{} `json:"details,omitempty"`

	Message string `json:"message,omitempty"`

	Reason string `json:"reason,omitempty"`

	Request string `json:"request,omitempty"`

	Status string `json:"status,omitempty"`
}

type JsonWebKey

type JsonWebKey struct {

	// The \"alg\" (algorithm) parameter identifies the algorithm intended for use with the key.  The values used should either be registered in the IANA \"JSON Web Signature and Encryption Algorithms\" registry established by [JWA] or be a value that contains a Collision- Resistant Name.
	Alg string `json:"alg,omitempty"`

	Crv string `json:"crv,omitempty"`

	D string `json:"d,omitempty"`

	Dp string `json:"dp,omitempty"`

	Dq string `json:"dq,omitempty"`

	E string `json:"e,omitempty"`

	K string `json:"k,omitempty"`

	// The \"kid\" (key ID) parameter is used to match a specific key.  This is used, for instance, to choose among a set of keys within a JWK Set during key rollover.  The structure of the \"kid\" value is unspecified.  When \"kid\" values are used within a JWK Set, different keys within the JWK Set SHOULD use distinct \"kid\" values.  (One example in which different keys might use the same \"kid\" value is if they have different \"kty\" (key type) values but are considered to be equivalent alternatives by the application using them.)  The \"kid\" value is a case-sensitive string.
	Kid string `json:"kid,omitempty"`

	// The \"kty\" (key type) parameter identifies the cryptographic algorithm family used with the key, such as \"RSA\" or \"EC\". \"kty\" values should either be registered in the IANA \"JSON Web Key Types\" registry established by [JWA] or be a value that contains a Collision- Resistant Name.  The \"kty\" value is a case-sensitive string.
	Kty string `json:"kty,omitempty"`

	N string `json:"n,omitempty"`

	P string `json:"p,omitempty"`

	Q string `json:"q,omitempty"`

	Qi string `json:"qi,omitempty"`

	// The \"use\" (public key use) parameter identifies the intended use of the public key. The \"use\" parameter is employed to indicate whether a public key is used for encrypting data or verifying the signature on data. Values are commonly \"sig\" (signature) or \"enc\" (encryption).
	Use string `json:"use,omitempty"`

	X string `json:"x,omitempty"`

	// The \"x5c\" (X.509 certificate chain) parameter contains a chain of one or more PKIX certificates [RFC5280].  The certificate chain is represented as a JSON array of certificate value strings.  Each string in the array is a base64-encoded (Section 4 of [RFC4648] -- not base64url-encoded) DER [ITU.X690.1994] PKIX certificate value. The PKIX certificate containing the key value MUST be the first certificate.
	X5c []string `json:"x5c,omitempty"`

	Y string `json:"y,omitempty"`
}

type JsonWebKeySet

type JsonWebKeySet struct {

	// The value of the \"keys\" parameter is an array of JWK values.  By default, the order of the JWK values within the array does not imply an order of preference among them, although applications of JWK Sets can choose to assign a meaning to the order for their purposes, if desired.
	Keys []JsonWebKey `json:"keys,omitempty"`
}

type Rule

type Rule struct {

	// A human readable description of this rule.
	Description string `json:"description,omitempty"`

	// The ID is the unique id of the rule. It can be at most 190 characters long, but the layout of the ID is up to you. You will need this ID later on to update or delete the rule.
	Id string `json:"id,omitempty"`

	// An array of HTTP methods (e.g. GET, POST, PUT, DELETE, ...). When ORY Oathkeeper searches for rules to decide what to do with an incoming request to the proxy server, it compares the HTTP method of the incoming request with the HTTP methods of each rules. If a match is found, the rule is considered a partial match. If the matchesUrl field is satisfied as well, the rule is considered a full match.
	MatchesMethods []string `json:"matchesMethods,omitempty"`

	// This field represents the URL pattern this rule matches. When ORY Oathkeeper searches for rules to decide what to do with an incoming request to the proxy server, it compares the full request URL (e.g. https://mydomain.com/api/resource) without query parameters of the incoming request with this field. If a match is found, the rule is considered a partial match. If the matchesMethods field is satisfied as well, the rule is considered a full match.  You can use regular expressions in this field to match more than one url. Regular expressions are encapsulated in brackets < and >. The following example matches all paths of the domain `mydomain.com`: `https://mydomain.com/<.*>`.  For more information refer to: https://ory.gitbooks.io/oathkeeper/content/concepts.html#rules
	MatchesUrl string `json:"matchesUrl,omitempty"`

	// Defines which mode this rule should use. There are four valid modes:  bypass: If set, any authorization logic is completely disabled and the Authorization header is not changed at all. This is useful if you have an endpoint that has it's own authorization logic, for example using basic authorization. If set to true, this setting overrides `basicAuthorizationModeEnabled` and `allowAnonymousModeEnabled`. anonymous: If set, the protected endpoint is available to anonymous users. That means that the endpoint is accessible without having a valid access token. This setting overrides `basicAuthorizationModeEnabled`. token: If set, disables checks against ORY Hydra's Warden API and uses basic authorization. This means that the access token is validated (e.g. checking if it is expired, check if it claimed the necessary scopes) but does not use the `requiredAction` and `requiredResource` fields for advanced access control. policy: If set, uses ORY Hydra's Warden API for access control using access control policies.
	Mode string `json:"mode,omitempty"`

	// This field will be used to decide advanced authorization requests where access control policies are used. A action is typically something a user wants to do (e.g. write, read, delete). This field supports expansion as described in the developer guide: https://ory.gitbooks.io/oathkeeper/content/concepts.html#rules
	RequiredAction string `json:"requiredAction,omitempty"`

	// This field will be used to decide advanced authorization requests where access control policies are used. A resource is typically something a user wants to access (e.g. printer, article, virtual machine). This field supports expansion as described in the developer guide: https://ory.gitbooks.io/oathkeeper/content/concepts.html#rules
	RequiredResource string `json:"requiredResource,omitempty"`

	// An array of OAuth 2.0 scopes that are required when accessing an endpoint protected by this rule. If the token used in the Authorization header did not request that specific scope, the request is denied.
	RequiredScopes []string `json:"requiredScopes,omitempty"`
}

A rule

type RuleApi

type RuleApi struct {
	Configuration *Configuration
}

func NewRuleApi

func NewRuleApi() *RuleApi

func NewRuleApiWithBasePath

func NewRuleApiWithBasePath(basePath string) *RuleApi

func (RuleApi) CreateRule

func (a RuleApi) CreateRule(body Rule) (*Rule, *APIResponse, error)

*

  • Create a rule
  • This method allows creation of rules. If a rule id exists, you will receive an error. *
  • @param body
  • @return *Rule

func (RuleApi) DeleteRule

func (a RuleApi) DeleteRule(id string) (*APIResponse, error)

*

  • Delete a rule
  • Use this endpoint to delete a rule. *
  • @param id
  • @return void

func (RuleApi) GetRule

func (a RuleApi) GetRule(id string) (*Rule, *APIResponse, error)

*

  • Retrieve a rule
  • Use this method to retrieve a rule from the storage. If it does not exist you will receive a 404 error. *
  • @param id
  • @return *Rule

func (RuleApi) ListRules

func (a RuleApi) ListRules() ([]Rule, *APIResponse, error)

*

  • List all rules
  • This method returns an array of all rules that are stored in the backend. This is useful if you want to get a full view of what rules you have currently in place. *
  • @return []Rule

func (RuleApi) UpdateRule

func (a RuleApi) UpdateRule(id string, body Rule) (*Rule, *APIResponse, error)

*

  • Update a rule
  • Use this method to update a rule. Keep in mind that you need to send the full rule payload as this endpoint does not support patching. *
  • @param id
  • @param body
  • @return *Rule

type SwaggerCreateRuleParameters

type SwaggerCreateRuleParameters struct {
	Body Rule `json:"Body,omitempty"`
}

type SwaggerGetRuleParameters

type SwaggerGetRuleParameters struct {

	// in: path
	Id string `json:"id"`
}

type SwaggerRuleResponse

type SwaggerRuleResponse struct {
	Body Rule `json:"Body,omitempty"`
}

A rule

type SwaggerRulesResponse

type SwaggerRulesResponse struct {

	// in: body type: array
	Body []Rule `json:"Body,omitempty"`
}

A list of rules

type SwaggerUpdateRuleParameters

type SwaggerUpdateRuleParameters struct {
	Body Rule `json:"Body,omitempty"`

	// in: path
	Id string `json:"id"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL