Expand my Community achievements bar.

Need to create a login Component with validation from a JSON

Avatar

Level 2

Hi Team,

Using AEM 6.4 I am trying to create a simple login component which should validate username and password  based on username and password stored in a JSON file. Please provide your valuable suggestions and share links.

Note-: I had gone through one article which uses default experience manager login servlet. But in my case the validation has to be done through JSON file which is available in DAM.

smacdonald2008​, navinkaushal​, Ratna Kumar

Thanks & regards

Tapas Samanta

2 Replies

Avatar

Level 10

If you want to validate the user and password from a json file, then modify /apps/wknd/clientlibs/boot-foundation/js/login.js and instead of posting the credentials to default login servlet (${pageProperties.homePagePath}/j_security_check), compare the posted credentials against the json file's data (fetched by another ajax call)

$.getJSON("/content/dam/..../user_credentials.json", function(result){

    //compare the submitted credentials against the credentials in json

    });

However, this is not a recommended solution for authentication because the json file could be easily cached and end-user could easily retrieve the credentials saved in json file.

Avatar

Level 10

Why would you want to keep user credentials in JSON file in DAM?


You can use AEM user management, it will take care of this in much better manner and avoid all the potential issues.

I am trying to understand the use case here.