내 커뮤니티 업적 표시줄을 확대합니다.

Submissions are now open for the 2026 Adobe Experience Maker Awards.

Mark Solution

활동이 없어 이 대화는 잠겼습니다. 새 게시물을 작성해 주세요.

해결됨

CQ Hybris connector always adds to anonymous user cart instead of current logged in CQ user cart.

Avatar

Level 2

Hi Guys,

I am using CQ-Hyrbis connector version 5.6.2 ( cq-commerce-hybris-impl-5.6.2.jar ) and Hybris version is 5.0.4.

When ever I add any thing to cart it always add to anonymous user cart instead of current logged in CQ user cart.

I suspect there is some issue in BasicAuthHandler implemented in connector which is not authenticating users correctly and it always gets anonymous user session from Hybris.

Also authenticateUser method implementation is not calling any web service that actually authenticates user instead it just returns credentials.

    public Map<String, String> authenticateUser(String username, String password) {
      
        final Map<String, String> authData = new HashMap<String, String>();
        authData.put(KEY_SESSION_USERNAME, username);
        try {
            authData.put(KEY_PASSWORD, crypto.protect(password));
        } catch (CryptoException e) {
            log.error("Could not encrypt password!");
            return null;
        }
        return authData;
    }

Appreciate if any one can give some pointers to fix the issue.

Thanks,

Madhav

1 채택된 해결책 개

Avatar

정확한 답변 작성자:
Level 10

AFAIK you need custom sling authentication handler at your project to convert anonymous cart to authenticated user.

원본 게시물의 솔루션 보기

3 답변 개

Avatar

Employee

Madhav,

If you are using CQ-Hybris Package 5.6.200, please look into OAuthHandler which is the primary AuthenticationHandler which is involved in Authenticating User's (authenticateUser) and Authenticating Sessions (authenticateSession).

The connector currently doesn't transfer a cart from a anonymous user to a authenticated user. To implement this functionality you would need to extend OauthHandler.authenticateUser() to pass in the JSESSIONID of the Hybris Session from DefaultHybrisService.signUp (which also needs to be extended).

Furthermore, make sure to extend OAUthHandler.authenticateSession() to pass the sessionId as JSESSIONID into header of the request.

Cheers

V

Avatar

Level 2

Hi Varun,

Thanks !

Can you please post some code snippets if you have, it would be really helpful.

Thanks,

Madhav

Avatar

정확한 답변 작성자:
Level 10

AFAIK you need custom sling authentication handler at your project to convert anonymous cart to authenticated user.