Sha256: 61087090e42fa38c91d81c73a6fe2ffe0a04f59b922b486498e514f60d714907

Contents?: true

Size: 941 Bytes

Versions: 4

Compression:

Stored size: 941 Bytes

Contents

module OAuth2
  module Strategy
    # The Resource Owner Password Credentials Authorization Strategy
    #
    # @see http://tools.ietf.org/html/draft-ietf-oauth-v2-15#section-4.3
    class Password < Base
      # Not used for this strategy
      #
      # @raise [NotImplementedError]
      def authorize_url
        raise(NotImplementedError, 'The authorization endpoint is not used in this strategy')
      end

      # Retrieve an access token given the specified End User username and password.
      #
      # @param [String] username the End User username
      # @param [String] password the End User password
      # @param [Hash] params additional params
      def get_token(username, password, params = {}, opts = {})
        params = {'grant_type' => 'password',
                  'username' => username,
                  'password' => password}.merge(params)
        @client.get_token(params, opts)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
oauth2-1.4.8 lib/oauth2/strategy/password.rb
oauth2-1.4.7 lib/oauth2/strategy/password.rb
oauth2-1.4.6 lib/oauth2/strategy/password.rb
oauth2-1.4.5 lib/oauth2/strategy/password.rb