Sha256: 839c619c14afb9f3e227ab9a5d4460af48489d2db26c6a6c19a30eae006e9078

Contents?: true

Size: 716 Bytes

Versions: 17

Compression:

Stored size: 716 Bytes

Contents

require 'devise/oauth2/strategies/oauth2_grant_type_strategy'

module Devise
  module Strategies
    class Oauth2PasswordGrantTypeStrategy < Oauth2GrantTypeStrategy
      def grant_type
        'password'
      end

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

Warden::Strategies.add(:oauth2_password_grantable, Devise::Strategies::Oauth2PasswordGrantTypeStrategy)

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
devise_oauth2_rails4-2.1.8 lib/devise/oauth2/strategies/oauth2_password_grant_type_strategy.rb
devise_oauth2_rails4-2.1.7 lib/devise/oauth2/strategies/oauth2_password_grant_type_strategy.rb
devise_oauth2_rails4-2.1.6 lib/devise/oauth2/strategies/oauth2_password_grant_type_strategy.rb
devise_oauth2_rails4-2.1.5 lib/devise/oauth2/strategies/oauth2_password_grant_type_strategy.rb
devise_oauth2_rails4-2.1.4 lib/devise/oauth2/strategies/oauth2_password_grant_type_strategy.rb
devise_oauth2_rails4-2.1.3 lib/devise/oauth2/strategies/oauth2_password_grant_type_strategy.rb
devise_oauth2_rails4-2.0.3 lib/devise/oauth2/strategies/oauth2_password_grant_type_strategy.rb
devise_oauth2_rails4-2.1.0 lib/devise/oauth2/strategies/oauth2_password_grant_type_strategy.rb
devise_oauth2_rails4-2.0.2 lib/devise/oauth2/strategies/oauth2_password_grant_type_strategy.rb
devise_oauth2_rails4-2.0.1 lib/devise/oauth2/strategies/oauth2_password_grant_type_strategy.rb
devise_oauth2_rails4-2.0.0 lib/devise/oauth2/strategies/oauth2_password_grant_type_strategy.rb
devise_oauth2_rails4-1.1.8 lib/devise/oauth2/strategies/oauth2_password_grant_type_strategy.rb
devise_oauth2_rails4-1.1.7 lib/devise/oauth2/strategies/oauth2_password_grant_type_strategy.rb
devise_oauth2_rails4-1.1.6 lib/devise/oauth2/strategies/oauth2_password_grant_type_strategy.rb
devise_oauth2_rails4-1.1.5 lib/devise/oauth2/strategies/oauth2_password_grant_type_strategy.rb
devise_oauth2_rails4-1.1.4 lib/devise/oauth2/strategies/oauth2_password_grant_type_strategy.rb
devise_oauth2_rails4-1.1.3 lib/devise/oauth2/strategies/oauth2_password_grant_type_strategy.rb