class Doorkeeper::OAuth::Scopes

def dynamic_scope_match?(allowed, requested)

def dynamic_scope_match?(allowed, requested)
  allowed_pattern = allowed.split(dynamic_scope_delimiter, 2)
  request_pattern = requested.split(dynamic_scope_delimiter, 2)
  return false if allowed_pattern[0] != request_pattern[0]
  return false if allowed_pattern[1].blank?
  return false if request_pattern[1].blank?
  return true  if allowed_pattern[1] == DYNAMIC_SCOPE_WILDCARD && allowed_pattern[1].present?
  allowed_pattern[1] == request_pattern[1]
end