SudoSOS Back-end API / authentication / KeyAuthenticator
Class: KeyAuthenticator ​
The Key Authenticator is used for API key-based authentication in SudoSOS. This authentication method allows programmatic access to the system using pre-generated API keys instead of user credentials.
Key Authentication is a hash-based authentication method. This means that the API key is hashed using bcrypt and stored in the database, and later compared against the input during authentication attempts.
Key Authentication Flow ​
- Client sends a request to the
/authentication/keyendpoint with user ID and API key. - Authentication Controller looks up the user by ID.
- Authentication Controller retrieves the associated KeyAuthenticator.
- Authentication Service compares the provided key against the stored hash.
- Authentication Controller returns a JWT token if authentication succeeds.
Use Cases ​
- Automated systems that need to access the SudoSOS API
- Third-party integrations
- Scripts and tools that require programmatic access
- Testing and development environments
Extends ​
Constructors ​
Constructor ​
ts
new KeyAuthenticator(): KeyAuthenticator;Returns ​
KeyAuthenticator
Inherited from ​
HashBasedAuthenticationMethod.constructor
Properties ​
| Property | Modifier | Type | Description | Inherited from |
|---|---|---|---|---|
createdAt | readonly | Date | The creation date of the object. | HashBasedAuthenticationMethod.createdAt |
hash | public | string | - | HashBasedAuthenticationMethod.hash |
updatedAt | readonly | Date | The last update date of the object. | HashBasedAuthenticationMethod.updatedAt |
user | public | User | - | HashBasedAuthenticationMethod.user |
userId | public | number | - | HashBasedAuthenticationMethod.userId |
version | readonly | number | The current version of the object. | HashBasedAuthenticationMethod.version |