class Net::IMAP::SASL::OAuthBearerAuthenticator
Authenticator for the “OAUTHBEARER
” SASL
mechanism, specified in RFC7628. Authenticates using OAuth 2.0 bearer tokens, as described in RFC6750. Use via Net::IMAP#authenticate
.
RFC6750 requires Transport Layer Security (TLS) to secure the protocol interaction between the client and the resource server. TLS MUST be used for OAUTHBEARER
to protect the bearer token.
Attributes
An OAuth 2.0 bearer token. See RFC-6750
An OAuth 2.0 bearer token. See RFC-6750
Public Class Methods
Creates an Authenticator for the “OAUTHBEARER
” SASL
mechanism.
Called by Net::IMAP#authenticate
and similar methods on other clients.
Parameters¶ ↑
-
oauth2_token
— An OAuth2 bearer token
All other keyword parameters are passed to super (see OAuthAuthenticator
). The most common ones are:
-
optional
authzid
― Authorization identity to act as or on behalf of.optional
username
— An alias forauthzid
.Note that, unlike some other authenticators,
username
sets the authorization identity and not the authentication identity. The authentication identity is established for the client byoauth2_token
. -
optional
host
— Hostname to which the client connected. -
optional
port
— Service port to which the client connected.
Although only oauth2_token
is required by this mechanism, it is worth noting that application protocols are allowed to require authzid
(or other parameters, such as host
or port
) as are specific server implementations.
Net::IMAP::SASL::OAuthAuthenticator::new
# File net-imap-0.5.1/lib/net/imap/sasl/oauthbearer_authenticator.rb, line 177 def initialize(arg1 = nil, arg2 = nil, oauth2_token: nil, secret: nil, **args, &blk) username, oauth2_token_arg = arg2.nil? ? [nil, arg1] : [arg1, arg2] super(username: username, **args, &blk) @oauth2_token = oauth2_token || secret || oauth2_token_arg or raise ArgumentError, "missing oauth2_token" end
Public Instance Methods
OAUTHBEARER
sends an initial client response.
# File net-imap-0.5.1/lib/net/imap/sasl/oauthbearer_authenticator.rb, line 190 def initial_response?; true end