Sha256: 1ba7cd0754475f7b568fa5c5084c2183fd0e34936690d69f10dcc2280209453d

Contents?: true

Size: 643 Bytes

Versions: 7

Compression:

Stored size: 643 Bytes

Contents

require 'devise_oauth2_providable/strategies/oauth2_grant_type_strategy'

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

      def authenticate!
        if client && code = AuthorizationCode.valid.find_by_token(params[:code])
          success! code.user
        elsif !halted?
          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

7 entries across 7 versions & 1 rubygems

Version Path
devise_oauth2_providable-0.3.8 lib/devise_oauth2_providable/strategies/oauth2_authorization_code_grant_type_strategy.rb
devise_oauth2_providable-0.3.7 lib/devise_oauth2_providable/strategies/oauth2_authorization_code_grant_type_strategy.rb
devise_oauth2_providable-0.3.6 lib/devise_oauth2_providable/strategies/oauth2_authorization_code_grant_type_strategy.rb
devise_oauth2_providable-0.3.5 lib/devise_oauth2_providable/strategies/oauth2_authorization_code_grant_type_strategy.rb
devise_oauth2_providable-0.3.4 lib/devise_oauth2_providable/strategies/oauth2_authorization_code_grant_type_strategy.rb
devise_oauth2_providable-0.3.3 lib/devise_oauth2_providable/strategies/oauth2_authorization_code_grant_type_strategy.rb
devise_oauth2_providable-0.3.2 lib/devise_oauth2_providable/strategies/oauth2_authorization_code_grant_type_strategy.rb