Sha256: 8bfb5c08dc47d8c851bbd7da8b907ba18f825916bb33c522b26b470301f08429
Contents?: true
Size: 1.03 KB
Versions: 3
Compression:
Stored size: 1.03 KB
Contents
# frozen_string_literal: true module Doorkeeper module OAuth module Helpers module ScopeChecker class Validator attr_reader :parsed_scopes, :scope_str def initialize(scope_str, server_scopes, application_scopes) @parsed_scopes = OAuth::Scopes.from_string(scope_str) @scope_str = scope_str @valid_scopes = valid_scopes(server_scopes, application_scopes) end def valid? scope_str.present? && scope_str !~ /[\n\r\t]/ && @valid_scopes.has_scopes?(parsed_scopes) end private def valid_scopes(server_scopes, application_scopes) if application_scopes.present? application_scopes else server_scopes end end end def self.valid?(scope_str, server_scopes, application_scopes = nil) Validator.new(scope_str, server_scopes, application_scopes).valid? end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems