Hi All/Dhanushka

Found the issue. In carbon.xm we are specifying the hostname as localhost
but in this the url is local IP address.
So that truststores are failing. As a matter of fact I removed the
HttpURLConnectionVerifire like follow

HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier()
            {
                public boolean verify(String hostname, SSLSession session)
                {
                    // ip address of the service URL(like.23.28.244.244)
                    if (hostname.equals("10.100.5.68"))
                        return true;
                    return false;
                }
            });

as DarshanaG suggested. Now it works.

We can continue this either doing this or modifying carbon.xml

Cheers

On Mon, Sep 22, 2014 at 4:23 PM, Danushka Fernando <danush...@wso2.com>
wrote:

> This may be due to a file permission issue. Try pointing out to a separate
> copy of the jks file or try changing permission (to 777) of the file.
>
> Thanks & Regards
> Danushka Fernando
> Software Engineer
> WSO2 inc. http://wso2.com/
> Mobile : +94716332729
>
> On Mon, Sep 22, 2014 at 4:18 PM, Kasun Dissanayake <kas...@wso2.com>
> wrote:
>
>> Hi Danushka,
>>
>> I'll answer you according to number
>>
>> 1) This is the url of login. Since out publisher does not have any log in
>> api to call.  I'm getting the samlsso url and post form body from this.
>>      This gives me the samlsso url, and post body
>>
>> 2) I did that so i get the same error
>>
>> 3) yep. Get the error as unknown certificate.
>>
>> 4) The absolute file path of truststore
>>
>> On Mon, Sep 22, 2014 at 3:28 PM, Danushka Fernando <danush...@wso2.com>
>> wrote:
>>
>>> Hi Kasun
>>>
>>> Few questions
>>>
>>> 1. What is the purpose of *HttpRequestUtil.doGet(backEndUrl +
>>> "/publisher/login",requestHeaders)*
>>> 2. So AFAIU this line also do a http get call and you need to define
>>> system properties before this.
>>> 3. Did you try to debug the client? What were the findings?
>>> 4. What's the output of
>>> *System.out.println(System.getProperty("javax.net.ssl.**trustStore"));*
>>> ?
>>>
>>> Thanks & Regards
>>> Danushka Fernando
>>> Software Engineer
>>> WSO2 inc. http://wso2.com/
>>> Mobile : +94716332729
>>>
>>> On Mon, Sep 22, 2014 at 3:18 PM, Kasun Dissanayake <kas...@wso2.com>
>>> wrote:
>>>
>>>> Hi Danushka,
>>>>
>>>> This is my client code building using JDK 1.6
>>>>
>>>> public HttpResponse login(String userName, String password) throws
>>>> Exception {
>>>>
>>>>
>>>>         HttpResponse response = HttpRequestUtil.doGet(backEndUrl +
>>>> "/publisher/login",requestHeaders);
>>>>         if(response.getResponseCode()==200){
>>>>
>>>>
>>>>             this.requestHeaders.put("Content-Type",
>>>> "application/x-www-form-urlencoded");
>>>>
>>>>             String trustStore = System.getProperty("carbon.home") +
>>>>                     File.separator + "repository" +
>>>>                     File.separator + "resources" +
>>>>                     File.separator + "security" + File.separator +
>>>> "client-truststore.jks";
>>>>
>>>>             String responseData = response.getData();
>>>>
>>>>             System.setProperty("javax.net.ssl.trustStore", trustStore);
>>>>             System.setProperty("javax.net.ssl.trustStorePassword",
>>>> "wso2carbon");
>>>>             System.setProperty("javax.net.ssl.trustStoreType", "JKS");
>>>>             System.setProperty("carbon.repo.write.mode", "true");
>>>>
>>>>
>>>> System.out.println(System.getProperty("javax.net.ssl.trustStore"));
>>>>
>>>>             HttpResponse samlResponse = HttpRequestUtil.doPost(new
>>>> URL(extractSamlSSOURL(responseData)),createPostBodyForSAMLSSO(responseData),requestHeaders);
>>>>
>>>>         }
>>>>         return response;
>>>> }
>>>>
>>>>
>>>>
>>>> On Fri, Sep 19, 2014 at 8:41 PM, Danushka Fernando <danush...@wso2.com>
>>>> wrote:
>>>>
>>>>> Hi
>>>>> Here in Axis2 client what we really needs to set is truststore. But
>>>>> since in wso2carbon.jks it contains all trusted keys that contains in
>>>>> client-trustore.jks with wso2carbon.jks also it should work.
>>>>> Can you post the axis2client code here. Then we can have a look at it.
>>>>>
>>>>> Thanks & Regards
>>>>> Danushka Fernando
>>>>> Software Engineer
>>>>> WSO2 inc. http://wso2.com/
>>>>> Mobile : +94716332729
>>>>>
>>>>> On Fri, Sep 19, 2014 at 8:02 PM, Kasun Dissanayake <kas...@wso2.com>
>>>>> wrote:
>>>>>
>>>>>> Hi Manoj.
>>>>>>
>>>>>> It didn't work
>>>>>>
>>>>>> On Fri, Sep 19, 2014 at 7:18 PM, Manoj Kumara <ma...@wso2.com> wrote:
>>>>>>
>>>>>>> Hi Kasun,
>>>>>>>
>>>>>>> I believe you need to use 'client-truststore.jks' as the truststore
>>>>>>> not the keystore. This is not the direct example for your case but hope
>>>>>>> this might help [1].
>>>>>>>
>>>>>>> [1]
>>>>>>> http://manojwritenotes.blogspot.com/2014/04/how-to-invoke-secured-api-using.html
>>>>>>>
>>>>>>> Regards,
>>>>>>> Manoj
>>>>>>>
>>>>>>>
>>>>>>> *Manoj Kumara*
>>>>>>> Software Engineer
>>>>>>> WSO2 Inc. http://wso2.com/
>>>>>>> *lean.enterprise.middleware*
>>>>>>> Mobile: +94713448188
>>>>>>>
>>>>>>> On Fri, Sep 19, 2014 at 7:00 AM, Kasun Dissanayake <kas...@wso2.com>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> Hi All,
>>>>>>>>
>>>>>>>> I'm working with log in function in EAM test framework. I need to
>>>>>>>> log in to publisher and it will redirect me to samlsso. The url is
>>>>>>>> https://localhost:9443/samlsso with the body. Since this is a
>>>>>>>> secured port I have added following system properties.
>>>>>>>>
>>>>>>>>  String trustStore = System.getProperty("carbon.home") +
>>>>>>>>                     File.separator + "repository" +
>>>>>>>>                     File.separator + "resources" +
>>>>>>>>                     File.separator + "security" + File.separator +
>>>>>>>> "wso2carbon.jks";
>>>>>>>>             System.setProperty("javax.net.ssl.trustStore",
>>>>>>>> trustStore);
>>>>>>>>             System.setProperty("javax.net.ssl.trustStorePassword",
>>>>>>>> "wso2carbon");
>>>>>>>>             System.setProperty("javax.net.ssl.trustStoreType",
>>>>>>>> "JKS");
>>>>>>>>             System.setProperty("carbon.repo.write.mode", "true");
>>>>>>>>
>>>>>>>> but i get following error when i run the tests.
>>>>>>>>
>>>>>>>> javax.net.ssl.SSLHandshakeException:
>>>>>>>> java.security.cert.CertificateException: No subject alternative names
>>>>>>>> present
>>>>>>>>
>>>>>>>>
>>>>>>>> Any help?
>>>>>>>>
>>>>>>>>
>>>>>>>> Cheers
>>>>>>>>
>>>>>>>> --
>>>>>>>> Kasun Dissanayake
>>>>>>>> Software Engineer
>>>>>>>> WSO2 Inc.
>>>>>>>> Lean | Enterprise | Middleware
>>>>>>>> Tel - +94 77 086 2860
>>>>>>>> Skype - kasun.dissanayake4
>>>>>>>> LinkedIn - lk.linkedin.com/in/kasundis/
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> Dev mailing list
>>>>>>>> Dev@wso2.org
>>>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Kasun Dissanayake
>>>>>> Software Engineer
>>>>>> WSO2 Inc.
>>>>>> Lean | Enterprise | Middleware
>>>>>> Tel - +94 77 086 2860
>>>>>> Skype - kasun.dissanayake4
>>>>>> LinkedIn - lk.linkedin.com/in/kasundis/
>>>>>>
>>>>>> _______________________________________________
>>>>>> Dev mailing list
>>>>>> Dev@wso2.org
>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>>
>>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Kasun Dissanayake
>>>> Software Engineer
>>>> WSO2 Inc.
>>>> Lean | Enterprise | Middleware
>>>> Tel - +94 77 086 2860
>>>> Skype - kasun.dissanayake4
>>>> LinkedIn - lk.linkedin.com/in/kasundis/
>>>>
>>>
>>>
>>
>>
>> --
>> Kasun Dissanayake
>> Software Engineer
>> WSO2 Inc.
>> Lean | Enterprise | Middleware
>> Tel - +94 77 086 2860
>> Skype - kasun.dissanayake4
>> LinkedIn - lk.linkedin.com/in/kasundis/
>>
>
>


-- 
Kasun Dissanayake
Software Engineer
WSO2 Inc.
Lean | Enterprise | Middleware
Tel - +94 77 086 2860
Skype - kasun.dissanayake4
LinkedIn - lk.linkedin.com/in/kasundis/
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to