Sling Authentication Framework | Community
Skip to main content
Level 3
Jun 16, 2022 8:53 AM UTC
Solved

Sling Authentication Framework

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.
SantoshSai
SantoshSaiAccepted solution
New Participant
Jun 16, 2022 1:59 PM UTC

Hi @janhavi_singh ,

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

Regards,

Santosh

Santosh Sai

4 replies

sunil_kumar_
Level 5
Jun 18, 2022 12:46 AM UTC

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>
Translate
SantoshSai
SantoshSaiAccepted solution
New Participant
Jun 16, 2022 1:59 PM UTC

Hi @janhavi_singh ,

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

Regards,

Santosh

Translate
Santosh Sai
joerghoh
Employee
Jun 16, 2022 11:33 AM UTC

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?

Translate
Level 3
Jun 16, 2022 12:45 PM UTC

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.

Translate