Sha256: 9a73dd7712cb48227baec5b54e2ca9162a74b638afb3458cdb447be8a06293ea
Contents?: true
Size: 739 Bytes
Versions: 4
Compression:
Stored size: 739 Bytes
Contents
require 'devise/oauth2_providable/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 resource && 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
4 entries across 4 versions & 1 rubygems