swagger

package
v1.0.0-beta.4 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 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.

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
DefaultApi GetWellKnown Get /.well-known/jwks.json Returns well known keys
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 AuthenticationDefaultSession

type AuthenticationDefaultSession struct {

	// Allowed is true if the request is allowed and false otherwise.
	Allowed bool `json:"allowed,omitempty"`

	// Subject is the identity that authorized issuing the token, for example a user or an OAuth2 app. This is usually a uuid but you can choose a urn or some other id too.
	Subject string `json:"subject,omitempty"`
}

type AuthenticationOAuth2ClientCredentialsRequest

type AuthenticationOAuth2ClientCredentialsRequest struct {

	// Token is the token to introspect.
	Id string `json:"id,omitempty"`

	// Scopes is an array of scopes that are required.
	Scope []string `json:"scope,omitempty"`

	Secret string `json:"secret,omitempty"`
}

type AuthenticationOAuth2ClientCredentialsSession

type AuthenticationOAuth2ClientCredentialsSession struct {

	// Allowed is true if the request is allowed and false otherwise.
	Allowed bool `json:"allowed,omitempty"`

	// Subject is the identity that authorized issuing the token, for example a user or an OAuth2 app. This is usually a uuid but you can choose a urn or some other id too.
	Subject string `json:"subject,omitempty"`
}

type AuthenticationOAuth2IntrospectionRequest

type AuthenticationOAuth2IntrospectionRequest struct {

	// Scopes is an array of scopes that are required.
	Scope []string `json:"scope,omitempty"`

	// Token is the token to introspect.
	Token string `json:"token,omitempty"`
}

type AuthenticationOAuth2Session

type AuthenticationOAuth2Session struct {

	// Allowed is true if the request is allowed and false otherwise.
	Allowed bool `json:"allowed,omitempty"`

	Audience []string `json:"audience,omitempty"`

	// ClientID is the id of the OAuth2 client that requested the token.
	ClientId string `json:"client_id,omitempty"`

	// ExpiresAt is the expiry timestamp.
	ExpiresAt time.Time `json:"expires_at,omitempty"`

	// GrantedScopes is a list of scopes that the subject authorized when asked for consent.
	GrantedScope []string `json:"granted_scope,omitempty"`

	// IssuedAt is the token creation time stamp.
	IssuedAt time.Time `json:"issued_at,omitempty"`

	// Issuer is the id of the issuer, typically an hydra instance.
	Issuer string `json:"issuer,omitempty"`

	NotBefore time.Time `json:"not_before,omitempty"`

	// Session represents arbitrary session data.
	Session map[string]interface{} `json:"session,omitempty"`

	// Subject is the identity that authorized issuing the token, for example a user or an OAuth2 app. This is usually a uuid but you can choose a urn or some other id too.
	Subject string `json:"subject,omitempty"`

	Username string `json:"username,omitempty"`
}

type Authenticator

type Authenticator struct {
}

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 DefaultApi

type DefaultApi struct {
	Configuration *Configuration
}

func NewDefaultApi

func NewDefaultApi() *DefaultApi

func NewDefaultApiWithBasePath

func NewDefaultApiWithBasePath(basePath string) *DefaultApi

func (DefaultApi) GetWellKnown

func (a DefaultApi) GetWellKnown() (*JsonWebKeySet, *APIResponse, error)

*

  • Returns well known keys
  • This endpoint returns public keys for validating the ID tokens issued by ORY Oathkeeper. *
  • @return *JsonWebKeySet

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 IntrospectionResponse

type IntrospectionResponse struct {
	Active bool `json:"active,omitempty"`

	Aud []string `json:"aud,omitempty"`

	ClientId string `json:"client_id,omitempty"`

	Exp int64 `json:"exp,omitempty"`

	// Session represents arbitrary session data.
	Ext map[string]interface{} `json:"ext,omitempty"`

	Iat int64 `json:"iat,omitempty"`

	Iss string `json:"iss,omitempty"`

	Nbf int64 `json:"nbf,omitempty"`

	Scope string `json:"scope,omitempty"`

	// Here, it's sub
	Sub string `json:"sub,omitempty"`

	Username string `json:"username,omitempty"`
}

