Expand my Community achievements bar.

SOLVED

Apache sling authentication service not work

Avatar

Level 4

I added "-/libs/wcm/core/content/reference" in Authentication Requirements list, but it didn't work. I still need to login when I accessed this link.

Is there anyone who can assist me?

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

authentication != authorization.

 

When you are not authenticated, then the system will consider you as the anonymous user; and if you invoke this functionality with anonymous user (which cannot read any content on author) you will get an empty result.

 

View solution in original post

15 Replies

Avatar

Community Advisor

@Johann_Lu 

 

Why are we trying to get it out of authentication? 

This URL in turn uses Content and reference information, which would also need session. 


Aanchal Sikka

Avatar

Level 4

I want to get all the resources associated with a content when it is published.

Avatar

Community Advisor

@Johann_Lu 

 

  • The "libs/wcm/core/content/reference" internally calls com.day.cq.wcm.core.impl.reference.ActivationReferenceSearchServlet. 
  • The servlet uses  
    com.day.cq.wcm.core.reference.ActivationReferenceSearchService

 

  •  These are part of cq-wcm-core bundle

 

You can use getReferences() of this Service to get all References

 


Aanchal Sikka

Avatar

Community Advisor

@Johann_Lu 

 

You are right this bundle is not available publicly, although the API is available in AEM.

 

One suggestion:

As per my understanding, just the Asset reference for replication should suffice for majority of the use-cases.

The other cases, where one might need template/policies, these are generally not meant to be replicated with pages every time. So any template-editor should publish them after editing.  These should be process-oriented.

 

If we allow read access to content along with the Reference URL and the servlet, it would open too much info for an anonymous user


Aanchal Sikka

Avatar

Level 4

I understood, but I do need all the reference reference,including policy, template and so on. Are there any other methods?

Avatar

Community Advisor

@Johann_Lu  can you please elaborate a bit on this. What exactly are you trying to do 

Avatar

Level 4

I want to get all the resources associated with a content when it is published

Avatar

Correct answer by
Employee Advisor

authentication != authorization.

 

When you are not authenticated, then the system will consider you as the anonymous user; and if you invoke this functionality with anonymous user (which cannot read any content on author) you will get an empty result.

 

Avatar

Community Advisor

Hi @Johann_Lu ,

  1. Check Configuration: Ensure that you have configured the authentication requirements correctly. Double-check the path - prefix in -/libs/wcm/core/content/reference and ensure that it matches the path you want to allow anonymous access to.

  2. Permissions: Make sure that the permissions are set correctly for the path you're trying to access. Even if authentication requirements are configured, if the permissions are not set to allow anonymous access, users will still be prompted to log in.

  3. Cache: Sometimes, changes to authentication requirements may not take effect immediately due to caching. Try clearing any caches in your Apache Sling instance and restarting it to see if the changes are reflected.

  4. Debugging: Enable debugging/logging for the authentication service to see if there are any errors or unexpected behavior occurring. This can help pinpoint the issue more accurately.

  5. Documentation: Refer to the official Apache Sling documentation for authentication and authorization to ensure you're following best practices and using the correct configuration options.

  6. Community Support: If you're still unable to resolve the issue, consider reaching out to the Apache Sling community for assistance. They may be able to provide additional insights or help troubleshoot the problem further.

By following these steps and possibly seeking assistance from the community, you should be able to identify and resolve the issue with Apache Sling's authentication service.

Avatar

Administrator

@Johann_Lu Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.



Kautuk Sahni