Module: Jsapi::Controller::Authentication::Credentials
- Defined in:
- lib/jsapi/controller/authentication/credentials.rb,
lib/jsapi/controller/authentication/credentials/api_key.rb,
lib/jsapi/controller/authentication/credentials/http/base.rb,
lib/jsapi/controller/authentication/credentials/http/basic.rb,
lib/jsapi/controller/authentication/credentials/http/bearer.rb
Overview
Provides classes to pass credentials to an authentication handler.
Defined Under Namespace
Class Method Summary collapse
-
.create(request, security_scheme) ⇒ Object
Creates credentials from
requestaccording to the specified security scheme.
Class Method Details
.create(request, security_scheme) ⇒ Object
Creates credentials from request according to the specified security scheme.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/jsapi/controller/authentication/credentials.rb', line 14 def create(request, security_scheme) case security_scheme when Meta::SecurityScheme::APIKey name = security_scheme.name APIKey.new( case security_scheme.in when 'header' request.headers[name] when 'query' request.query_parameters[name] end ) when Meta::SecurityScheme::HTTP::Basic HTTP::Basic.new(request.) when Meta::SecurityScheme::HTTP::Bearer HTTP::Bearer.new(request.) when Meta::SecurityScheme::HTTP::Other HTTP::Base.new(request.) end end |