Package com.iisigroup.cap.security.captcha

Examples of com.iisigroup.cap.security.captcha.CapSecurityCaptcha


      for (Method method : handler.getClass().getDeclaredMethods()) {
        if (methodId.equals(method.getName())) {
          if (method.isAnnotationPresent(Captcha.class)) {
            String key = method.getAnnotation(Captcha.class)
                .value();
            CapSecurityCaptcha captcha = CapAppContext
                .getBean(CapCaptchaServlet.DEF_RENDERER);
            if (captcha == null
                || !CaptchaStatus.SUCCESS.equals(captcha
                    .valid(params.get(key)))) {
              // 驗証碼無效請重新輸入
              throw new CapMessageException(
                  CapAppContext.getMessage(captcha.getErrorMessage()),
                  getClass());
            }
          }
        }
      }
View Full Code Here


    super.init(config);
    DEF_RENDERER = config.getInitParameter("captchaBean");
  }
  public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException,
      IOException {
    CapSecurityCaptcha captcha = CapAppContext.getBean(DEF_RENDERER);
    BufferedImage img =  captcha.crateImage();
    resp.setContentType("image/jpeg")
      OutputStream os = resp.getOutputStream()
      ImageIO.write(img, "jpg", os)
      os.close()
   
View Full Code Here

            }
            // 驗證 captcha
            if (captchaEnabled) {
                String cpatchaData = captchaCaptureFilter.getRequest()
                        .getParameter("captcha");
                CapSecurityCaptcha captcha = CapAppContext
                        .getBean(CapCaptchaServlet.DEF_RENDERER);
                captchaPassed = CaptchaStatus.SUCCESS.equals(captcha
                        .valid(cpatchaData));
                logger.debug("Is captcha valid: " + captchaPassed);
            } else {
                captchaPassed = true;
            }
View Full Code Here

TOP

Related Classes of com.iisigroup.cap.security.captcha.CapSecurityCaptcha

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.