Class BasicAuthenticator

java.lang.Object
services.moleculer.service.MoleculerComponent
services.moleculer.service.Service
services.moleculer.web.middleware.HttpMiddleware
services.moleculer.web.middleware.BasicAuthenticator
All Implemented Interfaces:
services.moleculer.service.MoleculerLifecycle, HttpConstants, BasicAuthProvider

public class BasicAuthenticator extends HttpMiddleware implements HttpConstants, BasicAuthProvider
Simple middleware that provides HTTP BASIC Authentication support. Sample:
route.use(new BasicAuthenticator("user", "password"));
  • Field Details

    • realm

      protected String realm
      Realm name (visible on login screen).
    • provider

      protected BasicAuthProvider provider
      Custom auth provider.
    • maxCachedLogins

      protected int maxCachedLogins
      Max number of cached logins (0 = disable caching)
    • users

      protected Map<String,String> users
    • cache

      protected io.datatree.dom.Cache<String,String> cache
  • Constructor Details

    • BasicAuthenticator

      public BasicAuthenticator()
    • BasicAuthenticator

      public BasicAuthenticator(BasicAuthProvider authProvider)
    • BasicAuthenticator

      public BasicAuthenticator(BasicAuthProvider authProvider, int cachedLogins)
    • BasicAuthenticator

      public BasicAuthenticator(String username, String password)
  • Method Details