type JsonRule

type JsonRule struct {
	Description string `json:"description,omitempty"`

	Id string `json:"id,omitempty"`

	MatchesMethods []string `json:"matchesMethods,omitempty"`

	MatchesUrl string `json:"matchesUrl,omitempty"`

	Mode string `json:"mode,omitempty"`

	RequiredAction string `json:"requiredAction,omitempty"`

	RequiredResource string `json:"requiredResource,omitempty"`

	RequiredScopes []string `json:"requiredScopes,omitempty"`

	Upstream Upstream `json:"upstream,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 OAuth2ClientCredentialsAuthentication

type OAuth2ClientCredentialsAuthentication struct {
}

type OAuth2IntrospectionAuthentication

type OAuth2IntrospectionAuthentication struct {
}

type RawMessage

type RawMessage struct {
}

It implements Marshaler and Unmarshaler and can be used to delay JSON decoding or precompute a JSON encoding.

type Rule

type Rule struct {

	// Authenticators is a list of authentication handlers that will try and authenticate the provided credentials. Authenticators are checked iteratively from index 0 to n and if the first authenticator to return a positive result will be the one used.  If you want the rule to first check a specific authenticator  before \"falling back\" to others, have that authenticator as the first item in the array.
	Authenticators []RuleHandler `json:"authenticators,omitempty"`

	Authorizer RuleHandler `json:"authorizer,omitempty"`

	CredentialsIssuer RuleHandler `json:"credentials_issuer,omitempty"`

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

	// 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"`

	Match RuleMatch `json:"match,omitempty"`

	Upstream Upstream `json:"upstream,omitempty"`
}

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(limit int64, offset int64) ([]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. *
  • @param limit The maximum amount of rules returned.
  • @param offset The offset from where to start looking.
  • @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 RuleHandler

type RuleHandler struct {

	// Config contains the configuration for the handler. Please read the user guide for a complete list of each handler's available settings.
	Config json.RawMessage `json:"config,omitempty"`

	// Handler identifies the implementation which will be used to handle this specific request. Please read the user guide for a complete list of available handlers.
	Handler string `json:"handler,omitempty"`
}

type RuleMatch

type RuleMatch struct {

	// 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.
	Methods []string `json:"methods,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
	Url string `json:"url,omitempty"`
}

type Session

type Session struct {
	GetSubject string `json:"GetSubject,omitempty"`
}

type SwaggerCreateRuleParameters

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

type SwaggerGetRuleParameters

type SwaggerGetRuleParameters struct {

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

type SwaggerListRulesParameters

type SwaggerListRulesParameters struct {

	// The maximum amount of rules returned. in: query
	Limit int64 `json:"limit,omitempty"`

	// The offset from where to start looking. in: query
	Offset int64 `json:"offset,omitempty"`
}

type SwaggerRuleHandler

type SwaggerRuleHandler struct {

	// Config contains the configuration for the handler. Please read the user guide for a complete list of each handler's available settings.
	Config json.RawMessage `json:"config,omitempty"`

	// Handler identifies the implementation which will be used to handle this specific request. Please read the user guide for a complete list of available handlers.
	Handler string `json:"handler,omitempty"`
}

type SwaggerRuleMatch

type SwaggerRuleMatch struct {

	// 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.
	Methods []string `json:"methods,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
	Url string `json:"url,omitempty"`
}

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"`
}

type Upstream

type Upstream struct {

	// PreserveHost, if false (the default), tells ORY Oathkeeper to set the upstream request's Host header to the hostname of the API's upstream's URL. Setting this flag to true instructs ORY Oathkeeper not to do so.
	PreserveHost bool `json:"preserve_host,omitempty"`

	// StripPath if set, replaces the provided path prefix when forwarding the requested URL to the upstream URL.
	StripPath string `json:"strip_path,omitempty"`

	// URL is the URL the request will be proxied to.
	Url string `json:"url,omitempty"`
}

Jump to

Keyboard shortcuts

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