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

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


  protected AuthorizationInfo doGetAuthorizationInfo(
      PrincipalCollection principals) {
    String username = (String) principals.fromRealm(getName()).iterator().next();
   
    if( username != null ){
      LoginAccount la = accountManager.get( username );
      if( la != null && la.getRoles() != null ){
        SimpleAuthorizationInfo info = new SimpleAuthorizationInfo();
        for( Role each:la.getRoles() ){
          if( each.getName() != null )
            info.addRole(each.getName());
          Collection<String> pers = each.getPermissionsAsString();
          if( pers != null )
            info.addStringPermissions( pers );
View Full Code Here


 
  /**
   * 管理员删除消息
   */
  public String myRemove(){
    LoginAccount user = getLoginAccount();
    if( user == null )
      return LOGIN;
   
    if( message == null || StringUtils.isEmpty(message.getId()) ){
      this.saveErrorMessage("参数错误!");
View Full Code Here

  protected AuthorizationInfo doGetAuthorizationInfo(
      PrincipalCollection principals) {
    String username = (String) principals.fromRealm(getName()).iterator().next();
   
    if( username != null ){
      LoginAccount la = accountManager.get( username );
      if( la != null && la.getRoles() != null ){
        SimpleAuthorizationInfo info = new SimpleAuthorizationInfo();
        for( Role each:la.getRoles() ){
          if( !each.isEffective() )
            continue;
          if( each.getName() != null )
            info.addRole(each.getName());
          Collection<String> pers = each.getPermissionsAsString();
View Full Code Here

      AuthenticationToken authcToken ) throws AuthenticationException {
    UsernamePasswordToken token = (UsernamePasswordToken) authcToken;
    String accountName = token.getUsername();
   
    if( accountName != null && !"".equals(accountName) ){
      LoginAccount account = accountManager.get( token.getUsername() );
 
      if( account != null ){
        return new SimpleAuthenticationInfo(
            account.getLoginName(),account.getPassword(), getName() );
      }
    }

    return null;
  }
View Full Code Here

  @SuppressWarnings("unused")
  private LoginAccount buildObject( ResultSet rs ){
    if( rs == null )
      return null;
   
    LoginAccount la = new LoginAccount();
    try{
      la.setId( rs.getLong("ID"));
      la.setPartyId(rs.getString("PARTY_ID"));
      la.setLoginName(rs.getString("LOGIN_NAME"));
      la.setPassword( rs.getString("PASSWORD"));
      la.setStatus(AuditStatus.valueOf( rs.getString("STATUS") ));
      la.setPeriod( rs.getDate("PERIOD_START"), rs.getDate("PERIOD_END"));
      Calendar cal = Calendar.getInstance();
      Timestamp lockedTime = rs.getTimestamp("LAST_LOGIN_LOCK_TIME");
      if( lockedTime != null ){
        cal.setTime( lockedTime );
        la.setLastLoginLockTime( cal );
      }
      //la.setUseCa( rs.getBoolean("USE_CA") );
      //la.setType( LoginAccount.LoginAccountType.valueOf( rs.getString("TYPE") ));
    }catch( SQLException e ){
      e.printStackTrace();
View Full Code Here

   
    LoginAccountChange dbChange = this.loginAccountChangeManager.get(change);
    if( dbChange == null )
      throw new ApplicationException("登录帐户变更信息["+change.getId()+"]不存在!");
   
    LoginAccount dbAcc = loginAccountManager.get(change.getLoginAccount());
    LoginAccount newAcc = null;
    byte[] newObject = dbChange.getNewObject();
    if( newObject != null )
      newAcc = (LoginAccount)IoSerialUtil.deserialize(newObject);
    if( newObject == null || newAcc == null )
      throw new ApplicationException("数据异常,变更登录帐户信息为空!");
   
    boolean passed = AuditResult.LAST_AUDIT_PASSED.equals(audit.getResult());
    if( passed && EntityChange.Type.DELETE.equals(dbChange.getType()) ){//删除
      dbAcc.setStatus( AuditStatus.DELETE );
    }else if( passed && AuditStatus.EFFECTIVE.equals(newAcc.getStatus())){
      dbAcc.setPartyId( newAcc.getPartyId() );
      dbAcc.setPeriod(newAcc.getPeriod());
      dbAcc.setEmail( newAcc.getEmail());
      dbAcc.setRoles( newAcc.getRoles());
      dbAcc.setDescription( newAcc.getDescription() );
    }else if( passed ){
      dbAcc.setStatus( AuditStatus.EFFECTIVE );
    }else if( !passed && AuditStatus.NEW.equals( newAcc.getStatus() )){
      dbAcc.setStatus( AuditStatus.AUDIT_REJECT );
    }
   
    loginAccountManager.update(dbAcc);
    //dao.create(audit);//TODO 改为工作流,不需要记录审核日志
View Full Code Here

 
  public ListPage<LoginAccountAudit> list(ListPage<LoginAccountAudit> page,LoginAccountAudit t){
    SearchCondition sc = new SearchCondition();
    if( t != null ){
      if( t.getLoginAccountChange() != null ){
        LoginAccount account = t.getLoginAccountChange().getLoginAccount();
        if( account != null ){
          if( !StringUtils.isEmpty(account.getLoginName()) ){
            sc.like("loginAccountChange.loginAccount.loginName", account.getLoginName().trim());
          }
        }
      }
    }
   
View Full Code Here

    if( account == null || account.getLoginName() == null )
      return INPUT;
   
    cleanCaptcha();//防止重复提交
   
    LoginAccount la = this.getManager().get(account.getLoginName());
    if( la == null ){
      this.addActionError("无法找回与用户"+account.getLoginName()+"匹配的帐号信息!");
      return INPUT;
    }
   
View Full Code Here

    if( account == null || account.getLoginName() == null || message == null ){
      this.addActionError("错误的链接地址!");
      return INPUT;
    }
   
    LoginAccount la = this.getManager().get(account.getLoginName());
    if( la == null ){
      this.addActionError("非法或过期的链接地址!");
      return INPUT;
    }
    this.setAccount(la);
View Full Code Here

 
  /**
   * 登录用户名
   */
  public String getLoginUser( ){
    LoginAccount la = getLoginAccount();
    return la==null?null:la.getLoginName();
  }
View Full Code Here

TOP

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

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.