lib/gds-sso/warden_config.rb in gds-sso-0.7.6 vs lib/gds-sso/warden_config.rb in gds-sso-0.7.7
- old
+ new
@@ -1,6 +1,7 @@
require 'warden'
+require 'gds-sso/user'
Warden::Manager.serialize_into_session do |user|
user.respond_to?(:uid) ? user.uid : nil
end
@@ -49,11 +50,11 @@
return custom!(unauthorized) unless auth.provided?
return fail!(:bad_request) unless auth.basic?
if valid_api_user?(*auth.credentials)
- success!(auth.credentials[0])
+ success!(api_user)
else
custom!(unauthorized)
end
end
@@ -102,8 +103,8 @@
::GDS::SSO::ApiAccess.api_call?(env)
end
def authenticate!
Rails.logger.debug("Authenticating with mock_gds_sso_api_access strategy")
- success!(GDS::SSO.test_user || GDS::SSO::Config.user_klass.first)
+ success!(GDS::SSO::ApiUser.new)
end
end