Sha256: 48f3abd8459b9433c1aa4e130e55ad68a3cb7d79019648d7fe400c344d9408b5

Contents?: true

Size: 418 Bytes

Versions: 4

Compression:

Stored size: 418 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

4 entries across 4 versions & 1 rubygems

Version Path
net-imap-0.3.8 lib/net/imap/authenticators/xoauth2.rb
net-imap-0.3.7 lib/net/imap/authenticators/xoauth2.rb
net-imap-0.3.6 lib/net/imap/authenticators/xoauth2.rb
net-imap-0.3.5 lib/net/imap/authenticators/xoauth2.rb