Esempio n. 1
0
// AuthenticatorsFor gets the authenticators for the specified security schemes
func (o *TaskTrackerAPI) AuthenticatorsFor(schemes map[string]spec.SecurityScheme) map[string]runtime.Authenticator {

	result := make(map[string]runtime.Authenticator)
	for name, scheme := range schemes {
		switch name {

		case "api_key":

			result[name] = security.APIKeyAuth(scheme.Name, scheme.In, o.APIKeyAuth)

		case "token_header":

			result[name] = security.APIKeyAuth(scheme.Name, scheme.In, o.TokenHeaderAuth)

		}
	}
	return result

}
Esempio n. 2
0
// AuthenticatorsFor gets the authenticators for the specified security schemes
func (o *TodoListAPI) AuthenticatorsFor(schemes map[string]spec.SecurityScheme) map[string]runtime.Authenticator {

	result := make(map[string]runtime.Authenticator)
	for name, scheme := range schemes {
		switch name {

		case "key":

			result[name] = security.APIKeyAuth(scheme.Name, scheme.In, o.KeyAuth)

		}
	}
	return result

}
Esempio n. 3
0
// AuthenticatorsFor gets the authenticators for the specified security schemes
func (o *PetstoreAPI) AuthenticatorsFor(schemes map[string]spec.SecurityScheme) map[string]runtime.Authenticator {

	result := make(map[string]runtime.Authenticator)
	for name, scheme := range schemes {
		switch name {

		case "api_key":

			result[name] = security.APIKeyAuth(scheme.Name, scheme.In, o.APIKeyAuth)

		case "petstore_auth":

			result[name] = security.BearerAuth(scheme.Name, o.PetstoreAuthAuth)

		}
	}
	return result

}