Merged branch 'jetty-9.4.x' into 'master'.
This commit is contained in:
commit
fb8c738a63
|
@ -38,6 +38,12 @@ import org.eclipse.jetty.util.Attributes;
|
|||
*/
|
||||
public interface Authentication
|
||||
{
|
||||
/**
|
||||
* Constant used to indicate that any realm will match.
|
||||
* @see #matches(String, URI, String)
|
||||
*/
|
||||
public static final String ANY_REALM = "<<ANY_REALM>>";
|
||||
|
||||
/**
|
||||
* Matches {@link Authentication}s based on the given parameters
|
||||
* @param type the {@link Authentication} type such as "Basic" or "Digest"
|
||||
|
|
|
@ -52,7 +52,7 @@ public abstract class AbstractAuthentication implements Authentication
|
|||
if (!getType().equalsIgnoreCase(type))
|
||||
return false;
|
||||
|
||||
if (!this.realm.equals(realm))
|
||||
if (!this.realm.equals(ANY_REALM) && !this.realm.equals(realm))
|
||||
return false;
|
||||
|
||||
return matchesURI(this.uri, uri);
|
||||
|
|
|
@ -119,6 +119,14 @@ public class HttpClientAuthenticationTest extends AbstractHttpClientServerTest
|
|||
test_Authentication(new BasicAuthentication(uri, realm, "basic", "basic"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_BasicAnyRealm() throws Exception
|
||||
{
|
||||
startBasic(new EmptyServerHandler());
|
||||
URI uri = URI.create(scheme + "://localhost:" + connector.getLocalPort());
|
||||
test_Authentication(new BasicAuthentication(uri, Authentication.ANY_REALM, "basic", "basic"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_DigestAuthentication() throws Exception
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue