Keep alert of Abnormal things - Problem Solving Skills


In the post Read the Error Message - Problem Solving Skills, we mentioned that the first step of troubleshooting is to read and understand the error message.

During reading the error message/log, it's important to keep alert of unusual things/messages and guess possible causes.

Scenario 1 - In Memory Test User not work in Rest-Assured
After developed the feature Spring Security: Integrate In-Memory Authentication for Test Automation, another developer is using it to write automation test  - using Rest-Assured and reusing the session filter.

I was told that it didn't work and asked to help troubleshoot it.

First step: reproduce the problem
If we run the code that uses rest assured with the test user and session filter, it failed.
But I can use the test user to login admin ui in the browser. - This is weird, I should pay more attention to this unusual thing and think about possible causes, but I didn't at that time.

Then I found the following message in the log:
-- This is wired, as I am using the test user - spring should use the in-memory DaoAuthenticationProvider to verify it; it should only call ActiveDirectoryLdapAuthenticationProvider if it's not the in-memory user.

INFO 144038 [http-nio-0.0.0.0-8080-exec-10] org.springframework.security.ldap.authentication.ad.ActiveDirectoryLdapAuthenticationProvider   - Active Directory authentication failed: Supplied password was invalid

Now I check the code more carefully and found out that it uses wrong username: uses 'admin-123' instead of 'admin_123'. admin-123 is not in-memory user, so it calls ActiveDirectoryLdapAuthenticationProvider for authentication and it failed obviously.

Actually if I read rest-assured logs more carefully, I should have found the root cause early.
00:05:05.553 [main] DEBUG org.apache.http.headers - >> POST /xapp/j_spring_security_check HTTP/1.1
00:05:24.564 [main] DEBUG org.apache.http.wire -  << "HTTP/1.1 302 Found[\r][\n]"
00:05:24.568 [main] DEBUG org.apache.http.wire -  << "Set-Cookie: JSESSIONID=9C03D491F56D6CDC007FA931898F5504; Path=/xapp/; HttpOnly[\r][\n]"

00:05:24.568 [main] DEBUG org.apache.http.wire -  << "Location: http://localhost:8080/xapp/loginerror;jsessionid=9C03D491F56D6CDC007FA931898F5504[\r][\n]"

Labels

adsense (5) Algorithm (69) Algorithm Series (35) Android (7) ANT (6) bat (8) Big Data (7) Blogger (14) Bugs (6) Cache (5) Chrome (19) Code Example (29) Code Quality (7) Coding Skills (5) Database (7) Debug (16) Design (5) Dev Tips (63) Eclipse (32) Git (5) Google (33) Guava (7) How to (9) Http Client (8) IDE (7) Interview (88) J2EE (13) J2SE (49) Java (186) JavaScript (27) JSON (7) Learning code (9) Lesson Learned (6) Linux (26) Lucene-Solr (112) Mac (10) Maven (8) Network (9) Nutch2 (18) Performance (9) PowerShell (11) Problem Solving (11) Programmer Skills (6) regex (5) Scala (6) Security (9) Soft Skills (38) Spring (22) System Design (11) Testing (7) Text Mining (14) Tips (17) Tools (24) Troubleshooting (29) UIMA (9) Web Development (19) Windows (21) xml (5)