This commit is contained in:
Tutur33
2023-11-24 22:35:41 +01:00
parent 3c0b507a93
commit 7644b2a0f7
45165 changed files with 4803356 additions and 3 deletions
+55
View File
@@ -0,0 +1,55 @@
/**
* Contract source: https://git.io/JOdz5
*
* Feel free to let us know via PR, if you find something broken in this
* file.
*/
{{#modelNamespace}}
import {{ modelName }} from '{{{ modelNamespace }}}'
{{/modelNamespace}}
declare module '@ioc:Adonis/Addons/Auth' {
/*
|--------------------------------------------------------------------------
| Providers
|--------------------------------------------------------------------------
|
| The providers are used to fetch users. The Auth module comes pre-bundled
| with two providers that are `Lucid` and `Database`. Both uses database
| to fetch user details.
|
| You can also create and register your own custom providers.
|
*/
interface ProvidersList {
{{> provider}}
}
/*
|--------------------------------------------------------------------------
| Guards
|--------------------------------------------------------------------------
|
| The guards are used for authenticating users using different drivers.
| The auth module comes with 3 different guards.
|
| - SessionGuardContract
| - BasicAuthGuardContract
| - OATGuardContract ( Opaque access token )
|
| Every guard needs a provider for looking up users from the database.
|
*/
interface GuardsList {
{{#hasGuard.web}}
{{> web_guard}}
{{/hasGuard.web}}
{{#hasGuard.api}}
{{> api_guard}}
{{/hasGuard.api}}
{{#hasGuard.basic}}
{{> basic_guard}}
{{/hasGuard.basic}}
}
}
@@ -0,0 +1,14 @@
/*
|--------------------------------------------------------------------------
| OAT Guard
|--------------------------------------------------------------------------
|
| OAT, stands for (Opaque access tokens) guard uses database backed tokens
| to authenticate requests.
|
*/
api: {
implementation: OATGuardContract<'user', 'api'>
config: OATGuardConfig<'user'>
client: OATClientContract<'user'>
}
@@ -0,0 +1,14 @@
/*
|--------------------------------------------------------------------------
| Basic Auth Guard
|--------------------------------------------------------------------------
|
| The basic guard uses basic auth for maintaining user login state. It uses
| the `user` provider for fetching user details.
|
*/
basic: {
implementation: BasicAuthGuardContract<'user', 'basic'>
config: BasicAuthGuardConfig<'user'>
client: BasicAuthClientContract<'user'>
}
@@ -0,0 +1,16 @@
/*
|--------------------------------------------------------------------------
| User Provider
|--------------------------------------------------------------------------
|
| The following provider directlly uses Database query builder for fetching
| user details from the database for authentication.
|
| You can create multiple providers using the same underlying driver with
| different database tables.
|
*/
user: {
implementation: DatabaseProviderContract<DatabaseProviderRow>
config: DatabaseProviderConfig
}
@@ -0,0 +1,16 @@
/*
|--------------------------------------------------------------------------
| User Provider
|--------------------------------------------------------------------------
|
| The following provider uses Lucid models as a driver for fetching user
| details from the database for authentication.
|
| You can create multiple providers using the same underlying driver with
| different Lucid models.
|
*/
user: {
implementation: LucidProviderContract<typeof {{ modelName }}>
config: LucidProviderConfig<typeof {{ modelName }}>
}
@@ -0,0 +1,14 @@
/*
|--------------------------------------------------------------------------
| Web Guard
|--------------------------------------------------------------------------
|
| The web guard uses sessions for maintaining user login state. It uses
| the `user` provider for fetching user details.
|
*/
web: {
implementation: SessionGuardContract<'user', 'web'>
config: SessionGuardConfig<'user'>
client: SessionClientContract<'user'>
}