Class: Shaf::Authenticator::BasicAuth
- Defined in:
- lib/shaf/authenticator/basic_auth.rb
Class Method Summary collapse
Methods inherited from Base
challenges_for, inherited, param, params, restricted, scheme, scheme?, user
Class Method Details
.credentials(authorization, _request) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/shaf/authenticator/basic_auth.rb', line 9 def self.credentials(, _request) return unless decoded = String(.unpack("m*").first) return {} if decoded.empty? user, password = decoded.split(/:/, 2) .map { |str| str unless String(str).empty? } { user: user, password: password } end |