87 lines
		
	
	
		
			2.7 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
			
		
		
	
	
			87 lines
		
	
	
		
			2.7 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
/**
 | 
						|
 * Config source: https://git.io/JY0mp
 | 
						|
 *
 | 
						|
 * Feel free to let us know via PR, if you find something broken in this config
 | 
						|
 * file.
 | 
						|
 */
 | 
						|
 | 
						|
import type { AuthConfig } from '@ioc:Adonis/Addons/Auth'
 | 
						|
 | 
						|
/*
 | 
						|
|--------------------------------------------------------------------------
 | 
						|
| Authentication Mapping
 | 
						|
|--------------------------------------------------------------------------
 | 
						|
|
 | 
						|
| List of available authentication mapping. You must first define them
 | 
						|
| inside the `contracts/auth.ts` file before mentioning them here.
 | 
						|
|
 | 
						|
*/
 | 
						|
const authConfig: AuthConfig = {
 | 
						|
  guard: 'web',
 | 
						|
  guards: {
 | 
						|
    /*
 | 
						|
    |--------------------------------------------------------------------------
 | 
						|
    | Web Guard
 | 
						|
    |--------------------------------------------------------------------------
 | 
						|
    |
 | 
						|
    | Web guard uses classic old school sessions for authenticating users.
 | 
						|
    | If you are building a standard web application, it is recommended to
 | 
						|
    | use web guard with session driver
 | 
						|
    |
 | 
						|
    */
 | 
						|
    web: {
 | 
						|
      driver: 'session',
 | 
						|
 | 
						|
      provider: {
 | 
						|
        /*
 | 
						|
        |--------------------------------------------------------------------------
 | 
						|
        | Driver
 | 
						|
        |--------------------------------------------------------------------------
 | 
						|
        |
 | 
						|
        | Name of the driver
 | 
						|
        |
 | 
						|
        */
 | 
						|
        driver: 'lucid',
 | 
						|
 | 
						|
        /*
 | 
						|
        |--------------------------------------------------------------------------
 | 
						|
        | Identifier key
 | 
						|
        |--------------------------------------------------------------------------
 | 
						|
        |
 | 
						|
        | The identifier key is the unique key on the model. In most cases specifying
 | 
						|
        | the primary key is the right choice.
 | 
						|
        |
 | 
						|
        */
 | 
						|
        identifierKey: 'id_user',
 | 
						|
 | 
						|
        /*
 | 
						|
        |--------------------------------------------------------------------------
 | 
						|
        | Uids
 | 
						|
        |--------------------------------------------------------------------------
 | 
						|
        |
 | 
						|
        | Uids are used to search a user against one of the mentioned columns. During
 | 
						|
        | login, the auth module will search the user mentioned value against one
 | 
						|
        | of the mentioned columns to find their user record.
 | 
						|
        |
 | 
						|
        */
 | 
						|
        uids: ['username'],
 | 
						|
 | 
						|
        /*
 | 
						|
        |--------------------------------------------------------------------------
 | 
						|
        | Model
 | 
						|
        |--------------------------------------------------------------------------
 | 
						|
        |
 | 
						|
        | The model to use for fetching or finding users. The model is imported
 | 
						|
        | lazily since the config files are read way earlier in the lifecycle
 | 
						|
        | of booting the app and the models may not be in a usable state at
 | 
						|
        | that time.
 | 
						|
        |
 | 
						|
        */
 | 
						|
        model: () => import('App/Models/Users'),
 | 
						|
      },
 | 
						|
    },
 | 
						|
  },
 | 
						|
}
 | 
						|
 | 
						|
export default authConfig
 |