lib/gds-sso/warden_config.rb in gds-sso-0.4.2 vs lib/gds-sso/warden_config.rb in gds-sso-0.4.3
- old
+ new
@@ -44,15 +44,10 @@
end
def authenticate!
Rails.logger.debug("Authenticating with gds_sso_api_access strategy")
- if ! basic_auth_configured?
- Rails.logger.debug("Basic auth not configured, not requiring authentication")
- success!(api_user)
- end
-
auth = Rack::Auth::Basic::Request.new(env)
return custom!(unauthorized) unless auth.provided?
return fail!(:bad_request) unless auth.basic?
@@ -61,14 +56,10 @@
else
custom!(unauthorized)
end
end
- def basic_auth_configured?
- ! ::GDS::SSO::Config.basic_auth_user.nil?
- end
-
def valid_api_user?(username, password)
username.to_s.strip != '' &&
password.to_s.strip != '' &&
username == ::GDS::SSO::Config.basic_auth_user &&
password == ::GDS::SSO::Config.basic_auth_password
@@ -91,10 +82,10 @@
def valid?
! ::GDS::SSO::ApiAccess.api_call?(env)
end
def authenticate!
- Rails.logger.debug("Authenticating with mock_gds_sso strategy")
+ Rails.logger.warn("Authenticating with mock_gds_sso strategy")
test_user = GDS::SSO.test_user || GDS::SSO::Config.user_klass.first
if test_user
success!(test_user)
else
raise "GDS-SSO running in mock mode and no test user found. Normally we'd load the first user in the database. Create a user in the database."