Skip to content

Commit

Permalink
docs: TMP Auth (squash later)
Browse files Browse the repository at this point in the history
  • Loading branch information
JustSamuel committed Feb 16, 2025
1 parent d3821f4 commit e54c4ad
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/authentication/json-web-token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
* - {@link KeyAuthenticator | API Key Authentication}.
* - {@link EanAuthenticator | EAN (barcode) authentication}.
*
* Most of these methods are a hash-based authentication method, where a secret is hashed and stored in the database,
* Most of these methods are a {@link HashBasedAuthenticationMethod | hash-based authentication method}, where a secret is hashed and stored in the database,
* and later compared against the input of the user.
*
* @module authentication
Expand Down
28 changes: 28 additions & 0 deletions src/entity/authenticator/ldap-authenticator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,36 @@ const bufferTransformer = {
};

/**
*
*
* ```mermaid
* graph TD
* A[Start] --> B{Receive LDAP Login Request}
* B --> C[Parse Request Body]
* C --> D[Establish LDAP Connection]
* D --> E{Search LDAP for User}
* E -->|Found| F[Attempt User Bind]
* E -->|Not Found| G[Return 403 Error]
*
* F --> H{Bind Successful?}
* H -->|Yes| I{Check Local User Account}
* H -->|No| J[Return 403 Error]
*
* I -->|Exists| K[Generate JWT Token]
* I -->|Not Exists| L[Create Local User & Bind]
* L --> M[Generate JWT Token]
*
* K --> N[Return JWT Token]
* M --> N[Return JWT Token]
*
* style G fill:#f66
* style J fill:#f66
* ```
*
* @typedef {AuthenticationMethod} LDAPAuthenticator
* @property {string} accountName.required - The associated AD account name
* @promote
* @index 1
*/
@Entity()
export default class LDAPAuthenticator extends AuthenticationMethod {
Expand Down
10 changes: 8 additions & 2 deletions src/entity/authenticator/pin-authenticator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
*/

/**
* This is the page of pin-authenticator.
*
* @module authentication
*/

Expand All @@ -30,8 +28,16 @@ import {
import HashBasedAuthenticationMethod from './hash-based-authentication-method';

/**
* PIN Authentication returns a lesser JWT token and should only be used for authenticating at a point of sale.
* The reason for returning a lesser JWT token is to prevent brute-force attacks, since PINs are 4-digit numbers and could easily be guessed.
*
* PIN Authentication is a _hash-based authentication method_. This means that the PIN code is hashed and stored in the database, and later compared against the input of the user.
*
* @typedef {HashBasedAuthenticationMethod} PinAuthenticator
* @property {string} hash.required - The PIN code of this user (hashed)
*
* @promote
* @index 0
*/
@Entity()
export default class PinAuthenticator extends HashBasedAuthenticationMethod {}

0 comments on commit e54c4ad

Please sign in to comment.