From cf3c80722c8bf5a84ff975fc406031381d03e3ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Vu=C4=8Dica?= Date: Sun, 11 Feb 2018 18:58:08 +0000 Subject: [PATCH 1/3] swagger: Add `securityDefinitions` and `security` fields to Swagger options proto file. --- protoc-gen-swagger/options/openapiv2.pb.go | 527 +++++++++++++++++---- protoc-gen-swagger/options/openapiv2.proto | 129 ++++- 2 files changed, 566 insertions(+), 90 deletions(-) diff --git a/protoc-gen-swagger/options/openapiv2.pb.go b/protoc-gen-swagger/options/openapiv2.pb.go index 7564c52e500..1b639f78d56 100644 --- a/protoc-gen-swagger/options/openapiv2.pb.go +++ b/protoc-gen-swagger/options/openapiv2.pb.go @@ -17,6 +17,10 @@ It has these top-level messages: Schema JSONSchema Tag + SecurityDefinitions + SecurityScheme + SecurityRequirement + Scopes */ package options @@ -107,20 +111,108 @@ func (JSONSchema_JSONSchemaSimpleTypes) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{6, 0} } +// Required. The type of the security scheme. Valid values are "basic", +// "apiKey" or "oauth2". +type SecurityScheme_Type int32 + +const ( + SecurityScheme_TYPE_INVALID SecurityScheme_Type = 0 + SecurityScheme_TYPE_BASIC SecurityScheme_Type = 1 + SecurityScheme_TYPE_API_KEY SecurityScheme_Type = 2 + SecurityScheme_TYPE_OAUTH2 SecurityScheme_Type = 3 +) + +var SecurityScheme_Type_name = map[int32]string{ + 0: "TYPE_INVALID", + 1: "TYPE_BASIC", + 2: "TYPE_API_KEY", + 3: "TYPE_OAUTH2", +} +var SecurityScheme_Type_value = map[string]int32{ + "TYPE_INVALID": 0, + "TYPE_BASIC": 1, + "TYPE_API_KEY": 2, + "TYPE_OAUTH2": 3, +} + +func (x SecurityScheme_Type) String() string { + return proto.EnumName(SecurityScheme_Type_name, int32(x)) +} +func (SecurityScheme_Type) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{9, 0} } + +// Required. The location of the API key. Valid values are "query" or "header". +type SecurityScheme_In int32 + +const ( + SecurityScheme_IN_INVALID SecurityScheme_In = 0 + SecurityScheme_IN_QUERY SecurityScheme_In = 1 + SecurityScheme_IN_HEADER SecurityScheme_In = 2 +) + +var SecurityScheme_In_name = map[int32]string{ + 0: "IN_INVALID", + 1: "IN_QUERY", + 2: "IN_HEADER", +} +var SecurityScheme_In_value = map[string]int32{ + "IN_INVALID": 0, + "IN_QUERY": 1, + "IN_HEADER": 2, +} + +func (x SecurityScheme_In) String() string { + return proto.EnumName(SecurityScheme_In_name, int32(x)) +} +func (SecurityScheme_In) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{9, 1} } + +// Required. The flow used by the OAuth2 security scheme. Valid values are +// "implicit", "password", "application" or "accessCode". +type SecurityScheme_Flow int32 + +const ( + SecurityScheme_FLOW_INVALID SecurityScheme_Flow = 0 + SecurityScheme_FLOW_IMPLICIT SecurityScheme_Flow = 1 + SecurityScheme_FLOW_PASSWORD SecurityScheme_Flow = 2 + SecurityScheme_FLOW_APPLICATION SecurityScheme_Flow = 3 + SecurityScheme_FLOW_ACCESS_CODE SecurityScheme_Flow = 4 +) + +var SecurityScheme_Flow_name = map[int32]string{ + 0: "FLOW_INVALID", + 1: "FLOW_IMPLICIT", + 2: "FLOW_PASSWORD", + 3: "FLOW_APPLICATION", + 4: "FLOW_ACCESS_CODE", +} +var SecurityScheme_Flow_value = map[string]int32{ + "FLOW_INVALID": 0, + "FLOW_IMPLICIT": 1, + "FLOW_PASSWORD": 2, + "FLOW_APPLICATION": 3, + "FLOW_ACCESS_CODE": 4, +} + +func (x SecurityScheme_Flow) String() string { + return proto.EnumName(SecurityScheme_Flow_name, int32(x)) +} +func (SecurityScheme_Flow) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{9, 2} } + // `Swagger` is a representation of OpenAPI v2 specification's Swagger object. // // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#swaggerObject // // TODO(ivucica): document fields type Swagger struct { - Swagger string `protobuf:"bytes,1,opt,name=swagger" json:"swagger,omitempty"` - Info *Info `protobuf:"bytes,2,opt,name=info" json:"info,omitempty"` - Host string `protobuf:"bytes,3,opt,name=host" json:"host,omitempty"` - BasePath string `protobuf:"bytes,4,opt,name=base_path,json=basePath" json:"base_path,omitempty"` - Schemes []Swagger_SwaggerScheme `protobuf:"varint,5,rep,packed,name=schemes,enum=grpc.gateway.protoc_gen_swagger.options.Swagger_SwaggerScheme" json:"schemes,omitempty"` - Consumes []string `protobuf:"bytes,6,rep,name=consumes" json:"consumes,omitempty"` - Produces []string `protobuf:"bytes,7,rep,name=produces" json:"produces,omitempty"` - ExternalDocs *ExternalDocumentation `protobuf:"bytes,14,opt,name=external_docs,json=externalDocs" json:"external_docs,omitempty"` + Swagger string `protobuf:"bytes,1,opt,name=swagger" json:"swagger,omitempty"` + Info *Info `protobuf:"bytes,2,opt,name=info" json:"info,omitempty"` + Host string `protobuf:"bytes,3,opt,name=host" json:"host,omitempty"` + BasePath string `protobuf:"bytes,4,opt,name=base_path,json=basePath" json:"base_path,omitempty"` + Schemes []Swagger_SwaggerScheme `protobuf:"varint,5,rep,packed,name=schemes,enum=grpc.gateway.protoc_gen_swagger.options.Swagger_SwaggerScheme" json:"schemes,omitempty"` + Consumes []string `protobuf:"bytes,6,rep,name=consumes" json:"consumes,omitempty"` + Produces []string `protobuf:"bytes,7,rep,name=produces" json:"produces,omitempty"` + SecurityDefinitions *SecurityDefinitions `protobuf:"bytes,11,opt,name=security_definitions,json=securityDefinitions" json:"security_definitions,omitempty"` + Security []*SecurityRequirement `protobuf:"bytes,12,rep,name=security" json:"security,omitempty"` + ExternalDocs *ExternalDocumentation `protobuf:"bytes,14,opt,name=external_docs,json=externalDocs" json:"external_docs,omitempty"` } func (m *Swagger) Reset() { *m = Swagger{} } @@ -177,6 +269,20 @@ func (m *Swagger) GetProduces() []string { return nil } +func (m *Swagger) GetSecurityDefinitions() *SecurityDefinitions { + if m != nil { + return m.SecurityDefinitions + } + return nil +} + +func (m *Swagger) GetSecurity() []*SecurityRequirement { + if m != nil { + return m.Security + } + return nil +} + func (m *Swagger) GetExternalDocs() *ExternalDocumentation { if m != nil { return m.ExternalDocs @@ -199,6 +305,7 @@ type Operation struct { Produces []string `protobuf:"bytes,7,rep,name=produces" json:"produces,omitempty"` Schemes []string `protobuf:"bytes,10,rep,name=schemes" json:"schemes,omitempty"` Deprecated bool `protobuf:"varint,11,opt,name=deprecated" json:"deprecated,omitempty"` + Security []*SecurityRequirement `protobuf:"bytes,12,rep,name=security" json:"security,omitempty"` } func (m *Operation) Reset() { *m = Operation{} } @@ -269,6 +376,13 @@ func (m *Operation) GetDeprecated() bool { return false } +func (m *Operation) GetSecurity() []*SecurityRequirement { + if m != nil { + return m.Security + } + return nil +} + // `Info` is a representation of OpenAPI v2 specification's Info object. // // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#infoObject @@ -645,6 +759,215 @@ func (m *Tag) GetExternalDocs() *ExternalDocumentation { return nil } +// `SecurityDefinitions` is a representation of OpenAPI v2 specification's +// Security Definitions object. +// +// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#securityDefinitionsObject +// +// A declaration of the security schemes available to be used in the +// specification. This does not enforce the security schemes on the operations +// and only serves to provide the relevant details for each scheme. +type SecurityDefinitions struct { + // A single security scheme definition, mapping a "name" to the scheme it defines. + Security map[string]*SecurityScheme `protobuf:"bytes,1,rep,name=security" json:"security,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` +} + +func (m *SecurityDefinitions) Reset() { *m = SecurityDefinitions{} } +func (m *SecurityDefinitions) String() string { return proto.CompactTextString(m) } +func (*SecurityDefinitions) ProtoMessage() {} +func (*SecurityDefinitions) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} } + +func (m *SecurityDefinitions) GetSecurity() map[string]*SecurityScheme { + if m != nil { + return m.Security + } + return nil +} + +// `SecurityScheme` is a representation of OpenAPI v2 specification's +// Security Scheme object. +// +// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#securitySchemeObject +// +// Allows the definition of a security scheme that can be used by the +// operations. Supported schemes are basic authentication, an API key (either as +// a header or as a query parameter) and OAuth2's common flows (implicit, +// password, application and access code). +type SecurityScheme struct { + // Required. The type of the security scheme. Valid values are "basic", + // "apiKey" or "oauth2". + Type SecurityScheme_Type `protobuf:"varint,1,opt,name=type,enum=grpc.gateway.protoc_gen_swagger.options.SecurityScheme_Type" json:"type,omitempty"` + // A short description for security scheme. + Description string `protobuf:"bytes,2,opt,name=description" json:"description,omitempty"` + // Required. The name of the header or query parameter to be used. + // + // Valid for apiKey. + Name string `protobuf:"bytes,3,opt,name=name" json:"name,omitempty"` + // Required. The location of the API key. Valid values are "query" or "header". + // + // Valid for apiKey. + In SecurityScheme_In `protobuf:"varint,4,opt,name=in,enum=grpc.gateway.protoc_gen_swagger.options.SecurityScheme_In" json:"in,omitempty"` + // Required. The flow used by the OAuth2 security scheme. Valid values are + // "implicit", "password", "application" or "accessCode". + // + // Valid for oauth2. + Flow SecurityScheme_Flow `protobuf:"varint,5,opt,name=flow,enum=grpc.gateway.protoc_gen_swagger.options.SecurityScheme_Flow" json:"flow,omitempty"` + // Required. The authorization URL to be used for this flow. This SHOULD be in + // the form of a URL. + // + // Valid for oauth2/implicit and oauth2/accessCode. + AuthorizationUrl string `protobuf:"bytes,6,opt,name=authorization_url,json=authorizationUrl" json:"authorization_url,omitempty"` + // Required. The token URL to be used for this flow. This SHOULD be in the + // form of a URL. + // + // Valid for oauth2/password, oauth2/application and oauth2/accessCode. + TokenUrl string `protobuf:"bytes,7,opt,name=token_url,json=tokenUrl" json:"token_url,omitempty"` + // Required. The available scopes for the OAuth2 security scheme. + // + // Valid for oauth2. + Scopes *Scopes `protobuf:"bytes,8,opt,name=scopes" json:"scopes,omitempty"` +} + +func (m *SecurityScheme) Reset() { *m = SecurityScheme{} } +func (m *SecurityScheme) String() string { return proto.CompactTextString(m) } +func (*SecurityScheme) ProtoMessage() {} +func (*SecurityScheme) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} } + +func (m *SecurityScheme) GetType() SecurityScheme_Type { + if m != nil { + return m.Type + } + return SecurityScheme_TYPE_INVALID +} + +func (m *SecurityScheme) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +func (m *SecurityScheme) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *SecurityScheme) GetIn() SecurityScheme_In { + if m != nil { + return m.In + } + return SecurityScheme_IN_INVALID +} + +func (m *SecurityScheme) GetFlow() SecurityScheme_Flow { + if m != nil { + return m.Flow + } + return SecurityScheme_FLOW_INVALID +} + +func (m *SecurityScheme) GetAuthorizationUrl() string { + if m != nil { + return m.AuthorizationUrl + } + return "" +} + +func (m *SecurityScheme) GetTokenUrl() string { + if m != nil { + return m.TokenUrl + } + return "" +} + +func (m *SecurityScheme) GetScopes() *Scopes { + if m != nil { + return m.Scopes + } + return nil +} + +// `SecurityRequirement` is a representation of OpenAPI v2 specification's +// Security Requirement object. +// +// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#securityRequirementObject +// +// Lists the required security schemes to execute this operation. The object can +// have multiple security schemes declared in it which are all required (that +// is, there is a logical AND between the schemes). +// +// The name used for each property MUST correspond to a security scheme +// declared in the Security Definitions. +type SecurityRequirement struct { + // Each name must correspond to a security scheme which is declared in + // the Security Definitions. If the security scheme is of type "oauth2", + // then the value is a list of scope names required for the execution. + // For other security scheme types, the array MUST be empty. + SecurityRequirement map[string]*SecurityRequirement_SecurityRequirementValue `protobuf:"bytes,1,rep,name=security_requirement,json=securityRequirement" json:"security_requirement,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` +} + +func (m *SecurityRequirement) Reset() { *m = SecurityRequirement{} } +func (m *SecurityRequirement) String() string { return proto.CompactTextString(m) } +func (*SecurityRequirement) ProtoMessage() {} +func (*SecurityRequirement) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} } + +func (m *SecurityRequirement) GetSecurityRequirement() map[string]*SecurityRequirement_SecurityRequirementValue { + if m != nil { + return m.SecurityRequirement + } + return nil +} + +// If the security scheme is of type "oauth2", then the value is a list of +// scope names required for the execution. For other security scheme types, +// the array MUST be empty. +type SecurityRequirement_SecurityRequirementValue struct { + Scope []string `protobuf:"bytes,1,rep,name=scope" json:"scope,omitempty"` +} + +func (m *SecurityRequirement_SecurityRequirementValue) Reset() { + *m = SecurityRequirement_SecurityRequirementValue{} +} +func (m *SecurityRequirement_SecurityRequirementValue) String() string { + return proto.CompactTextString(m) +} +func (*SecurityRequirement_SecurityRequirementValue) ProtoMessage() {} +func (*SecurityRequirement_SecurityRequirementValue) Descriptor() ([]byte, []int) { + return fileDescriptor0, []int{10, 0} +} + +func (m *SecurityRequirement_SecurityRequirementValue) GetScope() []string { + if m != nil { + return m.Scope + } + return nil +} + +// `Scopes` is a representation of OpenAPI v2 specification's Scopes object. +// +// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#scopesObject +// +// Lists the available scopes for an OAuth2 security scheme. +type Scopes struct { + // Maps between a name of a scope to a short description of it (as the value + // of the property). + Scope map[string]string `protobuf:"bytes,1,rep,name=scope" json:"scope,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` +} + +func (m *Scopes) Reset() { *m = Scopes{} } +func (m *Scopes) String() string { return proto.CompactTextString(m) } +func (*Scopes) ProtoMessage() {} +func (*Scopes) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} } + +func (m *Scopes) GetScope() map[string]string { + if m != nil { + return m.Scope + } + return nil +} + func init() { proto.RegisterType((*Swagger)(nil), "grpc.gateway.protoc_gen_swagger.options.Swagger") proto.RegisterType((*Operation)(nil), "grpc.gateway.protoc_gen_swagger.options.Operation") @@ -654,86 +977,124 @@ func init() { proto.RegisterType((*Schema)(nil), "grpc.gateway.protoc_gen_swagger.options.Schema") proto.RegisterType((*JSONSchema)(nil), "grpc.gateway.protoc_gen_swagger.options.JSONSchema") proto.RegisterType((*Tag)(nil), "grpc.gateway.protoc_gen_swagger.options.Tag") + proto.RegisterType((*SecurityDefinitions)(nil), "grpc.gateway.protoc_gen_swagger.options.SecurityDefinitions") + proto.RegisterType((*SecurityScheme)(nil), "grpc.gateway.protoc_gen_swagger.options.SecurityScheme") + proto.RegisterType((*SecurityRequirement)(nil), "grpc.gateway.protoc_gen_swagger.options.SecurityRequirement") + proto.RegisterType((*SecurityRequirement_SecurityRequirementValue)(nil), "grpc.gateway.protoc_gen_swagger.options.SecurityRequirement.SecurityRequirementValue") + proto.RegisterType((*Scopes)(nil), "grpc.gateway.protoc_gen_swagger.options.Scopes") proto.RegisterEnum("grpc.gateway.protoc_gen_swagger.options.Swagger_SwaggerScheme", Swagger_SwaggerScheme_name, Swagger_SwaggerScheme_value) proto.RegisterEnum("grpc.gateway.protoc_gen_swagger.options.JSONSchema_JSONSchemaSimpleTypes", JSONSchema_JSONSchemaSimpleTypes_name, JSONSchema_JSONSchemaSimpleTypes_value) + proto.RegisterEnum("grpc.gateway.protoc_gen_swagger.options.SecurityScheme_Type", SecurityScheme_Type_name, SecurityScheme_Type_value) + proto.RegisterEnum("grpc.gateway.protoc_gen_swagger.options.SecurityScheme_In", SecurityScheme_In_name, SecurityScheme_In_value) + proto.RegisterEnum("grpc.gateway.protoc_gen_swagger.options.SecurityScheme_Flow", SecurityScheme_Flow_name, SecurityScheme_Flow_value) } func init() { proto.RegisterFile("protoc-gen-swagger/options/openapiv2.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 1175 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xed, 0x6e, 0xdb, 0x36, - 0x17, 0x7e, 0x65, 0xd3, 0x36, 0x7d, 0x6c, 0xe7, 0x65, 0xd5, 0x74, 0x63, 0xd3, 0x8f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0xbc, 0x07, 0x1b, 0x37, - 0x48, 0xf5, 0xd3, 0xdf, 0x20, 0x45, 0xba, 0x87, 0xcf, 0x7f, 0x3a, 0x58, 0x0a, 0x75, 0x9a, 0x9f, - 0x0c, 0x82, 0x38, 0xda, 0xd3, 0xfa, 0xbb, 0x3c, 0x88, 0xb3, 0x75, 0xa6, 0xb8, 0x35, 0xed, 0xe7, - 0xf6, 0xfe, 0xf9, 0x7f, 0xeb, 0x49, 0xdd, 0x70, 0xcf, 0xfe, 0x0e, 0x00, 0x00, 0xff, 0xff, 0xf8, - 0x2b, 0xe7, 0x47, 0xdc, 0x0a, 0x00, 0x00, + // 1664 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0x5b, 0x73, 0xdb, 0xc6, + 0x15, 0x0e, 0xc8, 0x25, 0x09, 0x1e, 0x4a, 0xcc, 0x7a, 0x2d, 0xb7, 0x88, 0x12, 0xbb, 0x0a, 0x9a, + 0x4e, 0x35, 0xf6, 0x98, 0x4a, 0x95, 0x87, 0x66, 0x32, 0x9d, 0xce, 0x50, 0x12, 0x63, 0x03, 0x96, + 0x49, 0x16, 0xa4, 0xa2, 0xb8, 0x33, 0x1d, 0xcc, 0x1a, 0x5c, 0x52, 0x88, 0x71, 0x61, 0x70, 0x91, + 0xc4, 0xfe, 0x82, 0x3e, 0x77, 0xfa, 0xda, 0x9f, 0xd1, 0xa7, 0xf6, 0x67, 0xf4, 0x97, 0xb4, 0x6f, + 0x7d, 0xea, 0xec, 0x05, 0x24, 0x74, 0x49, 0x86, 0x91, 0xed, 0x27, 0xee, 0xf9, 0xce, 0x65, 0xf7, + 0x5c, 0xf6, 0x9c, 0x05, 0xe1, 0xf1, 0x3c, 0x89, 0xb3, 0xd8, 0x7b, 0x3a, 0x63, 0xd1, 0xd3, 0xf4, + 0x82, 0xce, 0x66, 0x2c, 0xd9, 0x8b, 0xe7, 0x99, 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x73, 0xb5, 0x1d, 0xbc, 0x73, 0xdf, 0xc4, 0x51, 0xcb, 0xcd, 0xe2, 0x6f, 0x1a, 0x7f, 0x73, + 0xf2, 0x5a, 0x23, 0xc3, 0xb2, 0x03, 0xad, 0x9f, 0x72, 0x3f, 0x85, 0xbe, 0xfc, 0x91, 0xc1, 0x53, + 0xce, 0x7f, 0x09, 0xb0, 0x02, 0x6f, 0xf1, 0x76, 0xab, 0xec, 0x6d, 0xb3, 0x74, 0xac, 0x83, 0xc3, + 0x3f, 0x76, 0x67, 0x7e, 0x76, 0x96, 0xbf, 0xee, 0x78, 0x71, 0xb8, 0xc7, 0x0f, 0xf2, 0x94, 0x79, + 0x71, 0xba, 0x48, 0x33, 0xa6, 0x48, 0x75, 0xae, 0xbd, 0x1f, 0xfe, 0x13, 0xe6, 0x75, 0x5d, 0xf0, + 0xbe, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xdc, 0xb7, 0xe4, 0x3d, 0xa9, 0x11, 0x00, 0x00, } diff --git a/protoc-gen-swagger/options/openapiv2.proto b/protoc-gen-swagger/options/openapiv2.proto index 6c1854613dd..b3b9b89d995 100644 --- a/protoc-gen-swagger/options/openapiv2.proto +++ b/protoc-gen-swagger/options/openapiv2.proto @@ -33,10 +33,8 @@ message Swagger { reserved 9; // field 10 is reserved for 'responses'. reserved 10; - // field 11 is reserved for 'securityDefinitions'. - reserved 11; - // field 12 is reserved for repeated 'security'. - reserved 12; + SecurityDefinitions security_definitions = 11; + repeated SecurityRequirement security = 12; // field 13 is reserved for 'tags', which are supposed to be exposed as and // customizable as proto services. TODO(ivucica): add processing of proto // service objects into OpenAPI v2 Tag objects. @@ -63,9 +61,7 @@ message Operation { reserved 9; repeated string schemes = 10; bool deprecated = 11; - // field 12 is reserved for 'security'. - reserved 12; - + repeated SecurityRequirement security = 12; } // `Info` is a representation of OpenAPI v2 specification's Info object. @@ -221,3 +217,122 @@ message Tag { string description = 2; ExternalDocumentation external_docs = 3; } + +// `SecurityDefinitions` is a representation of OpenAPI v2 specification's +// Security Definitions object. +// +// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#securityDefinitionsObject +// +// A declaration of the security schemes available to be used in the +// specification. This does not enforce the security schemes on the operations +// and only serves to provide the relevant details for each scheme. +message SecurityDefinitions { + // A single security scheme definition, mapping a "name" to the scheme it defines. + map security = 1; +} + +// `SecurityScheme` is a representation of OpenAPI v2 specification's +// Security Scheme object. +// +// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#securitySchemeObject +// +// Allows the definition of a security scheme that can be used by the +// operations. Supported schemes are basic authentication, an API key (either as +// a header or as a query parameter) and OAuth2's common flows (implicit, +// password, application and access code). +message SecurityScheme { + // Required. The type of the security scheme. Valid values are "basic", + // "apiKey" or "oauth2". + enum Type { + TYPE_INVALID = 0; + TYPE_BASIC = 1; + TYPE_API_KEY = 2; + TYPE_OAUTH2 = 3; + } + + // Required. The location of the API key. Valid values are "query" or "header". + enum In { + IN_INVALID = 0; + IN_QUERY = 1; + IN_HEADER = 2; + } + + // Required. The flow used by the OAuth2 security scheme. Valid values are + // "implicit", "password", "application" or "accessCode". + enum Flow { + FLOW_INVALID = 0; + FLOW_IMPLICIT = 1; + FLOW_PASSWORD = 2; + FLOW_APPLICATION = 3; + FLOW_ACCESS_CODE = 4; + } + + // Required. The type of the security scheme. Valid values are "basic", + // "apiKey" or "oauth2". + Type type = 1; + // A short description for security scheme. + string description = 2; + // Required. The name of the header or query parameter to be used. + // + // Valid for apiKey. + string name = 3; + // Required. The location of the API key. Valid values are "query" or "header". + // + // Valid for apiKey. + In in = 4; + // Required. The flow used by the OAuth2 security scheme. Valid values are + // "implicit", "password", "application" or "accessCode". + // + // Valid for oauth2. + Flow flow = 5; + // Required. The authorization URL to be used for this flow. This SHOULD be in + // the form of a URL. + // + // Valid for oauth2/implicit and oauth2/accessCode. + string authorization_url = 6; + // Required. The token URL to be used for this flow. This SHOULD be in the + // form of a URL. + // + // Valid for oauth2/password, oauth2/application and oauth2/accessCode. + string token_url = 7; + // Required. The available scopes for the OAuth2 security scheme. + // + // Valid for oauth2. + Scopes scopes = 8; +} + +// `SecurityRequirement` is a representation of OpenAPI v2 specification's +// Security Requirement object. +// +// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#securityRequirementObject +// +// Lists the required security schemes to execute this operation. The object can +// have multiple security schemes declared in it which are all required (that +// is, there is a logical AND between the schemes). +// +// The name used for each property MUST correspond to a security scheme +// declared in the Security Definitions. +message SecurityRequirement { + // If the security scheme is of type "oauth2", then the value is a list of + // scope names required for the execution. For other security scheme types, + // the array MUST be empty. + message SecurityRequirementValue { + repeated string scope = 1; + } + // Each name must correspond to a security scheme which is declared in + // the Security Definitions. If the security scheme is of type "oauth2", + // then the value is a list of scope names required for the execution. + // For other security scheme types, the array MUST be empty. + map security_requirement = 1; +} + +// `Scopes` is a representation of OpenAPI v2 specification's Scopes object. +// +// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#scopesObject +// +// Lists the available scopes for an OAuth2 security scheme. +message Scopes { + // Maps between a name of a scope to a short description of it (as the value + // of the property). + map scope = 1; +} From 85e27b939ae1edd24eb30cb7f6ddc144f68ea962 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Vu=C4=8Dica?= Date: Sun, 11 Feb 2018 19:00:12 +0000 Subject: [PATCH 2/3] swagger: Add security fields to a_bit_of_everything, for testing. --- examples/examplepb/a_bit_of_everything.proto | 77 ++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/examples/examplepb/a_bit_of_everything.proto b/examples/examplepb/a_bit_of_everything.proto index 40280c7e124..f9869e5fc0d 100644 --- a/examples/examplepb/a_bit_of_everything.proto +++ b/examples/examplepb/a_bit_of_everything.proto @@ -32,6 +32,68 @@ option (grpc.gateway.protoc_gen_swagger.options.openapiv2_swagger) = { consumes: "application/x-foo-mime"; produces: "application/json"; produces: "application/x-foo-mime"; + security_definitions: { + security: { + key: "BasicAuth"; + value: { + type: TYPE_BASIC; + } + } + security: { + key: "ApiKeyAuth"; + value: { + type: TYPE_API_KEY; + in: IN_HEADER; + name: "X-API-Key"; + } + } + security: { + key: "OAuth2"; + value: { + type: TYPE_OAUTH2; + flow: FLOW_ACCESS_CODE; + authorization_url: "https://example.com/oauth/authorize"; + token_url: "https://example.com/oauth/token"; + scopes: { + scope: { + key: "read"; + value: "Grants read access"; + } + scope: { + key: "write"; + value: "Grants write access"; + } + scope: { + key: "admin"; + value: "Grants read and write access to administrative information"; + } + } + } + } + } + security: { + security_requirement: { + key: "BasicAuth"; + value: {}; + } + security_requirement: { + key: "ApiKeyAuth"; + value: {}; + } + } + security: { + security_requirement: { + key: "OAuth2"; + value: { + scope: "read"; + scope: "write"; + } + } + security_requirement: { + key: "ApiKeyAuth"; + value: {}; + } + } }; @@ -154,6 +216,21 @@ service ABitOfEverythingService { option (google.api.http) = { delete: "/v1/example/a_bit_of_everything/{uuid}" }; + option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = { + security: { + security_requirement: { + key: "ApiKeyAuth"; + value: {} + } + security_requirement: { + key: "OAuth2"; + value: { + scope: "read"; + scope: "write"; + } + } + } + }; } rpc GetQuery(ABitOfEverything) returns (google.protobuf.Empty) { option (google.api.http) = { From 93cbcb02d2dd334fa5c9073439417ea7d3f63e59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Vu=C4=8Dica?= Date: Sun, 11 Feb 2018 19:22:17 +0000 Subject: [PATCH 3/3] swagger: Use security fields from proto options when outputting Swagger JSON. Fixes #428. --- examples/examplepb/a_bit_of_everything.pb.go | 236 ++++++++++-------- .../a_bit_of_everything.swagger.json | 43 ++++ protoc-gen-swagger/genswagger/template.go | 100 ++++++++ protoc-gen-swagger/genswagger/types.go | 46 +++- 4 files changed, 303 insertions(+), 122 deletions(-) diff --git a/examples/examplepb/a_bit_of_everything.pb.go b/examples/examplepb/a_bit_of_everything.pb.go index f8994b6b4a8..a7568201619 100644 --- a/examples/examplepb/a_bit_of_everything.pb.go +++ b/examples/examplepb/a_bit_of_everything.pb.go @@ -1034,115 +1034,129 @@ var _AnotherServiceWithNoBindings_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("examples/examplepb/a_bit_of_everything.proto", fileDescriptor1) } var fileDescriptor1 = []byte{ - // 1759 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0x5f, 0x6f, 0x1b, 0xc7, - 0x11, 0xd7, 0x1e, 0x65, 0x5a, 0x1c, 0xea, 0x0f, 0xb5, 0xb2, 0x65, 0x9a, 0x56, 0xa2, 0x35, 0xe3, - 0xb4, 0x57, 0xd5, 0xba, 0x8b, 0xe9, 0xa0, 0x88, 0x05, 0xb4, 0x29, 0x65, 0xd1, 0x76, 0xd0, 0x58, - 0xb6, 0xcf, 0x89, 0x6b, 0xb8, 0x4e, 0x85, 0x23, 0x6f, 0x49, 0x5e, 0xcc, 0xbb, 0xbd, 0xde, 0xed, - 0xc9, 0x22, 0x58, 0xf5, 0xa1, 0x05, 0x5a, 0xe4, 0x55, 0x7d, 0xeb, 0x43, 0x5e, 0x0a, 0x14, 0x2d, - 0xd0, 0x3e, 0xf6, 0xa9, 0x40, 0xfb, 0xd2, 0x6f, 0xd0, 0x4f, 0x50, 0xa0, 0x1f, 0xa4, 0xd8, 0xbd, - 0x3f, 0x3e, 0x92, 0x22, 0x28, 0xca, 0x41, 0x9e, 0x74, 0xbb, 0x3b, 0xf3, 0x9b, 0xdf, 0xcc, 0xce, - 0xcc, 0x8e, 0x08, 0x37, 0xe9, 0x91, 0xe9, 0x78, 0x3d, 0x1a, 0xe8, 0xf1, 0x87, 0xd7, 0xd4, 0xcd, - 0x83, 0xa6, 0xcd, 0x0f, 0x58, 0xfb, 0x80, 0x1e, 0x52, 0xbf, 0xcf, 0xbb, 0xb6, 0xdb,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, 0x87, 0x0e, 0xf5, 0xed, 0x56, 0xc3, - 0x0d, 0x1d, 0xa3, 0x20, 0xf4, 0x23, 0xb0, 0xf7, 0x61, 0x39, 0x18, 0x76, 0x7c, 0x85, 0x20, 0x75, - 0xc5, 0x58, 0x0a, 0x86, 0x3c, 0x4f, 0xc5, 0xd2, 0x20, 0x96, 0x08, 0x52, 0x4b, 0x89, 0x58, 0xe6, - 0xba, 0x82, 0x2c, 0xfb, 0x55, 0x82, 0xd4, 0x55, 0xa3, 0x18, 0x64, 0xd8, 0xc7, 0x22, 0x29, 0x0e, - 0x26, 0x48, 0xc5, 0x91, 0x48, 0x82, 0x52, 0x83, 0xcb, 0x3e, 0xf5, 0xa8, 0xc9, 0xa9, 0x75, 0x30, - 0x14, 0xd0, 0x35, 0x92, 0x53, 0x0b, 0xc6, 0x5a, 0x72, 0xf8, 0x34, 0x13, 0xd8, 0x3b, 0x50, 0x64, - 0x2e, 0x15, 0x5d, 0x48, 0x34, 0x89, 0xf2, 0x25, 0x59, 0x50, 0xeb, 0x5a, 0x54, 0xcc, 0x5a, 0x52, - 0xcc, 0x5a, 0x43, 0x9c, 0x3e, 0x98, 0x33, 0x40, 0x0a, 0xcb, 0x15, 0x7e, 0x0f, 0x16, 0x23, 0xd5, - 0xc8, 0x56, 0xf9, 0xb2, 0xb8, 0xb6, 0x07, 0x73, 0x46, 0x04, 0x18, 0x19, 0xc1, 0x2f, 0xa1, 0xe0, - 0x98, 0x5e, 0xcc, 0x63, 0x5d, 0x96, 0xd0, 0xc7, 0xb3, 0x97, 0xd0, 0x43, 0xd3, 0x93, 0x74, 0x1b, - 0x2e, 0xf7, 0xfb, 0xc6, 0x82, 0x13, 0x2f, 0xf1, 0x11, 0xac, 0x39, 0xa6, 0xe7, 0x8d, 0xfa, 0x7b, - 0x45, 0xda, 0x79, 0x70, 0x2e, 0x3b, 0xde, 0x50, 0x7c, 0x22, 0x83, 0xab, 0xce, 0xe8, 0x7e, 0xc6, - 0x72, 0x54, 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0x21, 0x2d, 0xe6, 0x88, 0xc5, - 0xf5, 0xca, 0x13, 0xd8, 0x3c, 0xad, 0x9b, 0x89, 0x32, 0x4a, 0x46, 0x9f, 0x19, 0x2b, 0xbe, 0xf6, - 0x73, 0xd8, 0xa8, 0xbb, 0x8c, 0x77, 0xa9, 0x1f, 0x23, 0x88, 0x80, 0x66, 0x12, 0xfd, 0x47, 0x43, - 0x69, 0x3f, 0x6b, 0x56, 0xcd, 0xed, 0xfe, 0x45, 0x39, 0xa9, 0xff, 0x41, 0xc1, 0x1c, 0xd6, 0xea, - 0x64, 0xd7, 0xe6, 0xc2, 0xc1, 0x4c, 0x55, 0x3e, 0x87, 0x4b, 0x1d, 0xe3, 0xf1, 0xdd, 0xed, 0xfb, - 0x11, 0x1b, 0xe2, 0xf9, 0xec, 0x4b, 0xda, 0xe2, 0xb3, 0x7a, 0x51, 0x29, 0xb9, 0xcc, 0xa5, 0x3f, - 0x8e, 0x6f, 0x4c, 0x48, 0xd7, 0x72, 0xb7, 0xb4, 0x0f, 0xb6, 0x72, 0x48, 0x99, 0xaf, 0x95, 0x4c, - 0xcf, 0xeb, 0xd9, 0x2d, 0x19, 0x4a, 0xfd, 0xcb, 0x80, 0xb9, 0xb5, 0xf5, 0xec, 0xce, 0xd1, 0x76, - 0x9b, 0xb1, 0x6d, 0xc7, 0x76, 0xe8, 0xce, 0x98, 0xe4, 0xce, 0x04, 0x49, 0xff, 0x13, 0xb8, 0xf2, - 0xf0, 0x4d, 0xfc, 0xb3, 0x2e, 0xcc, 0x4a, 0xfd, 0x45, 0x21, 0xcd, 0xcd, 0x66, 0x5e, 0x46, 0xef, - 0xf6, 0xff, 0x03, 0x00, 0x00, 0xff, 0xff, 0x6d, 0x74, 0xcd, 0x98, 0xea, 0x14, 0x00, 0x00, + // 1983 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0xcb, 0x6f, 0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x01, 0x1d, 0x92, 0x0c, 0xfc, 0x03, 0x25, 0xaf, + 0xed, 0xdf, 0x50, 0x21, 0xab, 0xe4, 0xea, 0x57, 0x63, 0x27, 0x53, 0xbc, 0x35, 0x66, 0x04, 0xbc, + 0xaf, 0x89, 0x7f, 0x98, 0x67, 0xfd, 0x88, 0x36, 0xd6, 0x26, 0x83, 0x38, 0x7b, 0x45, 0x9d, 0x8d, + 0x9f, 0x42, 0x25, 0x7c, 0xbc, 0x31, 0xbe, 0xeb, 0x19, 0x0e, 0xf7, 0x89, 0x58, 0x10, 0xa3, 0xd3, + 0xa1, 0xbe, 0x0f, 0xab, 0xd1, 0x93, 0x8e, 0x97, 0xa3, 0x43, 0xb9, 0x8a, 0x4f, 0xef, 0xc0, 0xac, + 0x61, 0xda, 0x96, 0x83, 0x1b, 0x23, 0xa2, 0x8e, 0x39, 0x02, 0x23, 0x9c, 0x11, 0x09, 0xb3, 0x7c, + 0x2e, 0x7a, 0xdc, 0x0e, 0x25, 0x96, 0xd3, 0x65, 0x9e, 0x2d, 0xc3, 0xd2, 0x5e, 0x83, 0xf9, 0x74, + 0x28, 0x66, 0xc6, 0xc7, 0x8c, 0xf6, 0xf5, 0x89, 0x83, 0xc6, 0x38, 0xd4, 0xbb, 0x0f, 0x17, 0x1e, + 0xbe, 0xce, 0xeb, 0x74, 0x6a, 0x4c, 0x9b, 0x12, 0x2f, 0x8a, 0x49, 0xcd, 0xb7, 0xf3, 0x32, 0x2b, + 0x6f, 0xfd, 0x37, 0x00, 0x00, 0xff, 0xff, 0x7f, 0x02, 0x53, 0x7b, 0xaf, 0x16, 0x00, 0x00, } diff --git a/examples/examplepb/a_bit_of_everything.swagger.json b/examples/examplepb/a_bit_of_everything.swagger.json index a6c1f752214..02c2f892dd7 100644 --- a/examples/examplepb/a_bit_of_everything.swagger.json +++ b/examples/examplepb/a_bit_of_everything.swagger.json @@ -489,6 +489,15 @@ ], "tags": [ "ABitOfEverythingService" + ], + "security": [ + { + "ApiKeyAuth": [], + "OAuth2": [ + "read", + "write" + ] + } ] }, "put": { @@ -867,6 +876,40 @@ } } }, + "securityDefinitions": { + "ApiKeyAuth": { + "type": "apiKey", + "name": "X-API-Key", + "in": "header" + }, + "BasicAuth": { + "type": "basic" + }, + "OAuth2": { + "type": "oauth2", + "flow": "accessCode", + "authorizationUrl": "https://example.com/oauth/authorize", + "tokenUrl": "https://example.com/oauth/token", + "scopes": { + "admin": "Grants read and write access to administrative information", + "read": "Grants read access", + "write": "Grants write access" + } + } + }, + "security": [ + { + "ApiKeyAuth": [], + "BasicAuth": [] + }, + { + "ApiKeyAuth": [], + "OAuth2": [ + "read", + "write" + ] + } + ], "externalDocs": { "description": "More about gRPC-Gateway", "url": "https://github.com/grpc-ecosystem/grpc-gateway" diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index c838a5808d7..2781a8b6e52 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -648,6 +648,24 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re operationObject.Tags = make([]string, len(opts.Tags)) copy(operationObject.Tags, opts.Tags) } + if opts.Security != nil { + newSecurity := []swaggerSecurityRequirementObject{} + if operationObject.Security == nil { + newSecurity = []swaggerSecurityRequirementObject{} + } else { + newSecurity = operationObject.Security + } + for _, secReq := range opts.Security { + newSecReq := swaggerSecurityRequirementObject{} + for secReqKey, secReqValue := range secReq.SecurityRequirement { + newSecReqValue := make([]string, len(secReqValue.Scope)) + copy(newSecReqValue, secReqValue.Scope) + newSecReq[secReqKey] = newSecReqValue + } + newSecurity = append(newSecurity, newSecReq) + } + operationObject.Security = newSecurity + } // TODO(ivucica): add remaining fields of operation object } @@ -775,6 +793,88 @@ func applyTemplate(p param) (string, error) { s.Produces = make([]string, len(spb.Produces)) copy(s.Produces, spb.Produces) } + if spb.SecurityDefinitions != nil && spb.SecurityDefinitions.Security != nil { + if s.SecurityDefinitions == nil { + s.SecurityDefinitions = swaggerSecurityDefinitionsObject{} + } + for secDefKey, secDefValue := range spb.SecurityDefinitions.Security { + var newSecDefValue swaggerSecuritySchemeObject + if oldSecDefValue, ok := s.SecurityDefinitions[secDefKey]; !ok { + newSecDefValue = swaggerSecuritySchemeObject{} + } else { + newSecDefValue = oldSecDefValue + } + if secDefValue.Type != swagger_options.SecurityScheme_TYPE_INVALID { + switch secDefValue.Type { + case swagger_options.SecurityScheme_TYPE_BASIC: + newSecDefValue.Type = "basic" + case swagger_options.SecurityScheme_TYPE_API_KEY: + newSecDefValue.Type = "apiKey" + case swagger_options.SecurityScheme_TYPE_OAUTH2: + newSecDefValue.Type = "oauth2" + } + } + if secDefValue.Description != "" { + newSecDefValue.Description = secDefValue.Description + } + if secDefValue.Name != "" { + newSecDefValue.Name = secDefValue.Name + } + if secDefValue.In != swagger_options.SecurityScheme_IN_INVALID { + switch secDefValue.In { + case swagger_options.SecurityScheme_IN_QUERY: + newSecDefValue.In = "query" + case swagger_options.SecurityScheme_IN_HEADER: + newSecDefValue.In = "header" + } + } + if secDefValue.Flow != swagger_options.SecurityScheme_FLOW_INVALID { + switch secDefValue.Flow { + case swagger_options.SecurityScheme_FLOW_IMPLICIT: + newSecDefValue.Flow = "implicit" + case swagger_options.SecurityScheme_FLOW_PASSWORD: + newSecDefValue.Flow = "password" + case swagger_options.SecurityScheme_FLOW_APPLICATION: + newSecDefValue.Flow = "application" + case swagger_options.SecurityScheme_FLOW_ACCESS_CODE: + newSecDefValue.Flow = "accessCode" + } + } + if secDefValue.AuthorizationUrl != "" { + newSecDefValue.AuthorizationURL = secDefValue.AuthorizationUrl + } + if secDefValue.TokenUrl != "" { + newSecDefValue.TokenURL = secDefValue.TokenUrl + } + if secDefValue.Scopes != nil { + if newSecDefValue.Scopes == nil { + newSecDefValue.Scopes = swaggerScopesObject{} + } + for scopeKey, scopeDesc := range secDefValue.Scopes.Scope { + newSecDefValue.Scopes[scopeKey] = scopeDesc + } + } + s.SecurityDefinitions[secDefKey] = newSecDefValue + } + } + if spb.Security != nil { + newSecurity := []swaggerSecurityRequirementObject{} + if s.Security == nil { + newSecurity = []swaggerSecurityRequirementObject{} + } else { + newSecurity = s.Security + } + for _, secReq := range spb.Security { + newSecReq := swaggerSecurityRequirementObject{} + for secReqKey, secReqValue := range secReq.SecurityRequirement { + newSecReqValue := make([]string, len(secReqValue.Scope)) + copy(newSecReqValue, secReqValue.Scope) + newSecReq[secReqKey] = newSecReqValue + } + newSecurity = append(newSecurity, newSecReq) + } + s.Security = newSecurity + } if spb.ExternalDocs != nil { if s.ExternalDocs == nil { s.ExternalDocs = &swaggerExternalDocumentationObject{} diff --git a/protoc-gen-swagger/genswagger/types.go b/protoc-gen-swagger/genswagger/types.go index 35e8542083e..0c85d941135 100644 --- a/protoc-gen-swagger/genswagger/types.go +++ b/protoc-gen-swagger/genswagger/types.go @@ -48,17 +48,40 @@ type swaggerExternalDocumentationObject struct { // http://swagger.io/specification/#swaggerObject type swaggerObject struct { - Swagger string `json:"swagger"` - Info swaggerInfoObject `json:"info"` - Host string `json:"host,omitempty"` - BasePath string `json:"basePath,omitempty"` - Schemes []string `json:"schemes"` - Consumes []string `json:"consumes"` - Produces []string `json:"produces"` - Paths swaggerPathsObject `json:"paths"` - Definitions swaggerDefinitionsObject `json:"definitions"` - ExternalDocs *swaggerExternalDocumentationObject `json:"externalDocs,omitempty"` -} + Swagger string `json:"swagger"` + Info swaggerInfoObject `json:"info"` + Host string `json:"host,omitempty"` + BasePath string `json:"basePath,omitempty"` + Schemes []string `json:"schemes"` + Consumes []string `json:"consumes"` + Produces []string `json:"produces"` + Paths swaggerPathsObject `json:"paths"` + Definitions swaggerDefinitionsObject `json:"definitions"` + SecurityDefinitions swaggerSecurityDefinitionsObject `json:"securityDefinitions,omitempty"` + Security []swaggerSecurityRequirementObject `json:"security,omitempty"` + ExternalDocs *swaggerExternalDocumentationObject `json:"externalDocs,omitempty"` +} + +// http://swagger.io/specification/#securityDefinitionsObject +type swaggerSecurityDefinitionsObject map[string]swaggerSecuritySchemeObject + +// http://swagger.io/specification/#securitySchemeObject +type swaggerSecuritySchemeObject struct { + Type string `json:"type"` + Description string `json:"description,omitempty"` + Name string `json:"name,omitempty"` + In string `json:"in,omitempty"` + Flow string `json:"flow,omitempty"` + AuthorizationURL string `json:"authorizationUrl,omitempty"` + TokenURL string `json:"tokenUrl,omitempty"` + Scopes swaggerScopesObject `json:"scopes,omitempty"` +} + +// http://swagger.io/specification/#scopesObject +type swaggerScopesObject map[string]string + +// http://swagger.io/specification/#securityRequirementObject +type swaggerSecurityRequirementObject map[string][]string // http://swagger.io/specification/#pathsObject type swaggerPathsObject map[string]swaggerPathItemObject @@ -82,6 +105,7 @@ type swaggerOperationObject struct { Tags []string `json:"tags,omitempty"` Deprecated bool `json:"deprecated,omitempty"` + Security []swaggerSecurityRequirementObject `json:"security,omitempty"` ExternalDocs *swaggerExternalDocumentationObject `json:"externalDocs,omitempty"` }