Hi all,

I reproduced this issue. When we log in with Basic Auth Credentials, the
CarbonContext does not have the Username as it seems. Shariq can you look
into this?

Here is a basic code snippet to try this out if you have G-Reg.

import
org.wso2.carbon.automation.api.clients.registry.SearchAdminServiceClient;
import
org.wso2.carbon.registry.search.metadata.test.bean.SearchParameterBean;
import org.wso2.carbon.registry.search.stub.beans.xsd.ArrayOfString;
import
org.wso2.carbon.registry.search.stub.beans.xsd.CustomSearchParameterBean;
import java.io.File;

public static void main(String[] args) throws Exception {
        System.setProperty("javax.net.ssl.trustStore",
"D:\\Work\\Downloads\\wso2greg-4.5.3" + File.separator + "repository" +
                File.separator + "resources" + File.separator + "security"
+ File.separator +
                "wso2carbon.jks");
        System.setProperty("javax.net.ssl.trustStorePassword",
"wso2carbon");
        System.setProperty("javax.net.ssl.trustStoreType", "JKS");
        SearchAdminServiceClient searchAdminServiceClient =
                new SearchAdminServiceClient("
https://localhost:9443/services/";,
                        "admin", "admin");
        CustomSearchParameterBean searchQuery = new
CustomSearchParameterBean();
        SearchParameterBean paramBean = new SearchParameterBean();
        paramBean.setResourceName("testService");

        ArrayOfString[] paramList = paramBean.getParameterList();

        searchQuery.setParameterValues(paramList);
        searchAdminServiceClient.saveAdvancedSearchFilter(searchQuery,
"boo");
    }

On Sat, Dec 15, 2012 at 1:16 PM, Senaka Fernando <[email protected]> wrote:

> Hi Shariq,
>
> On Sat, Dec 15, 2012 at 12:07 PM, Muhammed Shariq <[email protected]> wrote:
>
>> On Fri, Dec 14, 2012 at 4:16 PM, Dimuthu Leelarathne 
>> <[email protected]>wrote:
>>
>>> Hi Senaka,
>>>
>>> Username in Carbon Context is null. I am debugging more to find out how
>>> the username in CC got set to null.
>>>
>>
>> We fixed a similar issue recently. Recently Sinthuja did a fix to give
>> priority to the ThreadLocal CC instead of MessageContext. The CC was not
>> getting initialized properly for the login request cz the TomcatValve
>> wasn't initializing the tenant's CC, reason for that is the login request
>> (/carbon/admin/login_action.jsp) doesn't have tenant info ..
>>
>> We fixed this by using current MessageContext to populate the CC for post
>> login operations (fix in LoggedUserInfoAdmin) .. diff is as follows;
>>
>> -            UserRealm userRealm = getUserRealm();
>> +           UserRealm userRealm = (UserRealm) PrivilegedCarbonContext.
>> getCurrentContext(messageContext).getUserRealm();
>>
>
> That's a hack.
>
>>
>> You could try this fix just to verify if the issue ur facing has anything
>> to do with CC hierarchy ...
>>
>> Also I changed the tomcat valve to set the username when it gets hit ..
>> but in the CC class, it doesn't try to fetch the username if its null,
>> it merely does a return expecting upstream code set it .. which is not
>> happening ..
>>
>
> That has to happen. We need to locate this and fix it. It should be some
> combination of calls which ends up leading into this.
>
> Thanks,
> Senaka.
>
>>
>>
>>> thanks,
>>> dimuthu
>>>
>>>
>>> On Fri, Dec 14, 2012 at 3:49 PM, Senaka Fernando <[email protected]>wrote:
>>>
>>>> Hi Dimuthu,
>>>>
>>>> What's null? Based on that, please check back the stacktrace to see how
>>>> that value is obtained and passed into UM - because IIRC we don't construct
>>>> anything about users and/or permissions within the registry kernel. And,
>>>> from what I understand it seems that the CCtx does not seem to have the
>>>> proper value of something.
>>>>
>>>> Thanks,
>>>> Senaka.
>>>>
>>>> On Fri, Dec 14, 2012 at 2:57 PM, Dimuthu Leelarathne <[email protected]
>>>> > wrote:
>>>>
>>>>> ManageGenericArtifactService
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> * <http://wso2con.com/>
>>>> *
>>>> *
>>>>
>>>> Senaka Fernando*
>>>> Member - Integration Technologies Management Committee;
>>>> Technical Lead; WSO2 Inc.; http://wso2.com*
>>>> Member; Apache Software Foundation; http://apache.org
>>>>
>>>> E-mail: senaka AT wso2.com
>>>> **P: +1 408 754 7388; ext: 51736*; *M: +94 77 322 1818
>>>> Linked-In: http://linkedin.com/in/senakafernando
>>>>
>>>> *Lean . Enterprise . Middleware
>>>>
>>>>
>>>
>>> _______________________________________________
>>> Dev mailing list
>>> [email protected]
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>>
>> --
>> Thanks,
>> Shariq.
>> Phone: +94 777 202 225
>>
>>
>
>
> --
> * <http://wso2con.com/>
> *
> *
>
> Senaka Fernando*
> Member - Integration Technologies Management Committee;
> Technical Lead; WSO2 Inc.; http://wso2.com*
> Member; Apache Software Foundation; http://apache.org
>
> E-mail: senaka AT wso2.com
> **P: +1 408 754 7388; ext: 51736*; *M: +94 77 322 1818
> Linked-In: http://linkedin.com/in/senakafernando
>
> *Lean . Enterprise . Middleware
>
>


-- 
* <http://wso2con.com/>
*
*

Senaka Fernando*
Member - Integration Technologies Management Committee;
Technical Lead; WSO2 Inc.; http://wso2.com*
Member; Apache Software Foundation; http://apache.org

E-mail: senaka AT wso2.com
**P: +1 408 754 7388; ext: 51736*; *M: +94 77 322 1818
Linked-In: http://linkedin.com/in/senakafernando

*Lean . Enterprise . Middleware
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to