Quantcast
Channel: Adobe Community : Unanswered Discussions - Digital Marketing Suite
Viewing all 937 articles
Browse latest View live

form component

0
0

Hi All,

            I am trying to customise form component.I have copied form component from libs/foundation/components/form to apps/xxx/components/form

When i drag and drop this customised form component from sidekick and place it in parsys ,i only get start of form  but end of form  is missing.

       Without end of form, the form cannot be submitted.

Any ideas on how to do this?

 

Thanks in advance!!!


fsresource - runmode config stored in crx via xml

0
0

Hi, i'm using the fsresource sling extension to access the filesystem when working on JSP, JS, CSS and so on. When just yanking the bundle into the crx and configuring it via the OSGi console, everything works as expected. But when i try to add a new runmode (configurtion), the result is unsatisfying.

 

config/src/main/content/jcr_root/apps/samples/config/org.apache.sling.fsprovider.internal.FsResourceProvider.factory.config.xml

 

Is the path of the main configuration, which i'm using on a local instance to figure out, how to achieve the desired results, but the best i could get was an unbound configuration displayed in the system/console/configMgr. The contents of the XML file:

 

<?xml version="1.0" encoding="UTF-8"?><jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"          jcr:primaryType="sling:OsgiConfig"          provider.roots="/apps/ui-samples"          provider.file="/Volumes/samples/ui/src/main/content/jcr_root/apps/ui-samples"          provider.checkinterval="1000"/>

How to include java class in some other bundle?

0
0

Hi All,

 

I have created two bundles like bundle X and bundles Y in CQ5.

 

Bundle X has class A and Bundles Y has class B. Here I need to access class B inside bundle X.

 

How can I access class which is in another bundle? Could someone tell me how can I do this.

 

Thanks!

CQ5.5 SSO Authentication Handler Issue - Not Reading HTTP Request Header from Sling Filter

0
0

Software Configuration: CQ5.5 service pack 2.1 (cq-service-pack-5.5.2.20121012.zip) Windows XP machine

 

I am trying to integrate our internal SSO API to enable SSO with LDAP on CQ5.5 service pack 2.1.

 

SSO and LDAP is configured as per the below Adobe CQ5.5 links.

 

SSO - http://dev.day.com/docs/en/cq/5-5/deploying/configuring_cq.html#Single %20Sign%20On

 

LDAP - http://dev.day.com/docs/en/cq/5-5/deploying/configuring_ldap.html

 

As part of the SSO implementation I am passing a validated userId to Day CQ SSO Authentication Handler inside a Sling Filter by setting a HTTP Header with the help of decorator pattern or Fake Http request.


Please find below repository.xml, ldap_login.conf, start.bat and bestssoheaderfilter-1.0-SNAPSHOT.jar bundle source files with this discussion.

 

BestSlingHeaderFilter.java, FakeHeadersRequest.java

 

I can see in the error.log file that the request Header name / value has been passed by the Sling Filter chain correctly but still Day CQ SSO Authentication Handler is unable to extract credentials and failed back to login as annonymous

 

I am using Decorator pattern to create fake http request in order to add Http Header to the original request. It looks like the Sling Filter inside OSGI bundle is able to add the Http Header with the username value but Day CQ SSO Authentication Handler is still complaining and failing back to anonymous user.

 

repository.xml

repositoryxml.jpg

ldap_login.conf

 

ldap_conf.jpg

 

start.bat

 

startbat.jpg

 

Day CQ SSO Authentication Handler Configuration

 

DayCQSSOAuthenticationHandler-bundle.jpg

 

CQ Authenicator

 

Authenticator.jpg

bestssoheaderfilter-1.0-SNAPSHOT.jar - source code files

 

BestSlingHeaderFilter.java as Sling Filter

 

package com.sso.header.filter.osgi;

 

import org.apache.felix.scr.annotations.Property;
import org.apache.felix.scr.annotations.sling.SlingFilter;
import org.apache.felix.scr.annotations.sling.SlingFilterScope;
import org.apache.sling.api.SlingHttpServletResponse;
import org.slf4j.Logger; import org.slf4j.LoggerFactory;
import org.apache.sling.api.SlingHttpServletRequest;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.Enumeration;

 

 

