Exemplo n.º 1
0
  @Override
  protected User doAuthentication(ActionForm form, HttpServletRequest request) {
    final CasConfig casConfig = CoreConfiguration.casConfig();
    if (casConfig != null && casConfig.isCasEnabled()) {
      throw AuthorizationException.authenticationFailed();
    }

    final AuthenticationForm authenticationForm = (AuthenticationForm) form;
    final String username = authenticationForm.getUsername();
    final String password = authenticationForm.getPassword();

    return Authenticate.login(request.getSession(true), username, password);
  }
 @Override
 public void showLoginPage(HttpServletRequest req, HttpServletResponse resp, String callback)
     throws IOException, ServletException {
   if (Authenticate.isLogged()) {
     if (Strings.isNullOrEmpty(callback)) {
       resp.sendRedirect(req.getContextPath() + "/login.do");
     } else {
       resp.sendRedirect(callback);
     }
   } else {
     CasConfig casConfig = CoreConfiguration.casConfig();
     if (Strings.isNullOrEmpty(callback)) {
       callback = casConfig.getCasServiceUrl();
     }
     String casLoginUrl = casConfig.getCasLoginUrl(callback);
     if (FenixEduIstIntegrationConfiguration.barraLogin()) {
       casLoginUrl =
           FenixEduIstIntegrationConfiguration.getConfiguration().barraLoginUrl()
               + "?next="
               + casLoginUrl;
     }
     resp.sendRedirect(casLoginUrl);
   }
 }