Class: Bosh::Director::Api::LocalIdentityProvider

Inherits:
Object
  • Object
show all
Defined in:
lib/bosh/director/api/local_identity_provider.rb

Instance Method Summary collapse

Constructor Details

#initialize(*_) ⇒ LocalIdentityProvider

Returns a new instance of LocalIdentityProvider.



5
6
7
# File 'lib/bosh/director/api/local_identity_provider.rb', line 5

def initialize(*_)
  @user_manager = Bosh::Director::Api::UserManager.new
end

Instance Method Details

#client_infoObject



9
10
11
# File 'lib/bosh/director/api/local_identity_provider.rb', line 9

def client_info
  {'type' => 'basic', 'options' => {}}
end

#corroborate_user(request_env) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/bosh/director/api/local_identity_provider.rb', line 13

def corroborate_user(request_env)
  auth ||= Rack::Auth::Basic::Request.new(request_env)
  raise AuthenticationError unless auth.provided? && auth.basic? && auth.credentials

  if @user_manager.authenticate(*auth.credentials)
    auth.credentials.first
  else
    raise AuthenticationError
  end
end