code: public Principal authenticate() throws AuthenticationException {
          final KeyManager keyManager = KeyManager.getInstance();
          if (bearer != null) {
              final JsonWebToken jwt = new JsonWebToken(keyManager.getSecretKey());
              final boolean isValid = jwt.validateToken(bearer);
              if (isValid) {
                  try (AlpineQueryManager qm = new AlpineQueryManager()) {
                      if (jwt.getSubject() == null || jwt.getExpiration() == null) {
                          throw new AuthenticationException("Token does not contain a valid subject or expiration");
                      }
                      final ManagedUser managedUser = qm.getManagedUser(jwt.getSubject());
                      if (managedUser != null) {
                          return managedUser.isSuspended() ? null : managedUser;
                      }
                      final LdapUser ldapUser =  qm.getLdapUser(jwt.getSubject());
                      if (ldapUser != null) {
                          return ldapUser;
                      }
                  }
              }
          }
          return null;
      }
docs: {@inheritDoc}