Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/issue/19268 #20

Open
wants to merge 57 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
1bb7b31
[improve][ci] Upload native crash dump files hs_err_*.log & core.* in…
lhotari Jan 17, 2023
b4d5857
[improve][client] Add unified newTableView method in PulsarClient (#1…
yuruguo Jan 17, 2023
299bd70
[fix][broker] Avoid bundle unload destination broker be set as an ina…
Nicklee007 Jan 17, 2023
1d7f5e5
[fix][test] Fix pulsar-proxy test flakiness related to metrics (#19257)
lhotari Jan 17, 2023
69866a6
[improve][ci] Improve test fail fast: disable for non-PR builds, fail…
lhotari Jan 17, 2023
9e7a5c7
[improve][broker] PIP-192 Moved the common broker load data feature(w…
heesung-sn Jan 18, 2023
9825b59
[feat][ci] Collect code coverage for integration tests from docker co…
lhotari Jan 18, 2023
ddf3c02
[fix][sec] upgrade org.postgresql:postgresql to 42.5.1 (#19259)
chncaption Jan 18, 2023
4d7c7d0
[improve][broker] Refactor update topic partitions endpoint. (#19166)
mattisonchao Jan 18, 2023
a2b707b
[improve][io] Upgrade HBase to 2.4.15 (#19249)
sekikn Jan 18, 2023
9bb3a21
[improve] [broker] Introduce `metadataStoreAllowReadOnlyOperations` t…
horizonzy Jan 18, 2023
32cdf38
[fix][sec] Exclude log4j from openmldb (#19266)
nodece Jan 18, 2023
cfd7e60
[fix][txn] Catch and log runtime exceptions in async operations (#19258)
nicoloboschi Jan 18, 2023
ea4f7eb
[fix][io] Fix the Alluxio sink to write messages successfully after t…
sekikn Jan 18, 2023
3c38ed5
[feat][broker] Update AuthenticationProvider to simplify HTTP Authn (…
michaeljmarshall Jan 19, 2023
a9b6519
[cleanup][proxy] Remove unused AuthenticationDataSource variable (#19…
michaeljmarshall Jan 19, 2023
29c244a
[feat][admin] PIP-219 Part-1 Add admin API for trimming topic (#19094)
315157973 Jan 19, 2023
d3e112e
[fix][broker] AbstractBatchedMetadataStore - use AlreadyClosedExcepti…
eolivelli Jan 19, 2023
86205a9
[improve][broker]Enable custom metadata stores (#19208)
Jan 19, 2023
4139fef
[fix] [ml] Topics stats shows msgBacklog but there reality no backlog…
poorbarcode Jan 19, 2023
e3b76d4
[fix][ci] Fix Jacoco code coverage to report classes in dependent pro…
lhotari Jan 20, 2023
516437e
[fix][websocket] Fix webSocketPingDurationSeconds config (#19256)
nodece Jan 20, 2023
de3b855
[improve][broker] Documentation for AuthenticationState contract (#19…
michaeljmarshall Jan 20, 2023
c875365
[fix][broker] Let TokenAuthState update authenticationDataSource (#19…
michaeljmarshall Jan 20, 2023
457a0d5
[improve][ci] Improve code coverage reporting (#19296)
lhotari Jan 20, 2023
e0f79bf
[improve][ci] CI code coverage collecting improvements (#19303)
lhotari Jan 23, 2023
7989801
[improve][misc] Register Jackson Java 8 support modules by default (#…
lhotari Jan 23, 2023
9e698b6
[improve][build] Upgrade ASF Maven parent pom version to 29 (#19165)
lhotari Jan 23, 2023
d1e22a6
[fix][ci] Require coverage upload jobs to succeed before deleting int…
lhotari Jan 23, 2023
8d81392
[improve][ci] Ignore docs_only logic for scheduled builds (#19306)
lhotari Jan 23, 2023
e8695bf
[feat][broker] OneStageAuth State: move authn out of constructor (#19…
michaeljmarshall Jan 23, 2023
02e64d8
[improve][broker] Replace authenticate with authenticateAsync (#19313)
michaeljmarshall Jan 24, 2023
6c014ee
[fix][ci] Fix "CI - OWASP Dependency Check" for other than master bra…
lhotari Jan 24, 2023
c17535b
[improve][ci] Disable coverage collection on other than master branch…
lhotari Jan 24, 2023
b880b1d
[improve][build] Upgrade Spotbugs to a version with JDK 17 compatibil…
lhotari Jan 24, 2023
689a33f
[fix][test] Fix flaky test ReplicatorTest.testDoNotReplicateSystemTop…
lhotari Jan 24, 2023
8049690
[improve][broker] ServerCnx: go to Failed state when auth fails (#19312)
michaeljmarshall Jan 25, 2023
b3432f4
[fix][test] Replace PulsarService Mockito spy solution for overriding…
lhotari Jan 25, 2023
52bd9da
[fix][fn] Fix TLS configuration for fn worker to broker if auth disab…
nicoloboschi Jan 25, 2023
c3975e0
[improve][build] Increase thread stack size to 1500k for Maven JVM to…
lhotari Jan 25, 2023
d03d28e
[fix][ci] Fix coverage condition for master branch (#19325)
lhotari Jan 25, 2023
6112b65
[improve][test] Reduce the use of Mockito spies/mocks in tests (#19326)
lhotari Jan 25, 2023
87b1dd6
[improve][ml] Use correct isActive method for cursor (#19322)
michaeljmarshall Jan 26, 2023
e2a056d
[fix][test] Add cleanup for NonClosableMockBookKeeper in TestPulsarSe…
lhotari Jan 26, 2023
f047de2
[fix][test] Fix flaky MetadataStoreStatsTest and prevent certain flak…
lhotari Jan 26, 2023
644be5f
[improve][txn] Handle changeToReadyState failure correctly in TC clie…
BewareMyPower Jan 27, 2023
3391171
[fix][test] testSingleTopicConsumerBatchShortName (#19253)
labuladong Jan 28, 2023
4cae20c
[fix][admin] Fix `validatePersistencePolicies` that Namespace/Topic p…
tjiuming Jan 28, 2023
f410c6b
[fix] fix window function example yaml (#19340)
nlu90 Jan 28, 2023
ccb7d82
[fix][cli] The format of the example in the auth-params description i…
zzccctv Jan 28, 2023
fcecca4
[fix][test] fix testEndTxnWhenCommittingOrAborting flaky test (#18318)
congbobo184 Jan 28, 2023
e417fe7
[improve] [admin] Make the default value of param --get-subscription-…
poorbarcode Jan 28, 2023
ad8d2df
[improve][broker]Fix recycling OpReadEntry without resetting count (#…
gaozhangmin Jan 28, 2023
96fb7da
[improve][broker] Added isActive in ManagedCursorImpl (#19341)
heesung-sn Jan 28, 2023
ea6641e
[improve][broker] Replaced checkBackloggedCursors with checkBacklogge…
heesung-sn Jan 29, 2023
0211788
fix stats
labuladong Jan 29, 2023
558a40d
Merge branch 'apache:master' into fix/issue/19268
labuladong Jan 29, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[feat][broker] Update AuthenticationProvider to simplify HTTP Authn (a…
…pache#19197)

PIP: apache#12105 

### Motivation

This is the first of several PRs to implement [PIP 97](apache#12105).

This PR seeks to start to solve the fact that the `AuthenticationState` class currently authenticates `authData` twice instead of just once. This change is important to make before we are able to utilize the async methods introduced in apache#12104.

Historical context: apache#14044 introduced the `AuthenticationProvider#newHttpAuthState`  method. The only use case for this method in the pulsar code base is to let custom providers specify the `AuthenticationDataSource` on http request attributes. The primary problem with that implementation is that the `AuthenticationState` class currently involves authenticating the `authData` passed in to the `newHttpAuthState`. As such, this code is sub-optimal, and creates a confusing flow.

I propose we deprecate the `newHttpAuthState` method and instead start using the `authenticateHttpRequestAsync` and `authenticateHttpRequest` methods to allow custom implementations to configure the desired `AuthenticationDataSource` on the request attributes.

In order to simplify the diff for reviewers, this PR uses the deprecated `AuthenticationProvider#authenticateHttpRequest` method. I plan to follow up and switch to use the `AuthenticationProvider#authenticateHttpRequestAsync` method.

Note that these changes are completely backwards compatible. The only risk is to users that have custom code loaded into the broker that calls the `AuthenticationProvider#authenticateHttpRequest` method.

### Modifications

* Deprecate `AuthenticationService#authenticateHttpRequest(HttpServletRequest request, AuthenticationDataSource authData)`. It is no longer used.
* Deprecate `AuthenticationProvider#newHttpAuthState(HttpServletRequest request)`. It is no longer used outside of the `AuthenticationProvider` interface itself.
* Remove `@InterfaceStability.Unstable` annotation from the `authenticateHttpRequestAsync` method. When I introduced that annotation, I was under the impression that we didn't need it. However, in order to meet the requirements introduced in apache#14044, we need to let custom `AuthenticationProviders` add their own attributes.
* Update the default implementation of `authenticateHttpRequest`. Because the previous implementation was unreachable by all auth providers except for the SASL implementation, this is a backwards compatible change.
* Implement changes for the `AuthenticationProviderToken` so that it no longer relies on `newHttpAuthState`.

### Verifying this change

I added new tests.

### Does this pull request potentially affect one of the following parts:

- [x] The public API

This changes the public API within the broker by marking some methods as `@Deprecated`.

### Documentation

- [x] `doc-not-needed`

We document the `AuthenticationProvider` interface in the code. I added these docs. There is currently no where else to update docs.

### Matching PR in forked repository

PR in forked repository: michaeljmarshall#12

### Additional motivation from PR discussion

My primary motivation for this PR is to implement PIP 97. If we want authentication to be asynchronous, we cannot assume that when the `AuthenticationState` object is initialized, the `authenticationDataSource` and the `authRole` are present because the authentication might not yet be completed. My goal with this PR is to break an unnecessary relationship between `AuthenticationState` and http request authentication that was created by apache#14044.
  • Loading branch information
michaeljmarshall authored Jan 19, 2023
commit 3c38ed5a4f6cca9b96cfc002bb9b779aa1481e3f
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*/
package org.apache.pulsar.broker.authentication;

import static org.apache.pulsar.broker.web.AuthenticationFilter.AuthenticatedDataAttributeName;
import static org.apache.pulsar.broker.web.AuthenticationFilter.AuthenticatedRoleAttributeName;
import java.io.Closeable;
import java.io.IOException;
import java.net.SocketAddress;
Expand All @@ -28,7 +30,6 @@
import javax.servlet.http.HttpServletResponse;
import org.apache.pulsar.broker.ServiceConfiguration;
import org.apache.pulsar.common.api.AuthData;
import org.apache.pulsar.common.classification.InterfaceStability;
import org.apache.pulsar.common.util.FutureUtil;

/**
Expand Down Expand Up @@ -103,7 +104,16 @@ default AuthenticationState newAuthState(AuthData authData,

/**
* Create an http authentication data State use passed in AuthenticationDataSource.
* @deprecated implementations that previously relied on this should update their implementation of
* {@link #authenticateHttpRequest(HttpServletRequest, HttpServletResponse)} or of
* {@link #authenticateHttpRequestAsync(HttpServletRequest, HttpServletResponse)} so that the desired attributes
* are added in those methods.
*
* <p>Note: this method was only ever used to generate an {@link AuthenticationState} object in order to generate
* an {@link AuthenticationDataSource} that was added as the {@link AuthenticatedDataAttributeName} attribute to
* the http request. Removing this method removes an unnecessary step in the authentication flow.</p>
*/
@Deprecated(since = "2.12.0")
default AuthenticationState newHttpAuthState(HttpServletRequest request)
throws AuthenticationException {
return new OneStageAuthenticationState(request, this);
Expand All @@ -112,20 +122,17 @@ default AuthenticationState newHttpAuthState(HttpServletRequest request)
/**
* Validate the authentication for the given credentials with the specified authentication data.
*
* <p>Implementations of this method MUST modify the request by adding the {@link AuthenticatedRoleAttributeName}
* and the {@link AuthenticatedDataAttributeName} attributes.</p>
*
* <p>Warning: the calling thread is an IO thread. Any implementations that rely on blocking behavior
* must ensure that the execution is completed on using a separate thread pool to ensure IO threads
* are never blocked.</p>
*
* <p>Note: this method is marked as unstable because the Pulsar code base only calls it for the
* Pulsar Broker Auth SASL plugin. All non SASL HTTP requests are authenticated using the
* {@link AuthenticationProvider#authenticateAsync(AuthenticationDataSource)} method. As such,
* this method might be removed in favor of the SASL provider implementing the
* {@link AuthenticationProvider#authenticateAsync(AuthenticationDataSource)} method.</p>
*
* @return Set response, according to passed in request.
* @return Set response, according to passed in request, and return whether we should do following chain.doFilter.
* @throws Exception when authentication failed
* and return whether we should do following chain.doFilter or not.
*/
@InterfaceStability.Unstable
default CompletableFuture<Boolean> authenticateHttpRequestAsync(HttpServletRequest request,
HttpServletResponse response) {
try {
Expand All @@ -138,10 +145,20 @@ default CompletableFuture<Boolean> authenticateHttpRequestAsync(HttpServletReque
/**
* Set response, according to passed in request.
* and return whether we should do following chain.doFilter or not.
*
* <p>Implementations of this method MUST modify the request by adding the {@link AuthenticatedRoleAttributeName}
* and the {@link AuthenticatedDataAttributeName} attributes.</p>
*
* @return Set response, according to passed in request, and return whether we should do following chain.doFilter.
* @throws Exception when authentication failed
* @deprecated use and implement {@link AuthenticationProvider#authenticateHttpRequestAsync} instead.
*/
@Deprecated
default boolean authenticateHttpRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
throw new AuthenticationException("Not supported");
AuthenticationState authenticationState = newHttpAuthState(request);
String role = authenticate(authenticationState.getAuthDataSource());
request.setAttribute(AuthenticatedRoleAttributeName, role);
request.setAttribute(AuthenticatedDataAttributeName, authenticationState.getAuthDataSource());
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
package org.apache.pulsar.broker.authentication;

import static java.nio.charset.StandardCharsets.UTF_8;
import static org.apache.pulsar.broker.web.AuthenticationFilter.AuthenticatedDataAttributeName;
import static org.apache.pulsar.broker.web.AuthenticationFilter.AuthenticatedRoleAttributeName;
import com.google.common.annotations.VisibleForTesting;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.ExpiredJwtException;
Expand All @@ -39,6 +41,7 @@
import javax.naming.AuthenticationException;
import javax.net.ssl.SSLSession;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.apache.pulsar.broker.ServiceConfiguration;
import org.apache.pulsar.broker.authentication.metrics.AuthenticationMetrics;
Expand Down Expand Up @@ -160,6 +163,20 @@ public String authenticate(AuthenticationDataSource authData) throws Authenticat
}
}

@Override
public boolean authenticateHttpRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
HttpServletRequestWrapper wrappedRequest = new HttpServletRequestWrapper(request);
String httpHeaderValue = wrappedRequest.getHeader(HTTP_HEADER_NAME);
if (httpHeaderValue == null || !httpHeaderValue.startsWith(HTTP_HEADER_VALUE_PREFIX)) {
throw new AuthenticationException("Invalid HTTP Authorization header");
}
AuthenticationDataSource authenticationDataSource = new AuthenticationDataHttps(wrappedRequest);
String role = authenticate(authenticationDataSource);
request.setAttribute(AuthenticatedRoleAttributeName, role);
request.setAttribute(AuthenticatedDataAttributeName, authenticationDataSource);
return true;
}

@Override
public AuthenticationState newAuthState(AuthData authData, SocketAddress remoteAddress, SSLSession sslSession)
throws AuthenticationException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*/
package org.apache.pulsar.broker.authentication;

import static org.apache.pulsar.broker.web.AuthenticationFilter.AuthenticatedDataAttributeName;
import static org.apache.pulsar.broker.web.AuthenticationFilter.AuthenticatedRoleAttributeName;
import java.io.Closeable;
import java.io.IOException;
import java.util.ArrayList;
Expand All @@ -28,10 +30,12 @@
import java.util.stream.Collectors;
import javax.naming.AuthenticationException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.apache.pulsar.broker.PulsarServerException;
import org.apache.pulsar.broker.ServiceConfiguration;
import org.apache.pulsar.broker.web.AuthenticationFilter;
import org.apache.pulsar.common.sasl.SaslConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -85,16 +89,77 @@ public AuthenticationService(ServiceConfiguration conf) throws PulsarServerExcep
}
}

private String getAuthMethodName(HttpServletRequest request) {
return request.getHeader(AuthenticationFilter.PULSAR_AUTH_METHOD_NAME);
}

private AuthenticationProvider getAuthProvider(String authMethodName) throws AuthenticationException {
AuthenticationProvider providerToUse = providers.get(authMethodName);
if (providerToUse == null) {
throw new AuthenticationException(
String.format("Unsupported authentication method: [%s].", authMethodName));
}
return providerToUse;
}

public boolean authenticateHttpRequest(HttpServletRequest request, HttpServletResponse response)
throws Exception {
String authMethodName = getAuthMethodName(request);
if (authMethodName == null
&& SaslConstants.SASL_TYPE_VALUE.equalsIgnoreCase(request.getHeader(SaslConstants.SASL_HEADER_TYPE))) {
// This edge case must be handled because the Pulsar SASL implementation does not add the
// X-Pulsar-Auth-Method-Name header.
authMethodName = SaslConstants.AUTH_METHOD_NAME;
}
if (authMethodName != null) {
AuthenticationProvider providerToUse = getAuthProvider(authMethodName);
try {
return providerToUse.authenticateHttpRequest(request, response);
} catch (AuthenticationException e) {
if (LOG.isDebugEnabled()) {
LOG.debug("Authentication failed for provider " + providerToUse.getAuthMethodName() + " : "
+ e.getMessage(), e);
}
throw e;
}
} else {
for (AuthenticationProvider provider : providers.values()) {
try {
return provider.authenticateHttpRequest(request, response);
} catch (AuthenticationException e) {
if (LOG.isDebugEnabled()) {
LOG.debug("Authentication failed for provider " + provider.getAuthMethodName() + ": "
+ e.getMessage(), e);
}
// Ignore the exception because we don't know which authentication method is expected here.
}
}
// No authentication provided
if (!providers.isEmpty()) {
if (StringUtils.isNotBlank(anonymousUserRole)) {
request.setAttribute(AuthenticatedRoleAttributeName, anonymousUserRole);
request.setAttribute(AuthenticatedDataAttributeName, new AuthenticationDataHttps(request));
return true;
}
// If at least a provider was configured, then the authentication needs to be provider
throw new AuthenticationException("Authentication required");
} else {
// No authentication required
return true;
}
}
}

/**
* @deprecated use {@link #authenticateHttpRequest(HttpServletRequest, HttpServletResponse)}
*/
@Deprecated(since = "2.12.0")
public String authenticateHttpRequest(HttpServletRequest request, AuthenticationDataSource authData)
throws AuthenticationException {
String authMethodName = request.getHeader(AuthenticationFilter.PULSAR_AUTH_METHOD_NAME);
String authMethodName = getAuthMethodName(request);

if (authMethodName != null) {
AuthenticationProvider providerToUse = providers.get(authMethodName);
if (providerToUse == null) {
throw new AuthenticationException(
String.format("Unsupported authentication method: [%s].", authMethodName));
}
AuthenticationProvider providerToUse = getAuthProvider(authMethodName);
try {
if (authData == null) {
AuthenticationState authenticationState = providerToUse.newHttpAuthState(request);
Expand Down Expand Up @@ -140,10 +205,11 @@ public String authenticateHttpRequest(HttpServletRequest request, Authentication
/**
* Mark this function as deprecated, it is recommended to use a method with the AuthenticationDataSource
* signature to implement it.
* @deprecated use {@link #authenticateHttpRequest(HttpServletRequest, HttpServletResponse)}.
*/
@Deprecated
public String authenticateHttpRequest(HttpServletRequest request) throws AuthenticationException {
return authenticateHttpRequest(request, null);
return authenticateHttpRequest(request, (AuthenticationDataSource) null);
}

public AuthenticationProvider getAuthenticationProvider(String authMethodName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.pulsar.broker.authentication.AuthenticationDataHttps;
import org.apache.pulsar.broker.authentication.AuthenticationService;
import org.apache.pulsar.broker.authentication.AuthenticationState;
import org.apache.pulsar.common.sasl.SaslConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -52,54 +49,12 @@ public AuthenticationFilter(AuthenticationService authenticationService) {
this.authenticationService = authenticationService;
}

private boolean isSaslRequest(HttpServletRequest request) {
if (request.getHeader(SaslConstants.SASL_HEADER_TYPE) == null
|| request.getHeader(SaslConstants.SASL_HEADER_TYPE).isEmpty()) {
return false;
}
if (request.getHeader(SaslConstants.SASL_HEADER_TYPE)
.equalsIgnoreCase(SaslConstants.SASL_TYPE_VALUE)) {
return true;
} else {
return false;
}
}

@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
try {
HttpServletRequest httpRequest = (HttpServletRequest) request;
HttpServletResponse httpResponse = (HttpServletResponse) response;

if (!isSaslRequest(httpRequest)) {
// not sasl type, return role directly.
String authMethodName = httpRequest.getHeader(PULSAR_AUTH_METHOD_NAME);
String role;
if (authMethodName != null && authenticationService.getAuthenticationProvider(authMethodName) != null) {
AuthenticationState authenticationState = authenticationService
.getAuthenticationProvider(authMethodName).newHttpAuthState(httpRequest);
request.setAttribute(AuthenticatedDataAttributeName, authenticationState.getAuthDataSource());
role = authenticationService.authenticateHttpRequest(
(HttpServletRequest) request, authenticationState.getAuthDataSource());
} else {
request.setAttribute(AuthenticatedDataAttributeName,
new AuthenticationDataHttps((HttpServletRequest) request));
role = authenticationService.authenticateHttpRequest((HttpServletRequest) request);
}
request.setAttribute(AuthenticatedRoleAttributeName, role);

if (LOG.isDebugEnabled()) {
LOG.debug("[{}] Authenticated HTTP request with role {}", request.getRemoteAddr(), role);
}
chain.doFilter(request, response);
return;
}

boolean doFilter = authenticationService
.getAuthenticationProvider(SaslConstants.AUTH_METHOD_NAME)
.authenticateHttpRequest(httpRequest, httpResponse);

.authenticateHttpRequest((HttpServletRequest) request, (HttpServletResponse) response);
if (doFilter) {
chain.doFilter(request, response);
}
Expand All @@ -111,7 +66,6 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha
} else {
LOG.error("[{}] Error performing authentication for HTTP", request.getRemoteAddr(), e);
}
return;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -885,8 +885,8 @@ public void testTokenFromHttpParams() throws Exception {
doReturn("127.0.0.1").when(servletRequest).getRemoteAddr();
doReturn(0).when(servletRequest).getRemotePort();

AuthenticationState authState = provider.newHttpAuthState(servletRequest);
provider.authenticate(authState.getAuthDataSource());
boolean doFilter = provider.authenticateHttpRequest(servletRequest, null);
assertTrue(doFilter, "Authentication should have passed");
}

@Test
Expand All @@ -910,8 +910,8 @@ public void testTokenFromHttpHeaders() throws Exception {
doReturn("127.0.0.1").when(servletRequest).getRemoteAddr();
doReturn(0).when(servletRequest).getRemotePort();

AuthenticationState authState = provider.newHttpAuthState(servletRequest);
provider.authenticate(authState.getAuthDataSource());
boolean doFilter = provider.authenticateHttpRequest(servletRequest, null);
assertTrue(doFilter, "Authentication should have passed");
}

private static String createTokenWithAudience(Key signingKey, String audienceClaim, List<String> audience) {
Expand Down
Loading