Module: Devise::Models::SamlAuthenticatable::ClassMethods
- Includes:
- DeviseSamlAuthenticatable::SamlConfig
- Defined in:
- lib/devise_saml_authenticatable/model.rb
Instance Method Summary collapse
- #attribute_map ⇒ Object
- #authenticate_with_saml(attributes) ⇒ Object
- #find_for_shibb_authentication(conditions) ⇒ Object
Methods included from DeviseSamlAuthenticatable::SamlConfig
Instance Method Details
#attribute_map ⇒ Object
54 55 56 |
# File 'lib/devise_saml_authenticatable/model.rb', line 54 def attribute_map @attribute_map ||= YAML.load(File.read("#{Rails.root}/config/attribute-map.yml")) end |
#authenticate_with_saml(attributes) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/devise_saml_authenticatable/model.rb', line 29 def authenticate_with_saml(attributes) key = Devise.saml_default_user_key inv_attr = attribute_map.invert auth_value = attributes[inv_attr[key.to_s]] auth_value.try(:downcase!) if Devise.case_insensitive_keys.include?(key) resource = where(key => auth_value).first if (resource.nil? && !Devise.saml_create_user) logger.info("User(#{attributes[inv_attr[key.to_s]]}) not found. Not configured to create the user.") return nil end if (resource.nil? && Devise.saml_create_user) logger.info("Creating user(#{attributes[inv_attr[key.to_s]]}).") resource = new set_user_saml_attributes(resource,attributes) resource.save! end resource end |
#find_for_shibb_authentication(conditions) ⇒ Object
50 51 52 |
# File 'lib/devise_saml_authenticatable/model.rb', line 50 def find_for_shibb_authentication(conditions) find_for_authentication(conditions) end |