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
#agent, #agents, #anonymous?, #authenticated?, #authorized_to_act_as_superuser?, #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 |
# File 'lib/ddr/auth/web_auth_context.rb', line 13 def affiliation split_env("affiliation").map { |a| a.sub(/@duke\.edu\z/, "") } 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>
18 19 20 |
# File 'lib/ddr/auth/web_auth_context.rb', line 18 def ismemberof split_env("ismemberof") end |