Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

creating a basic authentication for aem service for different non aem server for post call (aem6.5)

Avatar

Level 8

Hi ,

 

Non AEM host server need to upload an image to AEM publish server .

 

AEM is exposing an service say www.abc.com/upload.json   ,when Non AEM host serve hit this service ,in aem it will hit the servlet and we can upload the image.

 

But we would to restrict this based on some particular user . So how to achieve it using basic authentication .

Here we would need to provide userid and password to the non aem server request. How could they send that data to in post request.

 

But in aem how will it be validated if the correct user is accessing it .What is procedure or sample code for it.

 

Also could we  achieve auth  (bearer token) with the above mechanism in AEM

 

Any inputs on this will be helpful.

Thanks

1 Accepted Solution

Avatar

Correct answer by
Adobe Champion

Depending on AEM version you can use the Assets HTTP API, so no need to recreate your own API. What you'd need to do is create a user on AEM side that is allowed to perform the required CRUD operations in particular DAM path and use these credentials when making the Assets API calls.

 

You should also keep in mind however that large ingestion of assets can lead AEM performance issues, so keep an eye out for performance tuning needs.

View solution in original post

3 Replies

Avatar

Community Advisor

Hi @srinivas_chann1 - 

 

Please refer to 

AEM way of authenticating users using ACLs - https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/implementing-authenticatio...

A straight forward way of implementing your own authentication mechanism - https://stackoverflow.com/questions/34918421/implement-authentication-for-servlet-on-publish-instanc...

 

Also, just curious as to why you are doing it in Publish instance? Can you not use the AEM Assets API to upload the image to author instance and then publish it via code?

Few advantages in going this route:

You need not implement any custom authentication.

You need not bother about reverse replication and all the publishes will be in sync.

 

Thanks,

Fani

 

Avatar

Correct answer by
Adobe Champion

Depending on AEM version you can use the Assets HTTP API, so no need to recreate your own API. What you'd need to do is create a user on AEM side that is allowed to perform the required CRUD operations in particular DAM path and use these credentials when making the Assets API calls.

 

You should also keep in mind however that large ingestion of assets can lead AEM performance issues, so keep an eye out for performance tuning needs.

Avatar

Community Advisor

If required, even you can use the OAUTH JWT Bearer Token token to achive your use case(default Assets HTTP API with basic authentication), refer to the following URL for more details - https://medium.com/tech-learnings/how-to-manage-the-protected-aem-resources-through-oauth-2-0-851ce4... (JWT Bearer Token— Server to Server integration)

 

Regards

Albin I

www.albinsblog.com