コミュニティアチーブメントバーを展開する。

Submissions are now open for the 2026 Adobe Experience Maker Awards.

Mark Solution

この会話は、活動がないためロックされています。新しい投稿を作成してください。

解決済み

Sling Authentication Framework

Avatar

Level 3

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

 

 

 

 

1 受け入れられたソリューション

Avatar

正解者
Community Advisor
4 返信

Avatar

Employee Advisor

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?

Avatar

Level 3

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.

Avatar

正解者
Community Advisor

Hi @janhavi_singh ,

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

Regards,

Santosh


Santosh Sai

AEM BlogsLinkedIn


Avatar

Level 7

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>