Sha256: 1ca72e9e8e1e9a80db434f6a11fbcbdfd6c9886a4420184bb6a7810cd2054e7e

Contents?: true

Size: 633 Bytes

Versions: 17

Compression:

Stored size: 633 Bytes

Contents

require 'devise/oauth2/strategies/oauth2_grant_type_strategy'

module Devise
  module Strategies
    class Oauth2AuthorizationCodeGrantTypeStrategy < Oauth2GrantTypeStrategy
      def grant_type
        'authorization_code'
      end

      def authenticate_grant_type(client)
        if code = client.authorization_codes.find_by_token(params[:code])
          success! code.user
        else
          oauth_error! :invalid_grant, 'invalid authorization code request'
        end
      end
    end
  end
end

Warden::Strategies.add(:oauth2_authorization_code_grantable, Devise::Strategies::Oauth2AuthorizationCodeGrantTypeStrategy)

Version data entries

17 entries across 17 versions & 1 rubygems

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