SSRS Authentication issue with stubs generated from WSDL

Krishna Sandeep 1 Reputation point
2022-12-12T12:54:47.453+00:00

We are using stubs generated from WSDL file. We using Authenticator.setDefault along with password authentication.
I found a peculiar issue while using client stub which was generated in past using JAX-WS(wsimport) for SSRS server. We observed that after one successful login attempt even if we use wrong password for subsequent requests the request is returning successful response.
Below is our code

Authenticator.setDefault(  
        new Authenticator() {  
          @Override  
          protected PasswordAuthentication getPasswordAuthentication() {  
            return new PasswordAuthentication(  
               getUserName(),getPassword().toCharArray());  
          }  
        });  

Later, we debugged further and found out that sun package HttpURLConnection uses the cached authorization key for connection from the AuthCache implementation. Worth to mention that it is part of sun package.

Now, our code is running with JDK11 which restricts to use the protected classes from sun package.

Below is sample stub that we are using

ReportingService2010 reportingService2010 = new ReportingService2010(reportServerUrl);  
  
ReportingService2010Soap reportingService2010Soap = reportingService2010.getReportingService2010Soap();  
  
reportingService2010Soap.listChildern(itemPath,isRecursive);  

Request from above mentioned code calls the HttpURLConnection implementation of sun package and tries to read the auth key from cache whether it exists or not. If yes, than use it without considering new credentials and connects, else add the auth key to the AuthCache for future usage.

Did anyone else face this issue? Is there any other way to fix this issue ? Are we missing something here?

Windows for business | Windows Server | Devices and deployment | Configure application groups
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.