From d227340be02026b18c72725b8ea8b2c7ff1d2f6a Mon Sep 17 00:00:00 2001 From: aeneasr Date: Wed, 14 Jun 2017 12:45:37 +0200 Subject: [PATCH] docs: update to latest go-swagger compatibility --- .gitignore | 3 +- docs/api.swagger.yaml | 84 +++++++++++++++++++++++++++++++++++++++++-- warden/doc.go | 21 ++++++++++- warden/handler.go | 3 ++ 4 files changed, 107 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 08e747c17c..fb59fb937d 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,5 @@ cover.out output/ _book/ dist/ -coverage.* \ No newline at end of file +coverage.* +docs/api.swagger.json \ No newline at end of file diff --git a/docs/api.swagger.yaml b/docs/api.swagger.yaml index 21ec040fa7..eb83213e2b 100644 --- a/docs/api.swagger.yaml +++ b/docs/api.swagger.yaml @@ -1696,7 +1696,7 @@ paths: - name: Body in: body schema: - $ref: '#/definitions/wardenAccessRequest' + $ref: '#/definitions/wardenTokenAllowedBody' responses: '200': $ref: '#/responses/wardenTokenAllowedResponse' @@ -2541,6 +2541,83 @@ definitions: format: int64 x-go-name: ID x-go-package: github.com/ory/hydra/policy + swaggerWardenAllowedParameters: + type: object + properties: + Body: + $ref: '#/definitions/allowedRequest' + x-go-package: github.com/ory/hydra/warden + swaggerWardenAllowedResponse: + description: The allowed response + type: object + properties: + Body: + description: 'in: body' + type: object + properties: + allowed: + description: Allowed is true if the request is allowed or false otherwise + type: boolean + x-go-name: Allowed + x-go-package: github.com/ory/hydra/warden + swaggerWardenTokenAllowedParameters: + type: object + properties: + Body: + $ref: '#/definitions/wardenTokenAllowedBody' + x-go-package: github.com/ory/hydra/warden + swaggerWardenTokenAllowedResponse: + description: The token allowed response + type: object + properties: + Body: + description: 'in: body' + type: object + properties: + allowed: + description: Allowed is true if the request is allowed or false otherwise + type: boolean + x-go-name: Allowed + aud: + description: >- + Audience is who the token was issued for. This is an OAuth2 app + usually. + type: string + x-go-name: Audience + exp: + description: ExpiresAt is the expiry timestamp. + x-go-name: ExpiresAt + ext: + description: Extra represents arbitrary session data. + type: object + additionalProperties: + type: object + x-go-name: Extra + iat: + description: IssuedAt is the token creation time stamp. + x-go-name: IssuedAt + iss: + description: 'Issuer is the id of the issuer, typically an hydra instance.' + type: string + x-go-name: Issuer + scopes: + description: >- + GrantedScopes is a list of scopes that the subject authorized when + asked for consent. + type: array + items: + type: string + x-go-name: GrantedScopes + sub: + description: >- + 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. + type: string + x-go-name: Subject + x-go-package: github.com/ory/hydra/warden tokenAllowedRequest: type: object properties: @@ -2560,7 +2637,7 @@ definitions: x-go-name: Resource x-go-name: TokenAccessRequest x-go-package: github.com/ory/hydra/firewall - wardenAccessRequest: + wardenTokenAllowedBody: type: object properties: action: @@ -2578,13 +2655,16 @@ definitions: type: string x-go-name: Resource scopes: + description: Scopes is an array of scopes that are requried. type: array items: type: string x-go-name: Scopes token: + description: Token is the token to introspect. type: string x-go-name: Token + x-go-name: swaggerWardenTokenAllowedBody x-go-package: github.com/ory/hydra/warden responses: clientsList: diff --git a/warden/doc.go b/warden/doc.go index 3c5fa5dbcc..f532557bea 100644 --- a/warden/doc.go +++ b/warden/doc.go @@ -35,10 +35,29 @@ type swaggerWardenAllowedParameters struct { Body firewall.AccessRequest } + +// swagger:model wardenTokenAllowedBody +type swaggerWardenTokenAllowedBody struct { + // Scopes is an array of scopes that are requried. + Scopes []string `json:"scopes"` + + // Token is the token to introspect. + Token string `json:"token"` + + // Resource is the resource that access is requested to. + Resource string `json:"resource"` + + // Action is the action that is requested on the resource. + Action string `json:"action"` + + // Context is the request's environmental context. + Context map[string]interface{} `json:"context"` +} + // swagger:parameters wardenTokenAllowed type swaggerWardenTokenAllowedParameters struct { // in: body - Body wardenAccessRequest + Body swaggerWardenTokenAllowedBody } // The token allowed response diff --git a/warden/handler.go b/warden/handler.go index 889834b796..f5a927f5fa 100644 --- a/warden/handler.go +++ b/warden/handler.go @@ -21,7 +21,10 @@ const ( ) type wardenAuthorizedRequest struct { + // Scopes is an array of scopes that are requried. Scopes []string `json:"scopes"` + + // Token is the token to introspect. Token string `json:"token"` }