@@ -18,25 +18,23 @@ def authorization_url
1818 end
1919
2020 def load_identity ( **params )
21- response = OneLogin ::RubySaml ::Response . new ( params [ :SAMLResponse ] , { **config [ :response_settings ] , settings : create_settings } )
21+ response = OneLogin ::RubySaml ::Response . new ( params [ :SAMLResponse ] ,
22+ { **config [ :response_settings ] , settings : create_settings } )
2223 attributes = response . attributes
2324
2425 Identity . new ( config [ :provider_name ] ,
2526 response . name_id ,
2627 find_attribute ( attributes , config [ :attribute_statements ] [ :username ] ) ,
2728 find_attribute ( attributes , config [ :attribute_statements ] [ :email ] ) ,
2829 find_attribute ( attributes , config [ :attribute_statements ] [ :firstname ] ) ,
29- find_attribute ( attributes , config [ :attribute_statements ] [ :lastname ] )
30- )
30+ find_attribute ( attributes , config [ :attribute_statements ] [ :lastname ] ) )
3131 end
3232
3333 private
3434
3535 def find_attribute ( attributes , attribute_statements )
3636 attribute_statements . each do |statement |
37- unless attributes [ statement ] . nil?
38- return attributes [ statement ]
39- end
37+ return attributes [ statement ] unless attributes [ statement ] . nil?
4038 end
4139 nil
4240 end
@@ -59,10 +57,9 @@ def create_settings
5957
6058 def config
6159 config = config_loader
62- if config_loader . is_a? ( Proc )
63- config = config_loader . call
64- end
60+ config = config_loader . call if config_loader . is_a? ( Proc )
6561
62+ # rubocop:disable Layout/LineLength
6663 config [ :provider_name ] ||= :saml
6764 config [ :response_settings ] ||= { }
6865 config [ :settings ] ||= { }
@@ -71,10 +68,11 @@ def config
7168 config [ :attribute_statements ] [ :email ] ||= %w[ email mail http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress http://schemas.microsoft.com/ws/2008/06/identity/claims/emailaddress ]
7269 config [ :attribute_statements ] [ :firstname ] ||= %w[ first_name firstname firstName http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname http://schemas.microsoft.com/ws/2008/06/identity/claims/givenname ]
7370 config [ :attribute_statements ] [ :lastname ] ||= %w[ last_name lastname lastName http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname http://schemas.microsoft.com/ws/2008/06/identity/claims/surname ]
71+ # rubocop:enable Layout/LineLength
7472
7573 config
7674 end
7775 end
7876 end
7977 end
80- end
78+ end
0 commit comments