@SlingFilter( label = "Header Sling Filter",
                   description = "Implementation of a Sling Filter for setting HTTP Header",
                   metatype = true,
                  generateComponent = true, // True if you want to leverage activate/deactivate
                  generateService = true,
                 order = -2000,
                 scope = SlingFilterScope.REQUEST) // REQUEST, INCLUDE, FORWARD, ERROR, COMPONENT (REQUEST, INCLUDE, COMPONENT)

 

  @Property(name = "_usernameHeader", value = "SM_USER")
public class BestSlingHeaderFilter implements javax.servlet.Filter {

 

     private static final Logger logger = LoggerFactory.getLogger(BestSlingHeaderFilter.class);
     private static String _usernameHeader;

 

     public void destroy() {     }

 

     public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException    {        

 

      if (servletRequest instanceof SlingHttpServletRequest && servletResponse instanceof SlingHttpServletResponse) {

             //cast the object
             SlingHttpServletRequest slingRequest = (SlingHttpServletRequest) servletRequest;
             SlingHttpServletResponse slingResponse = (SlingHttpServletResponse) servletResponse;

 

            FakeHeadersRequest localFakeHeadersRequest = new FakeHeadersRequest(slingRequest);

 

            localFakeHeadersRequest.setHeader("SM_USER", "abc");
            localFakeHeadersRequest.setHeader("SM_AUTHENTIC", "YES");
             localFakeHeadersRequest.setHeader("SM_AUTHORIZED", "YES");

 

             logger.debug("sso request username " + localFakeHeadersRequest.getHeader("SM_USER"));

 

             Enumeration headerNames = localFakeHeadersRequest.getHeaderNames();

 

             while(headerNames.hasMoreElements()) {
                String hn = headerNames.nextElement();
                String value =   localFakeHeadersRequest.getHeader(hn);
                logger.debug("header names and values " + hn + " " + value);
            }  
          //otherwise, continue on in the chain with the ServletRequest and ServletResponse objects
            filterChain.doFilter(localFakeHeadersRequest, slingResponse);  
      }
    }
    public void init(FilterConfig paramFilterConfig)             throws ServletException { 
       _usernameHeader = paramFilterConfig.getInitParameter("usernameHeader");
        if ((_usernameHeader == null) || ("".equals(_usernameHeader)))
            _usernameHeader = "SM_USER";   
}
}

 

FakeHeadersRequest.java

 

package com.sso.header.filter.osgi;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.wrappers.SlingHttpServletRequestWrapper;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import java.util.*;

 

public class FakeHeadersRequest extends SlingHttpServletRequestWrapper {

 

    private final Map _fakeHeaders;
    /**      * @param request SlingHttpServletRequest.      */
    public FakeHeadersRequest(SlingHttpServletRequest request) {
         super(request);
        _fakeHeaders = request.getSession().getAttribute("_fakeHeaders")==null ?  new HashMap() : (Map)     request.getSession().getAttribute("_fakeHeaders");

 

        request.getSession().setAttribute("_fakeHeaders", _fakeHeaders);
    }

 

 

 

     @Override
    public String getHeader(String name) {
        //get the request object and cast it
         final SlingHttpServletRequest request = (SlingHttpServletRequest)getRequest();
         return _fakeHeaders.containsKey(name) ? _fakeHeaders.get(name) : request.getHeader(name);
    }

 

 

 

     public void setHeader(String name, String value){ 
       _fakeHeaders.put(name, value);
     }

 

     @Override 
   public Enumeration getHeaderNames() {
        final SlingHttpServletRequest request = (SlingHttpServletRequest)getRequest();
        final Set list = new HashSet();         //loop over request headers from wrapped request object 
       final Enumeration e = request.getHeaderNames();
        while(e.hasMoreElements()) {
             list.add(e.nextElement()); 
       } 
       list.addAll(_fakeHeaders.keySet());
         //create an enumeration from the list and return 
       final Enumeration en = Collections.enumeration(list);
        return en;  
  }
}

 

 

How SSO process works:

 

Step 1) HTTP request with kerberos authentication is validated with internal system and a valid userId is set as the request principal name. The internal kerberos validation is configured as a Sling filter and uploaded as OSGI bundle on CQ5.5

 

