index.js 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. export class AuthenticationLoader {
  2. handlers = [];
  3. addAuthenticationHandler(authenticationHandler) {
  4. this.handlers.push(authenticationHandler);
  5. }
  6. async tryLogin(username, password, totpCode) {
  7. for (let i of this.handlers) {
  8. const result = await i.tryLogin(username, password, totpCode);
  9. if (result !== null)
  10. return result;
  11. }
  12. return false;
  13. }
  14. async needTotp(username, password) {
  15. for (let i of this.handlers) {
  16. const result = await i.needTotp(username, password);
  17. if (result !== null)
  18. return result;
  19. }
  20. return false;
  21. }
  22. }
  23. import { YesManAuthenticationHandler } from './yesManAuthenticationHandler.js';
  24. export { YesManAuthenticationHandler };
  25. import { TotpChecker } from './totpChecker.js';
  26. export { TotpChecker };
  27. import { SqliteAuthenticationHandler } from './sqliteAuthenticationHandler.js';
  28. export { SqliteAuthenticationHandler };
  29. import { LdapAuthenticationHandler } from './ldapAuthenticationHandler.js';
  30. export { LdapAuthenticationHandler };
  31. //# sourceMappingURL=index.js.map