27 lines
762 B
TypeScript
27 lines
762 B
TypeScript
import { defineConfig } from '@adonisjs/auth'
|
|
import { basicAuthGuard, basicAuthUserProvider } from '@adonisjs/auth/basic_auth'
|
|
import type { InferAuthenticators, InferAuthEvents, Authenticators } from '@adonisjs/auth/types'
|
|
|
|
const authConfig = defineConfig({
|
|
default: 'basicAuth',
|
|
guards: {
|
|
basicAuth: basicAuthGuard({
|
|
provider: basicAuthUserProvider({
|
|
model: () => import('#models/user')
|
|
}),
|
|
}),
|
|
},
|
|
})
|
|
|
|
export default authConfig
|
|
|
|
/**
|
|
* Inferring types from the configured auth
|
|
* guards.
|
|
*/
|
|
declare module '@adonisjs/auth/types' {
|
|
export interface Authenticators extends InferAuthenticators<typeof authConfig> {}
|
|
}
|
|
declare module '@adonisjs/core/types' {
|
|
interface EventsList extends InferAuthEvents<Authenticators> {}
|
|
} |