security

package
v0.0.0-...-ce83e3f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 14, 2024 License: BSD-2-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Oauth2              = "OAuth 2.0"
	BasicAuthentication = "Basic Authentication"
	PassThrough         = "Pass Through"
)

Variables

This section is empty.

Functions

func FindResourceSecuredBy

func FindResourceSecuredBy(r *raml.Resource) []raml.DefinitionChoice

find resource's securedBy recursively

func GetMethodSecuredBy

func GetMethodSecuredBy(apiDef *raml.APIDefinition, r *raml.Resource, m *raml.Method) []raml.DefinitionChoice

GetMethodSecuredBy get SecuredBy field of a method

func GetQuotedScopes

func GetQuotedScopes(ss raml.DefinitionChoice) ([]string, error)

get array of security scopes in the form of quoted string

func SecuritySchemeName

func SecuritySchemeName(name string) string

return security scheme name that could be used in code

func Supported

func Supported(ss raml.SecurityScheme) bool

Supported returns true if the security scheme is supported by go-raml

func ValidateScheme

func ValidateScheme(name string, apiDef *raml.APIDefinition) bool

validate security scheme: - not empty - not 'null' - oauth2 -> we only support oauth2 now

Types

type Security

type Security struct {
	*raml.SecurityScheme
	Name        string
	PackageName string
	Headers     []*raml.Header
	QueryParams []*raml.NamedParameter
}

security define a security scheme, we only support oauth2 now. we generate middleware that checking for oauth2 credential

func New

func New(ss raml.SecurityScheme, name, packageName string) Security

New creates a security struct

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL