Sha256: 10a5d272a420d5946e1e479c9755fbfd18abedf090c5b5e008a37ed77025bc8d

Contents?: true

Size: 472 Bytes

Versions: 1

Compression:

Stored size: 472 Bytes

Contents

# frozen_string_literal: true

require "base64"

module Mountapi::Adapters
  class UserInfoAdapter
    def initialize(header_name, options)
      @header_name = header_name
      @options = options
    end

    def call(params, roles)
      roles_key = options[:roles]
      user_info = JSON.parse(Base64.decode64(params[header_name]))

      user_info[roles_key].any? { |role| roles.include?(role) }
    end

    private

    attr_reader :header_name, :options
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mountapi-0.11.1 lib/mountapi/adapters/user_info_adapter.rb