Commit aada3558f34ca0a368efe61f293f4ff9d9cff5c6

Authored by Joshua Azemoh
Committed by Raphael Akpan
1 parent 0ca435b0
Exists in master

Rename auth variables

app/controllers/scim_rails/application_controller.rb
@@ -9,10 +9,10 @@ module ScimRails @@ -9,10 +9,10 @@ module ScimRails
9 private 9 private
10 10
11 def authorize_request 11 def authorize_request
12 - send(authentication_strategy) do |username, password| 12 + send(authentication_strategy) do |searchable_attribute, authentication_attribute|
13 authorization = AuthorizeApiRequest.new( 13 authorization = AuthorizeApiRequest.new(
14 - searchable_attribute: username,  
15 - authentication_attribute: password 14 + searchable_attribute: searchable_attribute,
  15 + authentication_attribute: authentication_attribute
16 ) 16 )
17 @company = authorization.company 17 @company = authorization.company
18 end 18 end
@@ -28,11 +28,11 @@ module ScimRails @@ -28,11 +28,11 @@ module ScimRails
28 end 28 end
29 29
30 def authenticate_with_oauth_bearer 30 def authenticate_with_oauth_bearer
31 - token = request.headers["Authorization"].split(" ").last  
32 - payload = ScimRails::Encoder.decode(token).with_indifferent_access 31 + authentication_attribute = request.headers["Authorization"].split(" ").last
  32 + payload = ScimRails::Encoder.decode(authentication_attribute).with_indifferent_access
33 searchable_attribute = payload[ScimRails.config.basic_auth_model_searchable_attribute] 33 searchable_attribute = payload[ScimRails.config.basic_auth_model_searchable_attribute]
34 34
35 - yield searchable_attribute, token 35 + yield searchable_attribute, authentication_attribute
36 end 36 end
37 end 37 end
38 end 38 end