%@ page errorPage="error.jsp" %>
<%@ include file="/portal/include/include_java.jsp" %>
<%@ include file="/portal/include/site_wide_banner.jsp" %>
<%@ page import="java.util.ArrayList"%>
<%@ page import="java.util.List"%>
<%@ page import="java.util.Set"%>
<%@ page import="java.util.UUID" %>
<%@ page import="com.appiancorp.ap2.ServletScopesKeys" %>
<%@ page import="com.appiancorp.common.config.ApplicationContextHolder"%>
<%@ page import="com.appiancorp.security.auth.rememberme.RememberMeSettings"%>
<%@ page import="com.appiancorp.security.auth.mobile.MobileAuthContextUtils"%>
<%@ page import="com.appiancorp.security.auth.mobile.MobileAuthContext"%>
<%@ page import="com.appiancorp.security.cors.CorsUtil"%>
<%@ page import="com.appiancorp.security.csrf.CsrfConstants"%>
<%@ page import="com.appiancorp.security.csrf.CsrfTokenManager"%>
<%@ page import="com.appiancorp.security.user.service.LoginPageLink"%>
<%@ page import="com.appiancorp.security.user.service.LoginPageLinksConfiguration"%>
<%@ page import="com.appiancorp.suite.cfg.EmbeddedInterfaceConfiguration"%>
<%@ page import="com.appiancorp.suite.cfg.LdapConfiguration"%>
<%@ page import="com.appiancorp.suite.cfg.FeatureToggleConfiguration"%>
<%@ page import="com.appiancorp.suite.cfg.SamlConfiguration"%>
<%@ page import="com.appiancorp.suite.cfg.MobileConfiguration"%>
<%@ page import="com.appiancorp.security.util.StringSecurityUtils"%>
<%@ page import="com.appiancorp.tomcat.cookies.AppianCookieProcessor"%>
<%@ page import="com.google.common.base.Strings"%>
<%
boolean isRememberMeEnabled = ApplicationContextHolder.getBean(RememberMeSettings.class).isEnabled();
pageContext.setAttribute("isRememberMeEnabled", isRememberMeEnabled);
response.setHeader("X-RememberMeEnabled", Boolean.toString(isRememberMeEnabled));
%>
<%
MobileConfiguration mobileConfiguration = ApplicationContextHolder.getBean(MobileConfiguration.class);
LoginPageLinksConfiguration loginPageLinksConfig = ApplicationContextHolder.getBean(LoginPageLinksConfiguration.class);
List loginPageLinks = loginPageLinksConfig.getLoginPageLinks();
AdminSecurityConfiguration adminSecurityConfiguration = ApplicationContextHolder.getBean(AdminSecurityConfiguration.class);
LdapConfiguration ldapConfiguration = ApplicationContextHolder.getBean(LdapConfiguration.class);
SamlConfiguration samlConfiguration = ApplicationContextHolder.getBean("samlConfig", SamlConfiguration.class);
boolean isForgotPasswordEnabled = adminSecurityConfiguration.isForgotPasswordEnabled() && !ldapConfiguration.isEnabledForAllUsers() && !samlConfiguration.isEnabledForAllUsers();
pageContext.setAttribute("isForgotPasswordEnabled", isForgotPasswordEnabled);
pageContext.setAttribute("loginPageLinks", loginPageLinks);
pageContext.setAttribute("maintWindowMessage", adminSecurityConfiguration.getMaintWindowMessage());
pageContext.setAttribute("maintWindowActive", adminSecurityConfiguration.isMaintWindowActive());
MobileAuthContext currentMobileAuthContext = MobileAuthContextUtils.getMobileAuthContext(session);
if (currentMobileAuthContext != null) {
pageContext.setAttribute("loginUserName", currentMobileAuthContext.getUsername());
}
%>
<%
if (!CorsUtil.isAllowedOriginOrReferrer(request)) {
response.setHeader("X-Frame-Options", "SAMEORIGIN");
}
%>
<%
// Only generate a new CSRF token if the user's session has not been initialized to avoid the rare occasion
// that a user navigates to /portal/login.jsp while logged in (AN-61460)
if (session.getAttribute(ServletScopesKeys.KEY_USER) == null) {
CsrfTokenManager.storeCsrfTokenInResponse(request, response, CsrfConstants.CSRF_TOKEN_COOKIE, UUID.randomUUID().toString());
}
%>
<%@ include file="/portal/include/include_css.jsp"%>
<%@ include file="/portal/js/iframeFunctions.js" %>
<%-- branding should be last styleheet to override any existing css --%>
"
style="background-color: ; color: ;">
">
<%-- AN-47877 placeholder for Appian logo when main logo inside the login box is customized (to make sure that we still show the Appian logo somewhere on the screen). This remains empty if Appian logo is not customized. --%>
<%--Redirect to the mobile app if the mobileRedirectUrl has been set and no validation errors are present --%>
<%-- Set the starting state of which form terms of service (TOS) is visible --%>
<%-- If there is no validation error and TOS text has been set, display the TOS page and hide the login form --%>
<%-- Otherwise hide the notification page and go straight to the login form --%>