HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux ns3133907 6.8.0-86-generic #87-Ubuntu SMP PREEMPT_DYNAMIC Mon Sep 22 18:03:36 UTC 2025 x86_64
User: cssnetorguk (1024)
PHP: 8.2.28
Disabled: NONE
Upload Files
File: //proc/self/root/lib/ruby/gems/3.2.0/gems/net-imap-0.3.4.1/lib/net/imap/authenticators/xoauth2.rb
# frozen_string_literal: true

class Net::IMAP::XOauth2Authenticator
  def process(_data)
    build_oauth2_string(@user, @oauth2_token)
  end

  private

  def initialize(user, oauth2_token)
    @user = user
    @oauth2_token = oauth2_token
  end

  def build_oauth2_string(user, oauth2_token)
    format("user=%s\1auth=Bearer %s\1\1", user, oauth2_token)
  end

  Net::IMAP.add_authenticator 'XOAUTH2', self
end