Sha256: 5cc192420cfe60b901c8a217d54a5ad3a17cdb3805a835363c7e6512736a69aa

Contents?: true

Size: 413 Bytes

Versions: 5

Compression:

Stored size: 413 Bytes

Contents

# 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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
net-imap-0.3.4.1 lib/net/imap/authenticators/xoauth2.rb
net-imap-0.3.4 lib/net/imap/authenticators/xoauth2.rb
net-imap-0.3.3 lib/net/imap/authenticators/xoauth2.rb
net-imap-0.3.2 lib/net/imap/authenticators/xoauth2.rb
net-imap-0.3.1 lib/net/imap/authenticators/xoauth2.rb