Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F97580565
README
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Jan 5, 10:46
Size
2 KB
Mime Type
text/x-python
Expires
Tue, Jan 7, 10:46 (2 d)
Engine
blob
Format
Raw Data
Handle
23430566
Attached To
R6833 Tequila Ruby client
README
View Options
= TequilaAuthentication plugin
Authenticating users against the EPFL's[http://www.epfl.ch]
Tequila Authentication API (see http://tequila.epfl.ch)
=====================
=== How to mix-in.
This module gets mixed in a Controller when calling 'allow_tequila_login'.
=== Example
class MyTequilaController < ApplicationController
# The Tequila coniguration to be used for this Controller.
TEQUILA_CONFIG =
TequilaConfig.new(:server => 'my_tequila.server.org',
:port => 1234,
:requested_infos => { :service => "My service",
:request => "firstname,name,uniqueid",
:allows => "category=guest" })
#
# Mix-in the TequilaAuthentication plugin code.
allow_tequila_login
#
# Protect some actions.
before_filter :my_protect_actions_filter,
:only => [:protected_action1, :protected_action2]
#
# Some unprotected Rails action
def not_protected_action
# Put the action's code here ...
end
#
# A protected Rails action
def protected_action1
# Put the action's code here ...
end
#
# Another protected Rails action
def protected_action2
# Put the action's code here ...
end
private
#
# Method used to retrieve the Tequila Configuration.
# MUST BE IMPLEMENTED !
def tequila_configuration
TEQUILA_CONFIG
end
# The filter used to protect actions.
def my_protect_actions_filter
# If the user is already logged, skip the filters and go to the action.
return true unless session[:user_id].nil?
# Perform the tequila login
return false unless private_tequila_login
# Gather the user's informations received from the Tequila service.
tequila_user_infos = session[:tequila_user_infos]
# Start a new HTTP Session
reset_session
session[:user_id] = tequila_user_infos[:uniqueid]
# Process the other Tequila informations asked for ...
# Some more code here ...
# Continue processing the other filters/the action.
true
end
end
=== HTML Documentation
It can be generated with:
rake doc:plugins:tequila_authentication
See 'rake -T' for more informations.
=== Testing
Nothing special. You can use from your application's top level
directory (Unix commands):
( cd vendor/plugins/tequila_authentication/ && rake )
or
rake test:plugins PLUGIN=tequila_authentication
Event Timeline
Log In to Comment