Class: Operaton::Bpm::Client::Interceptor::Auth::BasicAuthProvider
- Inherits:
-
Object
- Object
- Operaton::Bpm::Client::Interceptor::Auth::BasicAuthProvider
- Includes:
- ClientRequestInterceptor
- Defined in:
- lib/operaton/bpm/client/interceptor/auth/basic_auth_provider.rb
Overview
Mirrors org.operaton.bpm.client.interceptor.auth.BasicAuthProvider
Constant Summary collapse
- AUTHORIZATION =
"Authorization"
Instance Method Summary collapse
-
#initialize(username, password) ⇒ BasicAuthProvider
constructor
A new instance of BasicAuthProvider.
- #intercept(request_context) ⇒ Object
Constructor Details
#initialize(username, password) ⇒ BasicAuthProvider
Returns a new instance of BasicAuthProvider.
18 19 20 21 22 23 24 25 |
# File 'lib/operaton/bpm/client/interceptor/auth/basic_auth_provider.rb', line 18 def initialize(username, password) if username.nil? || password.nil? raise Client::Impl::ExternalTaskClientLogger.client_logger.basic_auth_credentials_null_exception end @username = username @password = password end |
Instance Method Details
#intercept(request_context) ⇒ Object
27 28 29 30 |
# File 'lib/operaton/bpm/client/interceptor/auth/basic_auth_provider.rb', line 27 def intercept(request_context) auth_token = "#{@username}:#{@password}" request_context.add_header(AUTHORIZATION, "Basic #{encode_to_base64(auth_token)}") end |