Class: Rhales::Adapters::BaseAuth
- Inherits:
-
Object
- Object
- Rhales::Adapters::BaseAuth
- Defined in:
- lib/rhales/adapters/base_auth.rb
Overview
Base authentication adapter interface
Defines the contract that authentication adapters must implement to work with Rhales. This allows the library to work with any authentication system by implementing this interface.
Direct Known Subclasses
Class Method Summary collapse
-
.anonymous ⇒ Object
Create anonymous user instance.
Instance Method Summary collapse
-
#anonymous? ⇒ Boolean
Check if user is anonymous.
-
#attributes ⇒ Object
Get user attributes as hash (optional).
-
#display_name ⇒ Object
Get user display name (optional).
-
#role? ⇒ Boolean
Check if user has specific role/permission (optional).
-
#theme_preference ⇒ Object
Get user’s theme preference.
-
#user_id ⇒ Object
Get user identifier (optional).
Class Method Details
.anonymous ⇒ Object
Create anonymous user instance
43 44 45 |
# File 'lib/rhales/adapters/base_auth.rb', line 43 def anonymous new end |
Instance Method Details
#anonymous? ⇒ Boolean
Check if user is anonymous
12 13 14 |
# File 'lib/rhales/adapters/base_auth.rb', line 12 def anonymous? raise NotImplementedError, 'Subclasses must implement #anonymous?' end |
#attributes ⇒ Object
Get user attributes as hash (optional)
37 38 39 |
# File 'lib/rhales/adapters/base_auth.rb', line 37 def attributes {} end |
#display_name ⇒ Object
Get user display name (optional)
27 28 29 |
# File 'lib/rhales/adapters/base_auth.rb', line 27 def display_name nil end |
#role? ⇒ Boolean
Check if user has specific role/permission (optional)
32 33 34 |
# File 'lib/rhales/adapters/base_auth.rb', line 32 def role?(*) raise NotImplementedError, 'Subclasses must implement #role?' end |
#theme_preference ⇒ Object
Get user’s theme preference
17 18 19 |
# File 'lib/rhales/adapters/base_auth.rb', line 17 def theme_preference raise NotImplementedError, 'Subclasses must implement #theme_preference' end |
#user_id ⇒ Object
Get user identifier (optional)
22 23 24 |
# File 'lib/rhales/adapters/base_auth.rb', line 22 def user_id nil end |