ASF Bugzilla – Attachment 28519 Details for
Bug 53008
New test case for Basic Authenticator
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
patch file for test org.apache.catalina.authenticator.TestNonLoginAndBasicAuthenticator
patch.txt (text/plain), 3.08 KB, created by
Brian Burch
on 2012-03-30 12:21:42 UTC
(
hide
)
Description:
patch file for test org.apache.catalina.authenticator.TestNonLoginAndBasicAuthenticator
Filename:
MIME Type:
Creator:
Brian Burch
Created:
2012-03-30 12:21:42 UTC
Size:
3.08 KB
patch
obsolete
>Index: test/org/apache/catalina/authenticator/TestNonLoginAndBasicAuthenticator.java >=================================================================== >--- test/org/apache/catalina/authenticator/TestNonLoginAndBasicAuthenticator.java (revision 1297444) >+++ test/org/apache/catalina/authenticator/TestNonLoginAndBasicAuthenticator.java (working copy) >@@ -93,7 +93,7 @@ > @Test > public void testAcceptPublicBasic() throws Exception { > doTestBasic(USER, PWD, CONTEXT_PATH_LOGIN + URI_PUBLIC, >- false, 200, false, 200); >+ false, false, 200, false, 200); > } > > /* >@@ -104,10 +104,22 @@ > @Test > public void testAcceptProtectedBasic() throws Exception { > doTestBasic(USER, PWD, CONTEXT_PATH_LOGIN + URI_PROTECTED, >- true, 401, false, 200); >+ false, true, 401, false, 200); > } > > /* >+ * Try to access a protected resource in a webapp that >+ * has a BASIC login method defined. Verify the server is >+ * prepared to accept non-standard case for the auth scheme. >+ * The access should be challenged, authenticated and then permitted. >+ */ >+ @Test >+ public void testAuthMethodCaseBasic() throws Exception { >+ doTestBasic(USER, PWD, CONTEXT_PATH_LOGIN + URI_PROTECTED, >+ true, true, 401, false, 200); >+ } >+ >+ /* > * Logon to access a protected resource in a webapp that uses > * BASIC authentication. Wait until that session times-out, > * then re-access the resource. >@@ -117,11 +129,11 @@ > @Test > public void testBasicLoginSessionTimeout() throws Exception { > doTestBasic(USER, PWD, CONTEXT_PATH_LOGIN + URI_PROTECTED, >- true, 401, false, 200); >+ false, true, 401, false, 200); > // wait long enough for the session above to expire > Thread.sleep(LONG_TIMEOUT_DELAY_MSECS); > doTestBasic(USER, PWD, CONTEXT_PATH_LOGIN + URI_PROTECTED, >- true, 401, false, 200); >+ false, true, 401, false, 200); > } > > /* >@@ -134,7 +146,7 @@ > @Test > public void testBasicLoginRejectProtected() throws Exception { > doTestBasic(USER, PWD, CONTEXT_PATH_LOGIN + URI_PROTECTED, >- true, 401, false, 200); >+ false, true, 401, false, 200); > doTestNonLogin(CONTEXT_PATH_NOLOGIN + URI_PROTECTED, > true, 403); > } >@@ -163,6 +175,7 @@ > } > > private void doTestBasic(String user, String pwd, String uri, >+ boolean verifyAuthSchemeCase, > boolean expectedReject1, int expectedRC1, > boolean expectedReject2, int expectedRC2) throws Exception { > >@@ -190,7 +203,8 @@ > String credentials = user + ":" + pwd; > byte[] credentialsBytes = ByteChunk.convertToBytes(credentials); > String base64auth = Base64.encode(credentialsBytes); >- String authLine = "Basic " + base64auth; >+ String authScheme = verifyAuthSchemeCase ? "bAsIc " : "Basic "; >+ String authLine = authScheme + base64auth; > > List<String> auth = new ArrayList<String>(); > auth.add(authLine);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 53008
: 28519