@adonisjs/auth
Version:
Official authentication provider for Adonis framework
20 lines (19 loc) • 743 B
JavaScript
import "../errors-sGy-K8pd.js";
import "../debug-Ckko95-M.js";
import { t as AuthManager } from "../auth_manager-hJTiBA2V.js";
import { RuntimeException } from "@adonisjs/core/exceptions";
import { configProvider } from "@adonisjs/core";
var AuthProvider = class {
constructor(app) {
this.app = app;
}
register() {
this.app.container.singleton("auth.manager", async () => {
const authConfigProvider = this.app.config.get("auth");
const config = await configProvider.resolve(this.app, authConfigProvider);
if (!config) throw new RuntimeException("Invalid config exported from \"config/auth.ts\" file. Make sure to use the defineConfig method");
return new AuthManager(config);
});
}
};
export { AuthProvider as default };