code: protected Optional<C> retrieveCredentials(final WebContext context) {
          try {
              final Optional<C> optCredentials = this.credentialsExtractor.extract(context);
              optCredentials.ifPresent(credentials -> {
                  final long t0 = System.currentTimeMillis();
                  try {
                      this.authenticator.validate(credentials, context);
                  } finally {
                      final long t1 = System.currentTimeMillis();
                      logger.debug("Credentials validation took: {} ms", t1 - t0);
                  }
              });
              return optCredentials;
          } catch (CredentialsException e) {
              logger.info("Failed to retrieve or validate credentials: {}", e.getMessage());
              logger.debug("Failed to retrieve or validate credentials", e);
  
              return Optional.empty();
          }
      }
docs: Retrieve the credentials.
  
  @param context the web context
  @return the credentials