Step 2) A Fake HTTP request (based on Decorator pattern) is created to set existing HTTP request with HTTP Header name as SM_USER and value as the above validated userId. This is achieved by configuring Sling filter and uploaded as OSGI bundle on CQ5.5

 

Step 3) CQ5.5 SSO Authnetication Handler bundle is configured to extract valid userId from the Http request Header Name as SM_USER.

 

Issue: SSO Authentication Handler is unable to extract userId from the HTTP request header name SM_USER due to which SSO is failing and CQ5.5 redirects to login page. The CQ5.5 login page flashes and I can see below message in the CQ5.5

 

error.log file:

 

25.03.2013 06:19:45.647 *DEBUG* [127.0.0.1 [1364206785647] GET /favicon.ico HTTP/1.1] com.day.cq.auth.impl.SsoAuthenticationHandler forceAuthentication: Not forcing authentication because request parameter sling:authRequestLogin is not set 25.03.2013 06:19:45.647

 

*DEBUG* [127.0.0.1 [1364206785647] GET /favicon.ico HTTP/1.1] org.apache.sling.auth.core.impl.HttpBasicAuthenticationHandler forceAuthentication: Not forcing authentication because request parameter sling:authRequestLogin is not set 25.03.2013 06:19:45.647

 

*DEBUG* [127.0.0.1 [1364206785647] GET /favicon.ico HTTP/1.1] org.apache.sling.auth.core.impl.SlingAuthenticator getAuthenticationInfo: no handler could extract credentials; assuming anonymous 25.03.2013 06:19:45.647

 

*DEBUG* [127.0.0.1 [1364206785647] GET /favicon.ico HTTP/1.1] org.apache.sling.auth.core.impl.SlingAuthenticator doHandleSecurity: No credentials in the request, anonymous 25.03.2013 06:19:45.647

 

*INFO* [127.0.0.1 [1364206785647] GET /favicon.ico HTTP/1.1] org.apache.sling.auth.core.impl.SlingAuthenticator getAnonymousResolver: Anonymous access not allowed by configuration - requesting credentials 25.03.2013 06:19:45.647

 

*DEBUG* [127.0.0.1 [1364206785647] GET /favicon.ico HTTP/1.1] org.apache.sling.auth.core.impl.SlingAuthenticator login: requesting authentication using handler: com.day.cq.auth.impl.LoginSelectorHandler@1ebe57

 

How to reproduce

 

Step 1) Create a OSGI bundle from the source code (BestSlingHeaderFilter.java, FakeHeadersRequest.java) and deploy as OSGI bundle to CQ5.5 service pack 2.1. The source file has been configured with Http request Header Name SM_USER with hard coded value as abc.

 

Step 2) Configure CQ5.5 SSO Authentication Handler bundle to extract userId by setting HTTP Header Name as SM_USER.

 

Step 3) Create a user name with "abc" on CQ5.5 to skip LDAP configuration

 

Step 4) Try to login to CQ5.5 by hitting http://localhost:7402.

 

Step 5) UserId "abc" should see CQ5.5 Welcome screen and should not be prompted with login screen to input userId manually.

 

Step 6) Chec the error.log and search for "SM_USER" or SSO Authentication Handler and you should not see any message as "No credentials in the request, anonymous".

Audit log of the User access and permissions

0
0

Hi All,

 

We need to have the Audit trail of the user access and permission. Meaning Changes to user access rights will be logged.

This should include:

Current Access Rights (including Date the access was given),

Group membership (including Date the access was given),

Previous Access Rights (including Date the access was given and revoked).

 

Can we reuse any out of the box functionality of CQ. Does anybody having any pointer to this?

 

Thanks,

Debasis

How to convert old Java Servlets to OSGi "Servlet" Bundles

0
0

Hello I'm looking for some help/insight on the best way to convert some of our old Java Servlet code into new OSGi Bundles that can be accessed as servlets.  I'd like to be able to install the new bundles then access them on one of our CQ instance using something like "/servlet/servlet_name".

 

So far I've been able to create a new bundle, and install it into CQ but I haven't been able to access the bundle at the servlet mapping URL that I would expect.  So far what I've found online has lead me to believe that I need to use the Felix Annotations to describe my servlet.

 

@Component(immediate = true, metatype = true, label = "Servlet Name")

@Service

