Package com.google.code.lightssh.project.security.entity

Examples of com.google.code.lightssh.project.security.entity.AuthorizedTicket


      throw new ApplicationException("授权参数错误!");
   
    if( scope == null )
      scope = AuthorizedTicket.Scope.ONCE;
   
    AuthorizedTicket ticket = new AuthorizedTicket();
    ticket.setUrl(url);
    ticket.setLicensor(licensor);
    ticket.setToken(token);
    ticket.setScope(scope);
    ticket.setSessionId(sessinid);
    ticket.setGrantor(grantor);
    ticket.setMaxCount(maxCount);
    ticket.setAuthCount(0L);
    ticket.setValidTime(validTime);
   
    if( AuthorizedTicket.Scope.ONCE.equals(scope) )
      ticket.setMaxCount(1L);
   
    this.save(ticket);
   
    return ticket;
  }
View Full Code Here


   
    HttpServletRequest request = ((HttpServletRequest)req);
    String sessionid=request.getSession().getId();
    String ticketid = getTicketValue(request);
    if( isCheckTicket(request) ){
      AuthorizedTicket ticket = authorizedTicketManager.get(
          ticketid,perms[0],request.getRequestURI(), sessionid);
     
      if( ticket == null ){
        log.debug("无法查询到有效授权令牌,[url="+request.getRequestURI()
            +"ticket="+ticketid+",sessionid="+sessionid+"]。");
        return false;
      }
     
      if( !ticket.isEffective() ){
        log.info("授权令牌[Scope={}][ticket="+getTicketValue(request)
            +"]已失效!",ticket.getScope().name());
        return false;
      }
     
      if( ticket.isOnceScope() ){
        if( authorizedTicketManager.invalidTicketAfterAuth(
            ticketid,sessionid,Calendar.getInstance()) )
          log.info("授权令牌[Scope=ONCE][ticket="+ticketid+"]使用后标记为失效!");
      }else{
        if( authorizedTicketManager.incAuthCount(ticketid,sessionid) )
          log.info("授权令牌[Scope={}][ticket="+ticketid
              +"]使用后认证次数+1!",ticket.getScope().name());
      }
     
      return true;
    }
   
View Full Code Here

          authType = AUTH_TYPE_VALUES[0];
        }else if( authorizedResourceManager.canAuthorized(targetUrl) ){
          authType = AUTH_TYPE_VALUES[2];
         
          //是否已存在授权
          AuthorizedTicket ticket = authorizedTicketManager.get(
              token,targetUrl,request.getSession().getId() );
          if( ticket != null && ticket.isEffective() ){
            authType = AUTH_TYPE_VALUES[3];
            this.ticket = ticket.getId();
          }
        }
      }
    }
   
View Full Code Here

   
    //是否有权限
    if( account.hasPermission(per.getToken()) ){
      this.passed = true;
      try{
        AuthorizedTicket ticket = authorizedTicketManager.authTicket(
            targetUrl,username,per.getToken(),AuthorizedTicket.Scope.ONCE
            ,request.getSession().getId(),getLoginUser() );
        this.ticket = ticket.getId();
      }catch( Exception e ){
        this.safeMessage = "授权异常:" + e.getMessage();
      }
    }else{
      this.safeMessage = "授权用户无权限!";
View Full Code Here

TOP

Related Classes of com.google.code.lightssh.project.security.entity.AuthorizedTicket

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.