Page Menu
Home
GRNET
Search
Configure Global Search
Log In
Files
F904949
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Aug 29, 6:03 PM
Size
1 KB
Mime Type
text/x-diff
Expires
Sun, Aug 31, 6:03 PM (1 d, 5 h)
Engine
blob
Format
Raw Data
Handle
252346
Attached To
rARCHIVING archiving
View Options
diff --git a/lib/peter/strategies/institutional.rb b/lib/peter/strategies/institutional.rb
index 15be532..e77318c 100644
--- a/lib/peter/strategies/institutional.rb
+++ b/lib/peter/strategies/institutional.rb
@@ -1,43 +1,44 @@
Warden::Strategies.add(:institutional) do
def valid?
Rails.logger.warn("WARDEN: INFO institutional")
+ Rails.logger.warn("WARDEN: INFO *********************************** env: #{request.env}")
['HTTP_REMOTE_USER', 'HTTP_MAIL', 'HTTP_ENTITLEMENT'].each do |h|
Rails.logger.warn("WARDEN: **************** HEADER: #{h} \t value: #{fetch_header(h)}")
end
fetch_header('HTTP_REMOTE_USER').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_REMOTE_USER")}"
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
Log In to Comment