Skip to content

Commit 9abd80c

Browse files
Merge pull request #22 from KB-iGOT/4.8.28-ecLogin
4.8.28 ec login
2 parents 325711c + 540bdcc commit 9abd80c

File tree

4 files changed

+315
-3
lines changed

4 files changed

+315
-3
lines changed

keycloak/sms-provider/pom.xml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,5 +121,11 @@
121121
<!--<scope>test</scope> -->
122122
</dependency>
123123

124-
</dependencies>
124+
125+
<dependency>
126+
<groupId>org.apache.commons</groupId>
127+
<artifactId>commons-lang3</artifactId>
128+
<version>3.9</version>
129+
</dependency>
130+
</dependencies>
125131
</project>

keycloak/sms-provider/src/main/java/org/sunbird/keycloak/login/PasswordAndOtpAuthenticator.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ private enum CODE_STATUS {
7373
@Override
7474
public void authenticate(AuthenticationFlowContext context) {
7575
String secretKey = context.getAuthenticationSession().getAuthNote(Constants.SECRET_KEY);
76-
if (StringUtils.isBlank(secretKey)) {
76+
if (StringUtils.isBlank(secretKey)) {
7777
// Generate the secret key
7878
secretKey = generateSecretKey();
7979
logger.info("Generated new secret key.");
@@ -86,7 +86,13 @@ public void authenticate(AuthenticationFlowContext context) {
8686

8787
LoginFormsProvider formsProvider = context.form();
8888
formsProvider.setAttribute(Constants.SECRET_KEY, secretKey);
89-
context.challenge(formsProvider.createForm(Constants.LOGIN_PAGE));
89+
if(context.getAuthenticationSession().getRedirectUri().contains(Constants.EC_LOGIN)){
90+
logger.info("loading ec login page");
91+
context.challenge(formsProvider.createForm(Constants.EC_LOGIN_PAGE));
92+
}else{
93+
logger.info("loading login page");
94+
context.challenge(formsProvider.createForm(Constants.LOGIN_PAGE));
95+
}
9096
}
9197

9298
@Override

keycloak/sms-provider/src/main/java/org/sunbird/keycloak/utils/Constants.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,6 @@ private Constants() {
106106
public static final String ASYNC = "async";
107107
public static final String SECRET_KEY = "secretKey";
108108
public static final String IV = "iv";
109+
public static final String EC_LOGIN = "/eclogin/";
110+
public static final String EC_LOGIN_PAGE="eclogin.ftl";
109111
}

0 commit comments

Comments
 (0)