Hi,

I've encountered the following code block while going through the source of
authentication endpoint [1]. There is a String variable ("loginFailed")
which is used for holding boolean values as Strings.

String errorMessage = "Authentication Failed! Please Retry";
        String loginFailed = "false";

        if (request.getParameter(Constants.AUTH_FAILURE) != null &&
                "true".equals(request.getParameter(Constants.AUTH_FAILURE))) {
            loginFailed = "true";

            if(request.getParameter(Constants.AUTH_FAILURE_MSG) != null){
                errorMessage = (String)
request.getParameter(Constants.AUTH_FAILURE_MSG);

                if (errorMessage.equalsIgnoreCase("login.fail.message")) {
                    errorMessage = "Authentication Failed! Please Retry";
                }
            }
        }

I've checked for its usages in login.jsp. But only found one
occurrence as given below.

<%if(localAuthenticatorNames.contains("CustomBasicAuthenticator")){ %>

    <div id="local_auth_div" class="container main-login-container"
style="margin-top:10px;">

<%} %>


                <% if ("true".equals(loginFailed)) { %>

            <div class="alert alert-error">

                <%=errorMessage%>

            </div>

            <% } %>

Is there any particular reason for not using a boolean variable
instead of String variable  "loginFailed" variable?

[1].
https://svn.wso2.org/repos/wso2/carbon/platform/branches/turing/components/identity/org.wso2.carbon.identity.application.authentication.endpoint/4.2.2/src/main/webapp/login.jsp

Thanks,

Lakshitha Harshan
Software Engineer
Mobile: *+94724423048*
Email: [email protected]
Blog : http://harshanliyanage.blogspot.com/
*WSO2, Inc. :** wso2.com <http://wso2.com/>*
lean.enterprise.middleware.
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to