@Properties({

    @Property(name = Constants.SERVICE_DESCRIPTION, value = "Servlet Name"),

    @Property(name = "sling.servlet.methods", value={"GET"}),

    @Property(name = "sling.servlet.paths", value = "/servlet/my_servlet_mapping"),

    @Property(name = Constants.SERVICE_VENDOR, value = "VendorName")

})

 

public class TellAFriend extends HttpServlet {...

 

public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException

    {....

 

Once I have this installed, and running without an error in the logs for CQ I tried to go on my local instance to http://localhost:4502/servlet/my_servlet_mapping but I only get 404 Resource Not Found errors.  I've even gone to the Sling Resource Resolver and it doesn't resolve to anything either.

 

Is there more than the Servlet Information need into the Annotations to convert "old" code into a new OSGi Servlet Mapped Bundle?

Regarding multiple Images

0
0

How to put multiple images in a dialog using xtype multifield

Pathfield references in custom multifield not getting updated on page move or rename

0
0

We're using a custom multified to store link title, link path (pathfield) as well as a checkbox as to wether the link should open in a new browser window.  CQ 5.4 (we're in the process of moving to 5.5 and assume it works the same) ends up storing this information in a delimited string[].  Not only does this cause issues when an author uses the delimeter character in the link name, but more importantly it seems as though CQ doesn't update the pathfield reference if the target page is moved (or renamed.) 

 

Is there anyway to influence the way multifield is storing this data in the JCR so that it automatically updates references when the target page is moved?

 

Thanks,

Tim


Error while processing /libs/commerce/content/import.html

0
0

hello every body;

I wanna import a catalog from hybris to cq5, I fill the form when I click import catalog; it gives me this error:

Error while processing /libs/commerce/content/import.html

thanks for your help;

Syntax for a form posting to a post handler

0
0

So I have a component with a component JSP that contains :

 

<form id="flagMessage" name="flagMessage" method="POST" action="/post.POST.html">

   <input type="textarea" name="reason" rows="4" cols="50"/><br>

   <input type="submit" value="Submit"/>

   <input type="button" value="Cancel" onclick="$CQ('#<%=id%>-flag-form').toggle()"/>

</form>

 

then I have a post handler in the component at /actions/post.POST.jsp

 

I end up getting a 500 where it complains about the property reason, referring to my textarea. A log statement in my handler never gets written to the log. I haven't had to do something like this in a long time and I know its something small that I am missing, but I couldn't put my finger on it.

Workflow data transfer from one process to another process

0
0

We recently upgraded to CQ 5.6, and the data sharing between workflow process is not working properly, it was working fine with 5.4 version. Please check the snippet below

 

workItem.getWorkflowData().getMetaDataMap().put("test", "data transfer between processes");

doesn't seems to get populated.

 

Digging deep into it, we found that the implementation has been changed with a wrapper CQWorkflowDataWrapper, which returns newly instantiated map each time

public MetaDataMap getMetaDataMap()

    {

        return new CQMetaDataMap(graniteData.getMetaDataMap());

    }

 

With CQ 5.4, we get the following

 

String test =workItem.getWorkflowData().getMetaDataMap().get("test");

 

However, in CQ 5.6, the String test value is null...as the map was not populated.

 

Is there any other way to pass the desired result(any object) from one process to other process?

Search pages using localized translated tag titles:

0
0

ENV: CQ5.4

 

Suppose I have a Tag created with the name 'XYZ' and I have translated localized titles for the same tag as:

§  EN: ABC

  • DE: DEF
  • FR: GHI
  • ES: JKL

Now if an user would search for 'XYZ' he would always find pages which are tagged with the above tag regardless which language tree she/he is browsing. But if the user is search for 'ABC' in the English language tree, no result is displayed. So the requirement is to include the localized translated tag titles will be part of the search. Moreover an user in the EN tree would find a result if he enters 'XYZ' or entered 'ABC', but no result would be found if the search term is 'DEF' as "DEF' is for DE tree.

 

Any help/pointers on this would be appreciated.

 

How to implement the create verision action?

0
0

Hi guys:

