Module: Jsapi::Controller::Authentication
- Defined in:
- lib/jsapi/controller/authentication.rb,
lib/jsapi/controller/authentication/credentials.rb,
lib/jsapi/controller/authentication/class_methods.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
The Authentication add-on.
class FooController < Jsapi::Controller::Base
include Jsapi::Controller::Authentication
api_authenticate 'basic_auth' do |credentials|
# Implement authentication handler here
end
api_security_scheme 'basic_auth', type: 'http', scheme: 'basic'
api_security_requirement do
scheme 'basic_auth'
end
end
Defined Under Namespace
Modules: ClassMethods, Credentials
Class Method Summary collapse
-
.included(base) ⇒ Object
:nodoc:.
Instance Method Summary collapse
-
#api_authenticated?(operation_name = nil) ⇒ Boolean
Returns true if and only if the current request satisfies at least one of the security requirements applied to the specified operation.
Class Method Details
.included(base) ⇒ Object
:nodoc:
24 25 26 |
# File 'lib/jsapi/controller/authentication.rb', line 24 def self.included(base) # :nodoc: base.extend(ClassMethods) end |
Instance Method Details
#api_authenticated?(operation_name = nil) ⇒ Boolean
Returns true if and only if the current request satisfies at least one of the security requirements applied to the specified operation. A security requirement is satisfied if it is empty ({}) or all of the referred security schemes are satisfied.
operation_name can be omitted if the controller handles one operation only. If the operation isn’t defined, an OperationNotDefined exception is raised.
35 36 37 |
# File 'lib/jsapi/controller/authentication.rb', line 35 def api_authenticated?(operation_name = nil) _api_authenticated?(_api_operation(operation_name)) end |