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(saml_response) ⇒ Object
- #find_for_shibb_authentication(conditions) ⇒ Object
- #reset_session_key_for(name_id) ⇒ Object
Methods included from DeviseSamlAuthenticatable::SamlConfig
Instance Method Details
#attribute_map ⇒ Object
81 82 83 |
# File 'lib/devise_saml_authenticatable/model.rb', line 81 def attribute_map @attribute_map ||= attribute_map_for_environment end |
#authenticate_with_saml(saml_response) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/devise_saml_authenticatable/model.rb', line 43 def authenticate_with_saml(saml_response) key = Devise.saml_default_user_key attributes = saml_response.attributes if (Devise.saml_use_subject) auth_value = saml_response.name_id else inv_attr = attribute_map.invert auth_value = attributes[inv_attr[key.to_s]] auth_value.try(:downcase!) if Devise.case_insensitive_keys.include?(key) end resource = where(key => auth_value).first if (resource.nil? && !Devise.saml_create_user) logger.info("User(#{auth_value}) not found. Not configured to create the user.") return nil end if (resource.nil? && Devise.saml_create_user) logger.info("Creating user(#{auth_value}).") resource = new set_user_saml_attributes(resource,attributes) if (Devise.saml_use_subject) resource.send "#{key}=", auth_value end resource.save! end resource end |
#find_for_shibb_authentication(conditions) ⇒ Object
77 78 79 |
# File 'lib/devise_saml_authenticatable/model.rb', line 77 def find_for_shibb_authentication(conditions) find_for_authentication(conditions) end |
#reset_session_key_for(name_id) ⇒ Object
72 73 74 75 |
# File 'lib/devise_saml_authenticatable/model.rb', line 72 def reset_session_key_for(name_id) resource = find_by(Devise.saml_default_user_key => name_id) resource.update_attribute(Devise.saml_session_index_key, nil) unless resource.nil? end |