class Bosh::Director::Api::LocalIdentityProvider

Public Class Methods

new(options) click to toggle source
# File lib/bosh/director/api/local_identity_provider.rb, line 9
def initialize(options)
  users = options.fetch('users', [])
  @user_manager = Bosh::Director::Api::UserManagerProvider.new.user_manager(users)
end

Public Instance Methods

client_info() click to toggle source
# File lib/bosh/director/api/local_identity_provider.rb, line 17
def client_info
  {'type' => 'basic', 'options' => {}}
end
get_user(request_env, _) click to toggle source
# File lib/bosh/director/api/local_identity_provider.rb, line 21
def get_user(request_env, _)
  auth ||= Rack::Auth::Basic::Request.new(request_env)
  raise AuthenticationError unless auth.provided? && auth.basic? && auth.credentials

  unless @user_manager.authenticate(*auth.credentials)
    raise AuthenticationError
  end

  LocalUser.new(*auth.credentials)
end