Sling Authentication Framework | Community
Skip to main content
Level 3
June 16, 2022
Solved

Sling Authentication Framework

  • June 16, 2022
  • 3 replies
  • 1233 views

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

 

 

 

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by SantoshSai

Hi @janhavi_singh ,

Please check if this helps: https://aem4beginner.blogspot.com/how-to-create-custom-authentication

Regards,

Santosh

3 replies

joerghoh
Adobe Employee
Adobe Employee
June 16, 2022

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?

Level 3
June 16, 2022

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.

SantoshSai
Community Advisor
SantoshSaiCommunity AdvisorAccepted solution
Community Advisor
June 16, 2022
Santosh Sai
sunil_kumar_
Level 5
June 18, 2022

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>