Module: Devise::Models::JiraAuthenticable::ClassMethods

Defined in:
lib/devise/models/jira_authenticable.rb

Instance Method Summary collapse

Instance Method Details

#find_for_jira_authentication(authentication_hash) ⇒ Object

Invoked by the JiraAuthenticatable strategy to perform the authentication against the JIRA server. The username is extracted from the authentication hash. We then search for an existing resource using the username. If no resource is found, a new resource is built (not created). If authentication is successful the callback is responsible for saving the resource. Returns the resource if authentication succeeds and nil if it does not.



79
80
81
82
83
84
85
# File 'lib/devise/models/jira_authenticable.rb', line 79

def find_for_jira_authentication(authentication_hash)
  username, password = authentication_hash[:username], authentication_hash[:password]

  resource = find_for_authentication( username: username )

  resource&.valid_jira_password?(password) ? resource : nil
end