Sha256: c1a31cf2cbced9b6e8b02319d9f3cec7a3631ae80290445ec3b7b8954ec8983a

Contents?: true

Size: 561 Bytes

Versions: 3

Compression:

Stored size: 561 Bytes

Contents

module Doorkeeper
  module OAuth
    module Helpers
      module ScopeChecker
        def self.valid?(scope_str, server_scopes, application_scopes = nil)
          valid_scopes = if application_scopes.present?
                           server_scopes & application_scopes
                         else
                           server_scopes
                         end

          scope_str.present? &&
            scope_str !~ /[\n|\r|\t]/ &&
            valid_scopes.has_scopes?(OAuth::Scopes.from_string(scope_str))
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
doorkeeper-2.1.2 lib/doorkeeper/oauth/helpers/scope_checker.rb
doorkeeper-2.1.1 lib/doorkeeper/oauth/helpers/scope_checker.rb
doorkeeper-2.1.0 lib/doorkeeper/oauth/helpers/scope_checker.rb