Package org.apache.shiro.authc

Examples of org.apache.shiro.authc.SimpleAuthenticationInfo


  {
    UsernamePasswordToken token = (UsernamePasswordToken)authcToken;
    User user = userDAO.findUser(token.getUsername());
    if (user != null)
    {
      return new SimpleAuthenticationInfo(user.getId(), user.getPassword(), getName());
    }
    else
    {
      return null;
    }
View Full Code Here


  {
    UsernamePasswordToken token = (UsernamePasswordToken)authcToken;
    User user = userDAO.findUser(token.getUsername());
    if (user != null)
    {
      return new SimpleAuthenticationInfo(user.getId(), user.getPassword(), getName());
    }
    else
    {
      return null;
    }
View Full Code Here

  @Override
  protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException {
    String principal = (String)token.getPrincipal();
    String credentials = new String((char[])token.getCredentials());
    if ("marry".equals(principal) && "foo".equals(credentials)) {
      return new SimpleAuthenticationInfo(principal, credentials.toCharArray(), getName());
    }
    return null;
  }
View Full Code Here

  @Override
  protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException {
    String principal = (String)token.getPrincipal();
    String credentials = new String((char[])token.getCredentials());
    if ("root".equals(principal) && "secret".equals(credentials)) {
      return new SimpleAuthenticationInfo(principal, credentials.toCharArray(), getName());
    } else if ("john".equals(principal) && "foo".equals(credentials)) {
      return new SimpleAuthenticationInfo(principal, credentials.toCharArray(), getName());
    }
    return null;
  }
View Full Code Here

    if(null!=accoutNo&&!"".equals(accoutNo))
    {
      Account account=accountService.login(accoutNo, String.valueOf(passwordToken.getPassword()));
      if(account!=null)
      {
        return new SimpleAuthenticationInfo(account.getAccount(),account.getPassword(),getName());
      }
    }
    return null;
  }
View Full Code Here

    }

    User user = getSystemService().getUserByLoginName(token.getUsername());
    if (user != null) {
      byte[] salt = Encodes.decodeHex(user.getPassword().substring(0,16));
      return new SimpleAuthenticationInfo(new Principal(user),
          user.getPassword().substring(16), ByteSource.Util.bytes(salt), getName());
    } else {
      return null;
    }
  }
View Full Code Here

    UsernamePasswordToken upToken = (UsernamePasswordToken) token;
    User user = permission.getUserByUsername(upToken.getUsername());
    if (user == null) {
      throw new AuthenticationException();
    }
    return new SimpleAuthenticationInfo(user, user.getPassword(), getName());
  }
View Full Code Here

            if (password == null) {
                throw new UnknownAccountException("No account found for user [" + username + "]");
            }

            SimpleAuthenticationInfo simpleAuthenticationInfo = new SimpleAuthenticationInfo(username, password, getName());
           
            simpleAuthenticationInfo.setCredentialsSalt(ByteSource.Util.bytes(username));
           
            info = simpleAuthenticationInfo;

        } catch (SQLException e) {
            final String message = "There was a SQL error while authenticating user [" + username + "]";
View Full Code Here

TOP

Related Classes of org.apache.shiro.authc.SimpleAuthenticationInfo

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.