Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

Can't authenticate on author via Http POST from Java app

Avatar

Level 5

I'm trying to authenticate a standalone java app that pulls content from the AEM author as JSON. In my local I can simply POST to

AEM_URL + "/j_security_check"

via the Apache HTTP Client, passing:

postParams.add(new BasicNameValuePair("j_username", username));postParams.add(new BasicNameValuePair("j_password", password));postParams.add(new BasicNameValuePair("j_validate", "true"));

and I get back the auth token cookie which I can then grab and use on my GET request to the secure resource.

However on our pre-prod author this fails, I get a 200 back but no cookie. Is this the correct method to authenticate a standalone java app, and if so am I missing something to get this working on our pre-prod author, which is hardened compared to our local dev environments so not sure if this is blocked somehow on security grounds.  

1 Reply

Avatar

Level 10

I am looking for a code example that will help you. We have Java POST articles - but without authen requirements. In past - we had community ask how to turn off authentication because the Java app would only be used by internal ppl.