       I want to know how to implement the create version action via my servlet java code which in the side kick "versioning" tab,do you have some example code to use for reference, thanks!sidekick.jpg

Sling Ordered Folder is not working in cq 5.5 spy

0
0

Hi,

 

We are trying to add folders in the cq dam they are not ordering. When we create folder by default it creates sling:OrderedFolder but still ordering is not working. Is this a bug in 5.5 sp2?

 

When we go to content explorer and create the node manullay of type sling:folder and add the folders below that node then they are ordering properly. This looks strange it seems it is working in reverse. But the for the second level of ordering it fails.

 

Please pass on your observations if you have faced this issue earlier.

While i trying to edit the parsys component in design mode i couldn't find Popup

0
0

While i trying to edit the parsys component in edit mode i couldn't find Popup, so i am not able to add the components into Sidekick..

 

can you please help me?

 

Thanks in advance!!!!!


Dispatcher - Load Balancing configuration

0
0

Hi Folks,

 

Is it possible to configure dispatcher to send requests from one user to same publisher instance (publishers are load balanced).

 

Its kind of implementing stickly sessions for publisher instances (on top of WebServers)

 

Thanks,

Adnan

How to get a TagManager instance?

0
0

Hey there!

 

I'm trying within one of my components to get a reference to a valid TagManager so that I can call resolve on some Tag IDs that I have.

 

The documentation I've read says to do either:

TagManager tagManager = JcrTagManagerFactory.getTagManager(session);

TagManager tagManager = resourceResolver.adaptTo(ResourceResolver.class);

 

but I can't get either of these to work. Anyone have any code they've used in a component to get a TagManager?

Error: java.io.IOException: Slave was unable to connect to : Operation timed out

0
0

Hi there,

 

I am trying to configure 2 instances of CQ 5.5 author clustering through GUI using Shared Nothing clustering as mentioned on online documentation link below.

 

http://dev.day.com/content/docs/en/crx/current/administering/cluster.h tml#GUI Setup of Shared Nothing Clustering

 

No firewall rules on both master and slave.

 

When I try to join the slave, I am getting "Error: java.io.IOException: Slave was unable to connect to <master IP Address>: Operation timed out after 1000 ms."

The error log in master shows "[Master (2907a049-202f-4c73-a7da-5d5eb81a21b9) - Socket connector] com.day.crx.core.cluster.ClusterMaster I/O error while processing connect. java.net.SocketTimeoutException: Read timed out"

 

I read from the above link of 'socketTimeout' param and has it configured in master's repository.xml under Cluster element. Entry I made is:  <param name="socketTimeout" value="60000" />

 

I tried configuring that param on both slave and master but still getting this error.

 

I could telnet both ways using both instances' respective ports as well as default "8088" clustering ports.

 

I was wondering if anybody from the board can give me directions on how to resolve this issue.

 

Appreciate any response....Thanks.

How to order Standard HTTP Filter as OSGI components

0
0

I have an issue where I would like to order 2 standard filters deployed as OSGI components on Adobe CQ5.5 - Apache Felix console - so that filter A should run first and filter B should run second in the sequence. Do you know if there is any OSGI or SCR property which can order 2 filters in sequence so that one should run after another?

 

For example:

 

Filter A

 

@Component

@Service @org.apache.felix.scr.annotations.Properties({

         @Property(name = "pattern", value = "/.*"),

        @Property(name = Constants.SERVICE_RANKING, intValue = 99999, propertyPrivate = false)

})

public class FilterA implements implements javax.servlet.Filter  { }

 

FilterB

 

@Component

@Service @org.apache.felix.scr.annotations.Properties({

        @Property(name = "pattern", value = "/.*"),

        @Property(name = Constants.SERVICE_RANKING, intValue = 100000, propertyPrivate = false)

})

public class FilterB implements implements javax.servlet.Filter  { }

 

I would like to run FilterA first and then FilterB. If I deploy the above filters as OSGI bundle on CQ5.5 then I only see FilterB is registered on the HTTP White board console. I do not see FilterA being even registered on Http White board or being invoked in request flow. Thanks.

Restricting LDAP Users

0
0

I am setting up Day CQ.

 

The client wants to use the existing LDAP! this is fine we can configure the same.

 

The problem is that the LDAP has 1000+ users, out of those only 100+- are supposed to have access to CQ Author.

 

Is there a way of restricting it?

 

Thanks,

Prem Pratick Kumar

Viewing all 937 articles
Browse latest View live




Latest Images