Page MenuHomeGRNET

No OneTemporary

File Metadata

Created
Thu, Apr 3, 4:46 AM
diff --git a/lib/peter/strategies/institutional.rb b/lib/peter/strategies/institutional.rb
index 57851fd..6ae7a3f 100644
--- a/lib/peter/strategies/institutional.rb
+++ b/lib/peter/strategies/institutional.rb
@@ -1,38 +1,40 @@
Warden::Strategies.add(:institutional) do
def valid?
+ Rails.logger.warn("WARDEN: INFO institutional")
fetch_header('HTTP_PERSISTENT_ID').present? &&
fetch_header('HTTP_MAIL').present? &&
fetch_header('HTTP_ENTITLEMENT').present? &&
fetch_header('HTTP_ENTITLEMENT').include?('urn:mace:grnet.gr:archiving:admin')
end
def fetch_header(header)
request.env[header]
end
def authenticate!
+ Rails.logger.warn("WARDEN: INFO institutional has valid headers")
if !Archiving.settings[:institutional_authentication_enabled]
return fail!("Shibboleth is temporarily disabled")
end
identifier = "institutional:#{fetch_header("HTTP_PERSISTENT_ID")}"
user = User.find_or_initialize_by(identifier: identifier)
return fail!("Wrong credentials") unless user
user.login_at = Time.now
if user.new_record?
user.email = fetch_header("HTTP_MAIL")
user.username = fetch_header("HTTP_MAIL")
user.enabled = true
user.institutional!
else
user.save
end
return fail!("Service not available") unless user.enabled?
success!(user)
end
end

Event Timeline