-
Notifications
You must be signed in to change notification settings - Fork 82
/
security.go
59 lines (47 loc) · 1.45 KB
/
security.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package openapi
import "github.com/ogen-go/ogen/location"
// SecurityScheme defines one of security schemes used in the security requirement.
type SecurityScheme struct {
Name string
Scopes []string
Security Security
}
// SecurityRequirement is parsed security requirement.
type SecurityRequirement struct {
// Each element needs to be satisfied to authorize the request.
Schemes []SecurityScheme
location.Pointer `json:"-" yaml:"-"`
}
// SecurityRequirements are parsed security requirements.
//
// Only one element needs to be satisfied to authorize the request.
type SecurityRequirements []SecurityRequirement
// Security is parsed security scheme.
type Security struct {
Type string
Description string
Name string
In string
Scheme string
BearerFormat string
Flows OAuthFlows
OpenIDConnectURL string
XOgenCustomSecurity bool
location.Pointer `json:"-" yaml:"-"`
}
// OAuthFlows allows configuration of the supported OAuth Flows.
type OAuthFlows struct {
Implicit *OAuthFlow
Password *OAuthFlow
ClientCredentials *OAuthFlow
AuthorizationCode *OAuthFlow
location.Pointer `json:"-" yaml:"-"`
}
// OAuthFlow is configuration details for a supported OAuth Flow.
type OAuthFlow struct {
AuthorizationURL string
TokenURL string
RefreshURL string
Scopes map[string]string // name -> description
location.Pointer `json:"-" yaml:"-"`
}