Data Access Layer
The data access layer extension is the only required extension in order for AuthGuard to run. The others are optional. AuthGuard was designed with adaptability in mind, which is why it does not come with any database drivers with it. You are expected to have the implementation which connects it to whatever database you want to use.
#
Data Access InterfacesThe data access layer is split into two parts: persistence, and cache. This allows you to have a different implementation for each one, e.g. MySQL for persistence and Redis for caching.
#
Persistence Repositories- Accounts
- CredentialsAudit
- Permissions
- Credentials
- Roles
- ApiKeys
- Applications
- ExchangeAttempts
- IdempotentRecord
#
Cache Repositories- OTP
- AccountTokens
- Sessions
- AccountLocks
#
ExampleAn example implementation which is used for the test distribution is an in-memory store.
#
Implementation GuidelinesThere are no special guidelines for implementing data access interfaces, except for accounts
and credentials. It is the responsibility of the implementation to either check for duplicates
before inserting/updating a document, or rely on a unqiue index of the database to do so. In
case of duplicates, the implementation should throw ServiceConflictException
.
#
IndicesIt is up to the implementation to decide if it wants to create database indices, or rely on them being created in some other way. If the implementation needs to create its own indices then it can do so by creating the appropertiate bootstrap steps. Check Bootstrap Steps for more details.