Module: Octokit::Authentication
- Included in:
- Client, Connection
- Defined in:
- lib/octokit/authentication.rb
Overview
Authentication methods for Client
Constant Summary collapse
- FARADAY_BASIC_AUTH_KEYS =
In Faraday 2.x, the authorization middleware uses new interface
if Gem::Version.new(Faraday::VERSION) >= Gem::Version.new('2.0') %i[authorization basic] else [:basic_auth] end
Instance Method Summary collapse
-
#application_authenticated? ⇒ Boolean
Indicates if the client has OAuth Application client_id and secret credentials to make anonymous requests at a higher rate limit.
-
#basic_authenticated? ⇒ Boolean
Indicates if the client was supplied Basic Auth username and password.
-
#bearer_authenticated? ⇒ Boolean
Indicates if the client was supplied a bearer token.
-
#token_authenticated? ⇒ Boolean
Indicates if the client was supplied an OAuth access token.
-
#user_authenticated? ⇒ Boolean
Indicates if the client was supplied an OAuth access token or Basic Auth username and password.
Instance Method Details
#application_authenticated? ⇒ Boolean
Indicates if the client has OAuth Application client_id and secret credentials to make anonymous requests at a higher rate limit
55 56 57 |
# File 'lib/octokit/authentication.rb', line 55 def application_authenticated? !!(@client_id && @client_secret) end |
#basic_authenticated? ⇒ Boolean
Indicates if the client was supplied Basic Auth username and password
19 20 21 |
# File 'lib/octokit/authentication.rb', line 19 def basic_authenticated? !!(@login && @password) end |
#bearer_authenticated? ⇒ Boolean
Indicates if the client was supplied a bearer token
36 37 38 |
# File 'lib/octokit/authentication.rb', line 36 def bearer_authenticated? !!@bearer_token end |
#token_authenticated? ⇒ Boolean
Indicates if the client was supplied an OAuth access token
28 29 30 |
# File 'lib/octokit/authentication.rb', line 28 def token_authenticated? !!@access_token end |
#user_authenticated? ⇒ Boolean
Indicates if the client was supplied an OAuth access token or Basic Auth username and password
45 46 47 |
# File 'lib/octokit/authentication.rb', line 45 def user_authenticated? basic_authenticated? || token_authenticated? end |