Class: Tasker::Types::AuthConfig

Inherits:
BaseConfig
  • Object
show all
Defined in:
lib/tasker/types/auth_config.rb

Overview

Configuration type for authentication and authorization settings

This configuration handles all authentication and authorization settings for Tasker. It provides the same functionality as the original AuthConfiguration but with dry-struct type safety and immutability.

Examples:

Basic authentication setup

config = AuthConfig.new(
  authentication_enabled: true,
  authenticator_class: 'MyAuthenticator',
  strategy: :custom
)

Full configuration

config = AuthConfig.new(
  authentication_enabled: true,
  authenticator_class: 'JwtAuthenticator',
  current_user_method: :current_user,
  authenticate_user_method: :authenticate_user!,
  authorization_enabled: true,
  authorization_coordinator_class: 'MyAuthorizationCoordinator',
  user_class: 'User',
  strategy: :custom
)

Instance Attribute Summary collapse

Method Summary

Methods inherited from BaseConfig

#initialize

Constructor Details

This class inherits a constructor from Tasker::Types::BaseConfig

Instance Attribute Details

#authenticate_user_methodSymbol (readonly)

Returns Method name to authenticate the user.

Returns:

  • (Symbol)

    Method name to authenticate the user



54
# File 'lib/tasker/types/auth_config.rb', line 54

attribute :authenticate_user_method, Types::Symbol.default(:authenticate_user!)

#authentication_enabledBoolean (readonly)

Returns Whether authentication is enabled.

Returns:

  • (Boolean)

    Whether authentication is enabled



36
# File 'lib/tasker/types/auth_config.rb', line 36

attribute :authentication_enabled, Types::Bool.default(false)

#authenticator_classString? (readonly)

Returns Class name for the authenticator.

Returns:

  • (String, nil)

    Class name for the authenticator



42
# File 'lib/tasker/types/auth_config.rb', line 42

attribute? :authenticator_class, Types::String.optional.default(nil)

#authorization_coordinator_classString (readonly)

Returns Class name for the authorization coordinator.

Returns:

  • (String)

    Class name for the authorization coordinator



66
# File 'lib/tasker/types/auth_config.rb', line 66

attribute :authorization_coordinator_class, Types::String.default('Tasker::Authorization::BaseCoordinator')

#authorization_enabledBoolean (readonly)

Returns Whether authorization is enabled.

Returns:

  • (Boolean)

    Whether authorization is enabled



60
# File 'lib/tasker/types/auth_config.rb', line 60

attribute :authorization_enabled, Types::Bool.default(false)

#current_user_methodSymbol (readonly)

Returns Method name to get the current user.

Returns:

  • (Symbol)

    Method name to get the current user



48
# File 'lib/tasker/types/auth_config.rb', line 48

attribute :current_user_method, Types::Symbol.default(:current_user)

#strategySymbol (readonly)

Returns Authentication strategy.

Returns:

  • (Symbol)

    Authentication strategy



78
# File 'lib/tasker/types/auth_config.rb', line 78

attribute :strategy, Types::Symbol.default(:none)

#user_classString? (readonly)

Returns Class name for the authorizable user class.

Returns:

  • (String, nil)

    Class name for the authorizable user class



72
# File 'lib/tasker/types/auth_config.rb', line 72

attribute? :user_class, Types::String.optional.default(nil)