예제 #1
0
  private Credentials extractCredentials(
      HttpServletRequest request, RepositoryConfiguration configuration) {
    final Credentials credentialsFromUrlParameters = extractCredentialsFromRequest(request);

    final Credentials credentials;
    if (configuration.isAccessControlEnabled()) {
      if (httpAuthenticationHandler.isLoginAttempt(request)) {
        logger.debug("Basic HTTP authentication detected. Parsing credentials from request.");
        credentials = httpAuthenticationHandler.parseCredentials(request);
      } else {
        logger.debug("Parsing credentials from url");
        credentials = credentialsFromUrlParameters;
      }
    } else {
      credentials = configuration.getUserCredentials();
    }
    return credentials;
  }