Module: Fizzy::AuthStrategy

Included in:
BearerAuth, CookieAuth, MagicLinkFlow::NullAuth
Defined in:
lib/fizzy/auth_strategy.rb

Overview

AuthStrategy controls how authentication is applied to HTTP requests. The default strategy is BearerAuth, which uses a TokenProvider to set the Authorization header with a Bearer token.

Custom strategies can implement alternative auth schemes such as cookie-based auth or magic link flows.

To implement a custom strategy, create a class that responds to #authenticate(headers), where headers is a Hash that you can modify.

Instance Method Summary collapse

Instance Method Details

#authenticate(headers) ⇒ Object

Apply authentication to the given headers hash.

Parameters:

  • headers (Hash)

    the request headers to modify

Raises:

  • (NotImplementedError)


16
17
18
# File 'lib/fizzy/auth_strategy.rb', line 16

def authenticate(headers)
  raise NotImplementedError, "#{self.class} must implement #authenticate"
end