code: @Override
      public AuthenticationStatus authenticate(HttpServletRequest req, HttpServletResponse res, AuthenticationParameters params) {
          AuthenticationStatus authStatus = AuthenticationStatus.SEND_FAILURE;
          req.setAttribute(JavaEESecConstants.SECURITY_CONTEXT_AUTH_PARAMS, params);
          try {
              boolean result = req.authenticate(res);
              if (result) {
                  authStatus = AuthenticationStatus.SUCCESS;
              } else {
  //TODO some error handling.
              }
          } catch (Exception e) {
  //TODO need to handle error.
              e.printStackTrace();
          }
          return authStatus;
      }
docs: /*
  (non-Javadoc)
  
  @see javax.security.enterprise.SecurityContext#authenticate(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse,
  javax.security.enterprise.authentication.mechanism.http.AuthenticationParameters)