Skip to content

Commit

Permalink
docs: update to latest go-swagger compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
arekkas authored Jun 14, 2017
1 parent edab1eb commit fa46dbd
Show file tree
Hide file tree
Showing 5 changed files with 118 additions and 15 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ cover.out
output/
_book/
dist/
coverage.*
coverage.*
docs/api.swagger.json
2 changes: 1 addition & 1 deletion doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
// - application/json
//
// SecurityDefinitions:
// - oauth2:
// oauth2:
// type: oauth2
// authorizationUrl: /oauth2/auth
// tokenUrl: /oauth2/token
Expand Down
104 changes: 92 additions & 12 deletions docs/api.swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1696,7 +1696,7 @@ paths:
- name: Body
in: body
schema:
$ref: '#/definitions/wardenAccessRequest'
$ref: '#/definitions/wardenTokenAllowedBody'
responses:
'200':
$ref: '#/responses/wardenTokenAllowedResponse'
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -2803,15 +2883,15 @@ securityDefinitions:
authorizationUrl: /oauth2/auth
tokenUrl: /oauth2/token
scopes:
hydra.clients: "A scope required to manage OAuth 2.0 Clients"
hydra.policies: "A scope required to manage access control policies"
hydra.groups: "A scope required to manage warden groups"
hydra.warden: "A scope required to make access control inquiries"
hydra.keys.get: "A scope required to fetch JSON Web Keys"
hydra.keys.create: "A scope required to create JSON Web Keys"
hydra.keys.delete: "A scope required to delete JSON Web Keys"
hydra.keys.update: "A scope required to get JSON Web Keys"
offline: "A scope required when requesting refresh tokens"
openid: "Request an OpenID Connect ID Token"
hydra.clients: A scope required to manage OAuth 2.0 Clients
hydra.groups: A scope required to manage warden groups
hydra.keys.create: A scope required to create JSON Web Keys
hydra.keys.delete: A scope required to delete JSON Web Keys
hydra.keys.get: A scope required to fetch JSON Web Keys
hydra.keys.update: A scope required to get JSON Web Keys
hydra.policies: A scope required to manage access control policies
hydra.warden: A scope required to make access control inquiries
offline: A scope required when requesting refresh tokens
openid: Request an OpenID Connect ID Token
x-forwarded-proto: string
x-request-id: string
21 changes: 20 additions & 1 deletion warden/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions warden/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}

Expand Down

0 comments on commit fa46dbd

Please sign in to comment.