Class: Devise::Strategies::Oauth2PasswordGrantTypeStrategy

Inherits:
Oauth2GrantTypeStrategy show all
Defined in:
lib/devise/oauth2_providable/strategies/oauth2_password_grant_type_strategy.rb

Instance Method Summary collapse

Methods inherited from Oauth2GrantTypeStrategy

#authenticate!, #oauth_error!, #valid?

Instance Method Details

#authenticate_grant_type(client) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/devise/oauth2_providable/strategies/oauth2_password_grant_type_strategy.rb', line 10

def authenticate_grant_type(client)
  resource = mapping.to.find_for_authentication(mapping.to.authentication_keys.first => params[:username])
  if resource && validate(resource) { resource.valid_password?(params[:password]) }
    success! resource
  else
    oauth_error! :invalid_grant, 'invalid password authentication request'
  end
end

#grant_typeObject



6
7
8
# File 'lib/devise/oauth2_providable/strategies/oauth2_password_grant_type_strategy.rb', line 6

def grant_type
  'password'
end