Package net.solosky.maplefetion.bean

Examples of net.solosky.maplefetion.bean.VerifyImage


     * @param alg
     */
    private void processVerifyAction(String alg, String type, String text, String tips)
    {
      try {
          VerifyImage verifyImage = HttpApplication.fetchVerifyImage(
              this.fetionContext.getFetionUser(), this.fetionContext.getLocaleSetting(), alg, type);
         
          NotifyEventListener listener = this.fetionContext.getNotifyEventListener();
         
          if(listener!=null) {
View Full Code Here


        Element pic = XMLHelper.find(e, "/results/pic-certificate");
        String pid = pic.getAttributeValue("id");
        String code = pic.getAttributeValue("pic");
        byte[] base64Data = code.getBytes();
        byte[] bytes = Base64.decodeBase64(base64Data);
            return new VerifyImage(pid, bytes, alg, type);
          }else {
            throw new IOException("Http response is not OK. code="+conn.getResponseCode());
          }
  }
View Full Code Here

      if(event.getVerifyAction()==ImageVerifyEvent.SSI_VERIFY) {
        this.loginWork.setVerifyImage(event.getVerifyImage());
      }else if(event.getVerifyAction()==ImageVerifyEvent.SIPC_VERIFY) {
       
        SipcRequest request = event.getTargetRequest();
        VerifyImage image   = event.getVerifyImage();
       
        //移除之前的A字段
        Iterator<SipcHeader> it = request.getHeaders().iterator();
        while(it.hasNext()) {
          SipcHeader h = it.next();
          if(h.getName().equals(SipcHeader.AUTHORIZATION) && h.getValue().indexOf("Verify response=")!=-1) {
            it.remove();
          }
        }
       
        request.addHeader(SipcHeader.AUTHORIZATION, "Verify response=\""+image.getVerifyCode()+"\",algorithm=\""+image.getAlgorithm()+"\"," +
            "type=\""+image.getVerifyType()+"\",chid=\""+image.getImageId()+"\"");
        request.resetReplyTimes();
        event.getTargetDialog().process(request);
      }else {
        throw new IllegalArgumentException("Invalid verify action:"+event.getVerifyAction());
      }
View Full Code Here

     * @throws IOException
     * @throws ParseException
     */
    public void flushVerifyImage(ImageVerifyEvent event) throws ParseException, IOException
    {
      VerifyImage image = HttpApplication.fetchVerifyImage(getFetionUser(),
          getLocaleSetting(), event.getVerifyImage().getAlgorithm(),
          event.getVerifyImage().getVerifyType());
      event.setVerifyImage(image);
    }
View Full Code Here

      //第一次尝试不用验证码登录
      LoginState state = this.signAction.signIn(this.context.getFetionUser());
      //如果结果为需要验证或者验证失败,重复验证,直到SSI的结果为其他结果为止
      while(state==LoginState.SSI_NEED_VERIFY || state==LoginState.SSI_VERIFY_FAIL) {
            try {
              VerifyImage img = this.ssiVerifyWaiter.waitObject();
              state = this.signAction.signIn(this.context.getFetionUser(), img);
            } catch (ExecutionException e) {
               this.checkCanceledLogin();
               throw new LoginException(LoginState.OTHER_ERROR, e);
            } catch (TimeoutException e) {
View Full Code Here

    Pattern pt = Pattern.compile("Verify algorithm=\"(.*?)\",type=\"(.*?)\"");
    Matcher mc = pt.matcher(wwwHeader.getValue());
    if(mc.matches()) {
      String alg  = mc.group(1);    //验证图片算法
      String type = mc.group(2);    //类型???啥意思。。。
      VerifyImage verifyImage = null;
            try {
              verifyImage = HttpApplication.fetchVerifyImage(context.getFetionUser(),
                    context.getLocaleSetting(), alg, type);
            } catch (IOException e) {
              throw new IllegalStateException("fetch verify image failed.", e);
View Full Code Here

TOP

Related Classes of net.solosky.maplefetion.bean.VerifyImage

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.