Hi all, I am new to sling authentication and have no prior knowledge about it. I am creating a login component which will sign in the users in created in home/groups/custom_group. I will use HTL for the same.
Now I want to know how I should I authenticate these users present in the custom group using sling authenticationn framework.
I found few docs regarding the topic but still confused on how to implement it in AEM.
Thanks in advance
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @janhavi_singh ,
Please check if this helps: https://aem4beginner.blogspot.com/how-to-create-custom-authentication
Regards,
Santosh
Are you implementing this for AEM author or publish? And with "login" do you mean the traditional username/password combination or something more modern like SAML?
I have to implement it on publish but for now for testing the component I am doing it on author. And I have made a custom login component i.e traditional username and password.
Hi @janhavi_singh ,
Please check if this helps: https://aem4beginner.blogspot.com/how-to-create-custom-authentication
Regards,
Santosh
Hi @janhavi_singh ,
If you are looking for a component for login using user/password. You just need few lines of code. Sharing sightly code used in component. You can add sling model as per need. This sightly is enough for working login component.
You just need to have fields name and action url.
hidden field(resource) used to set redirect url after successful login.
<div class="row"> <div class="col-lg-6"> <div class="p-5"> <div class="text-center"> <h1 class="h4 text-gray-900 mb-4">Welcome Back!</h1> </div> <form class="user" method="POST" action="${currentPage.getPath}/j_security_check"> <input type="hidden" name="resource" value="${'/content/we-retail/us/en/men.html'}"> <input type="hidden" name="_charset_" value="UTF-8"> <div class="form-group"> <input type="text" class="form-control form-control-user" id="userId" placeholder="User" name="j_username"> </div> <div class="form-group"> <input type="password" class="form-control form-control-user" id="userPassword" placeholder="Password" name="j_password"> </div> <button class="btn btn-primary btn-user btn-block" type="submit"> Login </button> </form> </div> </div> </div>