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

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


  public List<LoginAccount> listByPermission(Permission permission) {
    return getDao().listByPermission(permission);
  }
 
  public List<LoginAccount> listByPermission(String token ){
    Permission p = new Permission(token);
    return listByPermission( p );
  }
View Full Code Here


    //{"hasAuth"(存在权限),"noneAuth"无权限,"canAuth"可以授权,"genAuth"已授权}
    safeMessage = "";
    authType = AUTH_TYPE_VALUES[1];
   
    if( !StringUtils.isEmpty(targetUrl)){
      Permission permission = permissionManager.getByUrlWithRegexp(targetUrl);
      if( permission != null){
        String token = permission.getToken();
        if(SecurityUtils.getSubject().isPermitted( token ) ){
          authType = AUTH_TYPE_VALUES[0];
        }else if( authorizedResourceManager.canAuthorized(targetUrl) ){
          authType = AUTH_TYPE_VALUES[2];
         
View Full Code Here

   
    if( StringUtils.isEmpty(targetUrl) ){
      this.safeMessage = "授权资源为空!";
      return SUCCESS;
    }
    Permission per = permissionManager.getByUrlWithRegexp(targetUrl);
    if( per == null ){
      this.safeMessage = "授权资源为非保护,可直接访问!";
      this.passed = true;
      return SUCCESS;
    }
   
    account = getManager().get(username);
    if( account == null || !account.getPassword().equals(password) ){
      this.safeMessage = "错误的用户或密码!";
      return SUCCESS;
    }
   
    if(!account.isEffective() || !account.isExpired() ){
      this.safeMessage = "用户被禁用或已过期!";
      return SUCCESS;
    }
   
    //是否有权限
    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();
      }
View Full Code Here

TOP

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

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.