Class: Neo4j::Driver::Internal::InternalAuthTokenManager

Inherits:
Object
  • Object
show all
Defined in:
lib/neo4j/driver/internal/internal_auth_token_manager.rb

Overview

Auth-token manager: anything responding to

get_token                                   -> AuthToken
handle_security_exception(token, exception) -> Boolean

is a manager. Pass an instance to GraphDatabase.driver via the :auth_token_manager kw arg and the driver will call back into it when it needs a fresh token or when the server rejects the current one.

This concrete class is the Proc-based shortcut — supply two callables and you're done. Clients that need richer behaviour subclass and override the methods; the JRuby flavour's class additionally implements org.neo4j.driver.AuthTokenManager, so subclasses there automatically slot into the Java driver.

Direct Known Subclasses

Security::StaticAuthTokenManager

Instance Method Summary collapse

Constructor Details

#initialize(get_token:, handle_security_exception:) ⇒ InternalAuthTokenManager

Returns a new instance of InternalAuthTokenManager.



22
23
24
25
# File 'lib/neo4j/driver/internal/internal_auth_token_manager.rb', line 22

def initialize(get_token:, handle_security_exception:)
  @get_token = get_token
  @handle_security_exception = handle_security_exception
end

Instance Method Details

#get_tokenObject



27
28
29
# File 'lib/neo4j/driver/internal/internal_auth_token_manager.rb', line 27

def get_token
  @get_token.call
end

#handle_security_exception(token, exception) ⇒ Object



31
32
33
# File 'lib/neo4j/driver/internal/internal_auth_token_manager.rb', line 31

def handle_security_exception(token, exception)
  @handle_security_exception.call(token, exception)
end