Documentation
¶
Index ¶
- func AreOAuth2ScopeSetsEqual(left, right []string) bool
- func GetOAuth2FlowConfig(ctx context.Context, schemeKey string, s *openapi.ReferencedSecurityScheme, ...) (*ast.OAuth2FlowConfig, error)
- func GetSecuritySchemeTypeDef(ctx context.Context, scheme *openapi.SecurityScheme, schemeKey string, ...) (*ast.TypeDef, error)
- func HandleGlobalSecurity(ctx context.Context, docInfo *document.DocumentInfo, a *ast.AST, ...) (*ast.Security, *sequencedmap.Map[string, *openapi.ReferencedSecurityScheme], ...)
- func HandlePerOpSecurity(ctx context.Context, opts HandlePerOpSecurityOpts) (*ast.Security, error)
- func IsOAuth2ClientCredentialsEnabled(ctx context.Context, subsystem *subsystem.Subsystem) bool
- func IsOAuth2PasswordEnabled(ctx context.Context, subsystem *subsystem.Subsystem) bool
- func IsSecurityDisabled(securityReqs []*openapi.SecurityRequirement) bool
- type GlobalSecurityHoistMap
- type GlobalSecurityMatcher
- type HandleGlobalSecurityOptions
- type HandlePerOpSecurityOpts
- type Opts
- type SchemeNameOverrides
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AreOAuth2ScopeSetsEqual ¶
AreOAuth2ScopeSetsEqual reports whether two OAuth2 scope lists contain the same distinct scopes. Scope order and duplicate entries do not change the security requirement's meaning.
func GetOAuth2FlowConfig ¶
func GetOAuth2FlowConfig(ctx context.Context, schemeKey string, s *openapi.ReferencedSecurityScheme, opts *Opts) (*ast.OAuth2FlowConfig, error)
GetOAuth2FlowConfig will return the OAuth2 flow configuration for a given security scheme, which includes available scopes and whether the flow is enabled or not.
func GetSecuritySchemeTypeDef ¶
func GetSecuritySchemeTypeDef(ctx context.Context, scheme *openapi.SecurityScheme, schemeKey string, docInfo *document.DocumentInfo, opts *Opts) (*ast.TypeDef, error)
Returns the registered TypeDef of the security scheme.
func HandleGlobalSecurity ¶
func HandleGlobalSecurity(ctx context.Context, docInfo *document.DocumentInfo, a *ast.AST, opts HandleGlobalSecurityOptions) (*ast.Security, *sequencedmap.Map[string, *openapi.ReferencedSecurityScheme], error)
func HandlePerOpSecurity ¶
func IsOAuth2ClientCredentialsEnabled ¶
Returns true if the OAuth2 Client Credentials flow is enabled by checking:
- If the account has access to the oauth2ClientCredentials feature.
- If the target supports the oauth2ClientCredentials feature.
- If the generation configuration has auth.oAuth2ClientCredentialsEnabled enabled.
func IsOAuth2PasswordEnabled ¶
Returns true if the OAuth2 Resource Owner Password flow is enabled by checking: - If the account has access to the oauth2Password feature. - If the target supports the oauth2Password feature. - If the generation configuration has auth.oAuth2PasswordEnabled enabled.
func IsSecurityDisabled ¶
func IsSecurityDisabled(securityReqs []*openapi.SecurityRequirement) bool
Types ¶
type GlobalSecurityHoistMap ¶
type GlobalSecurityHoistMap map[string]ast.HoistedSecurityField
type GlobalSecurityMatcher ¶
type GlobalSecurityMatcher func(opReqs []ast.SecurityRequirement, optional bool) (equivalent bool, hoistedFields []ast.HoistedSecurityField)
GlobalSecurityMatcher checks whether an operation's security requirements match the global security options. If all requirements defined on the operation are already present at the global level, the operation security is no longer needed (i.e. can be hoisted). In this case the matching global security fields are returned in the priority order defined by the operation. If the operation cannot be hoisted, the matcher returns (false, nil). If the operation security is equivalent to the global security (i.e. no filtering or reordering is needed) the matcher returns (true, [..]) Built once per generation via NewGlobalSecurityMatcher and reused across all operations. Nil when global=true.
func NewGlobalSecurityMatcher ¶
func NewGlobalSecurityMatcher(globalSecurity *ast.Security) GlobalSecurityMatcher
NewGlobalSecurityMatcher builds a GlobalSecurityMatcher based on the SDK's global security. Returns nil if globalSecurity is nil or has no requirements.
type HandleGlobalSecurityOptions ¶
type HandleGlobalSecurityOptions struct {
Opts
}
type HandlePerOpSecurityOpts ¶
type HandlePerOpSecurityOpts struct {
Opts
ContextStack ast.ContextStack
SecurityReqs []*openapi.SecurityRequirement
SecuritySchemes *sequencedmap.Map[string, *openapi.ReferencedSecurityScheme]
Optional ast.SecurityOptionalityReason
GlobalSecurityMatcher GlobalSecurityMatcher
Scope ast.Scope
DocInfo *document.DocumentInfo
}
type SchemeNameOverrides ¶
type SchemeNameOverrides struct {
// contains filtered or unexported fields
}
func BuildSchemeNameOverrides ¶
func BuildSchemeNameOverrides(exts *extensions.Extensions, securitySchemes *sequencedmap.Map[string, *openapi.ReferencedSecurityScheme]) (SchemeNameOverrides, error)
func (SchemeNameOverrides) ResolveOriginalKey ¶
func (o SchemeNameOverrides) ResolveOriginalKey(schemeKey string) string
func (SchemeNameOverrides) ResolveSchemeKey ¶
func (o SchemeNameOverrides) ResolveSchemeKey(originalKey string) string