Liking cljdoc? Tell your friends :D

boundary.user.core.authentication

Functional Core - Pure authentication business logic.

This namespace contains ONLY pure functions for authentication:

  • Credential validation logic
  • Authentication decision making
  • Login attempt analysis
  • Account lockout logic

All functions are pure and deterministic - no I/O operations. Password hashing and token operations are handled in the shell layer.

Functional Core - Pure authentication business logic.

This namespace contains ONLY pure functions for authentication:
- Credential validation logic
- Authentication decision making
- Login attempt analysis
- Account lockout logic

All functions are pure and deterministic - no I/O operations.
Password hashing and token operations are handled in the shell layer.
raw docstring

analyze-login-riskclj

(analyze-login-risk user login-context recent-sessions now)

Pure function: Analyze risk factors for a login attempt.

Args: user: User entity login-context: Map with :ip-address, :user-agent, etc. recent-sessions: Recent session history now: Current timestamp provided by shell layer

Returns: {:risk-score 0-100 :risk-factors [...] :requires-mfa? boolean}

Pure - risk assessment based on patterns and context.

Pure function: Analyze risk factors for a login attempt.

Args:
  user: User entity
  login-context: Map with :ip-address, :user-agent, etc.
  recent-sessions: Recent session history
  now: Current timestamp provided by shell layer
  
Returns:
  {:risk-score 0-100
   :risk-factors [...]
   :requires-mfa? boolean}
   
Pure - risk assessment based on patterns and context.
sourceraw docstring

calculate-failed-login-consequencesclj

(calculate-failed-login-consequences user login-config current-time)

Pure function: Calculate consequences of a failed login attempt.

Args: user: User entity with current failed login count login-config: Configuration with lockout policies current-time: Current timestamp

Returns: {:lockout-until optional-instant :failed-login-count new-count :should-alert? boolean}

Pure - business rule calculations for security policies.

Pure function: Calculate consequences of a failed login attempt.

Args:
  user: User entity with current failed login count
  login-config: Configuration with lockout policies
  current-time: Current timestamp
  
Returns:
  {:lockout-until optional-instant
   :failed-login-count new-count
   :should-alert? boolean}
   
Pure - business rule calculations for security policies.
sourceraw docstring

calculate-password-strengthclj

(calculate-password-strength password)

Pure function: Calculate password strength score.

Args: password: Plain text password

Returns: {:strength-score 0-100 :strength-level :weak|:moderate|:strong|:very-strong :feedback [...]}

Pure - password strength analysis.

Pure function: Calculate password strength score.

Args:
  password: Plain text password
  
Returns:
  {:strength-score 0-100
   :strength-level :weak|:moderate|:strong|:very-strong
   :feedback [...]}
   
Pure - password strength analysis.
sourceraw docstring

meets-password-policy?clj

(meets-password-policy? password policy user-context)

Pure function: Check if password meets security policy requirements.

Args: password: Plain text password policy: Password policy configuration user-context: Optional user context for personalized checks

Returns: {:valid? boolean :violations [...]}

Pure - password policy validation.

Pure function: Check if password meets security policy requirements.

Args:
  password: Plain text password
  policy: Password policy configuration
  user-context: Optional user context for personalized checks
  
Returns:
  {:valid? boolean :violations [...]}
  
Pure - password policy validation.
sourceraw docstring

prepare-successful-login-updatesclj

(prepare-successful-login-updates user current-time)

Pure function: Prepare user updates for successful login.

Args: user: User entity current-time: Current timestamp

Returns: Map of field updates to apply to user

Pure - data transformation for successful authentication.

Pure function: Prepare user updates for successful login.

Args:
  user: User entity
  current-time: Current timestamp
  
Returns:
  Map of field updates to apply to user
  
Pure - data transformation for successful authentication.
sourceraw docstring

should-allow-login-attempt?clj

(should-allow-login-attempt? user _login-config current-time)

Pure function: Determine if login attempt should be allowed based on account state.

Args: user: User entity (or nil if not found) login-config: Configuration map with lockout policies current-time: Current timestamp (Instant)

Returns: {:allowed? true} or {:allowed? false :reason string :retry-after optional-instant}

Pure - business rule evaluation for login attempts.

Pure function: Determine if login attempt should be allowed based on account state.

Args:
  user: User entity (or nil if not found)
  login-config: Configuration map with lockout policies
  current-time: Current timestamp (Instant)
  
Returns:
  {:allowed? true} or 
  {:allowed? false :reason string :retry-after optional-instant}
  
 Pure - business rule evaluation for login attempts.
sourceraw docstring

should-create-session?clj

(should-create-session? user login-risk auth-config)

Pure function: Determine if a session should be created for authenticated user.

Args: user: Authenticated user entity login-risk: Risk analysis from analyze-login-risk auth-config: Authentication configuration

Returns: {:create-session? boolean :session-duration-hours number :requires-additional-verification? boolean}

Pure - session creation policy decisions.

Pure function: Determine if a session should be created for authenticated user.

Args:
  user: Authenticated user entity
  login-risk: Risk analysis from analyze-login-risk
  auth-config: Authentication configuration
  
Returns:
  {:create-session? boolean
   :session-duration-hours number
   :requires-additional-verification? boolean}
   
Pure - session creation policy decisions.
sourceraw docstring

should-require-password-reset?clj

(should-require-password-reset? user current-time policy)

Pure function: Determine if user should be required to reset password.

Args: user: User entity current-time: Current timestamp policy: Password policy configuration

Returns: {:requires-reset? boolean :reason optional-string}

Pure - password reset policy evaluation.

Pure function: Determine if user should be required to reset password.

Args:
  user: User entity
  current-time: Current timestamp
  policy: Password policy configuration
  
Returns:
  {:requires-reset? boolean :reason optional-string}
  
Pure - password reset policy evaluation.
sourceraw docstring

validate-login-credentialsclj

(validate-login-credentials login-data)

Pure function: Validate login request format and basic requirements.

Args: login-data: Map with :email and :password

Returns: {:valid? true :data processed-data} or {:valid? false :errors [...]}

Pure - schema and format validation only.

Pure function: Validate login request format and basic requirements.

Args:
  login-data: Map with :email and :password
  
Returns:
  {:valid? true :data processed-data} or 
  {:valid? false :errors [...]}
  
Pure - schema and format validation only.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close