Skip to content

Commit f831370

Browse files
author
Josh
committed
Add OAPI security features
1 parent 5792c72 commit f831370

File tree

16 files changed

+921
-156
lines changed

16 files changed

+921
-156
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,21 @@ import "oapi/v1/service.proto";
9797

9898
option (oapi.v1.file) = {
9999
host: "myawesomeapi.com"
100+
101+
security_schemes: {
102+
name: "bearer_auth"
103+
scheme: {
104+
type: "http"
105+
scheme: "bearer"
106+
bearer_format: "JWT"
107+
}
108+
}
109+
110+
// Since this is at the file level, it's applied to all.
111+
security: {
112+
name: "bearer_auth"
113+
scopes: ["read:resource"]
114+
}
100115
};
101116

102117
service MyService {

api/oapi/v1/file.pb.go

Lines changed: 63 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/oapi/v1/file.proto

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ syntax = "proto3";
33
package oapi.v1;
44

55
import "google/protobuf/descriptor.proto";
6+
import "oapi/v1/security.proto";
67

78
option go_package = "github.com/technicallyjosh/protoc-gen-openapi/api/oapi/v1;oapiv1";
89

@@ -18,4 +19,12 @@ message FileOptions {
1819
// The default prefix for all services and methods in a file. This can be
1920
// overridden by the service or a method definition.
2021
string prefix = 2;
22+
23+
// Security schemes defined in a file. All files will be consolidated into one
24+
// list.
25+
// map<string, SecurityScheme> security_schemes = 3;
26+
repeated SecurityScheme security_schemes = 3;
27+
28+
// Security to be used on all services and routes by default in the file.
29+
repeated Security security = 4;
2130
}

0 commit comments

Comments
 (0)