Class: Ddr::Auth::WebAuthContext
- Inherits:
-
AuthContext
- Object
- AuthContext
- Ddr::Auth::WebAuthContext
- Defined in:
- lib/ddr/auth/web_auth_context.rb
Instance Attribute Summary
Attributes inherited from AuthContext
Instance Method Summary collapse
- #affiliation ⇒ Array<String>
-
#ip_address ⇒ String
The IP address, or nil.
- #ismemberof ⇒ Array<String>
Methods inherited from AuthContext
#ability, #agent, #agents, #anonymous?, #authenticated?, #authorized_to_act_as_superuser?, #default_ability_class, #duke_agent?, #groups, #initialize, #member_of?, #superuser?
Constructor Details
This class inherits a constructor from Ddr::Auth::AuthContext
Instance Method Details
#affiliation ⇒ Array<String>
13 14 15 16 17 18 19 |
# File 'lib/ddr/auth/web_auth_context.rb', line 13 def affiliation if anonymous? super else split_env("affiliation").map { |a| a.sub(/@duke\.edu\z/, "") } end end |
#ip_address ⇒ String
Returns the IP address, or nil.
6 7 8 9 10 |
# File 'lib/ddr/auth/web_auth_context.rb', line 6 def ip_address if middleware = env["action_dispatch.remote_ip"] middleware.calculate_ip end end |
#ismemberof ⇒ Array<String>
22 23 24 |
# File 'lib/ddr/auth/web_auth_context.rb', line 22 def ismemberof anonymous? ? super : split_env("isMemberOf") end |