Package org.apache.shiro.authc

Examples of org.apache.shiro.authc.SimpleAuthenticationInfo


        return buildAuthenticationInfo(upToken.getUsername(), upToken.getPassword());
    }

    protected AuthenticationInfo buildAuthenticationInfo(String username, char[] password) {
        return new SimpleAuthenticationInfo(username, password, getName());
    }
View Full Code Here


    @Test
    public void testBasic() {
        CredentialsMatcher matcher = (CredentialsMatcher) ClassUtils.newInstance(getMatcherClass());
        byte[] hashed = hash("password").getBytes();
        AuthenticationInfo account = new SimpleAuthenticationInfo("username", hashed, "realmName");
        AuthenticationToken token = new UsernamePasswordToken("username", "password");
        assertTrue(matcher.doCredentialsMatch(token, account));
    }
View Full Code Here

    User user = userService.getCurrentUser();
    if (user == null){
      throw new AccountException("Not authenticated.");
    }
   
    return new SimpleAuthenticationInfo(user, null, getName());
  }
View Full Code Here

          User user =  UserService.getUser(username);
          password = user.getPasswordEnc();
          System.out.println("retrieved password is: " + password);
          //password = Safe.getPassword(username);
        //} catch (Exception e) {System.out.println(e);}
        return new SimpleAuthenticationInfo(username, password.toCharArray(), getName());
      //new SimpleAuthenticationInfo(username, "blue".toCharArray(), getName());
    }
View Full Code Here

        checkNotNull(username, "Null usernames are not allowed by this realm.");
        String password = null;
        try {
          password = Safe.getPassword(username);
        } catch (Exception e) {System.out.println(e);}
        return new SimpleAuthenticationInfo(username, password.toCharArray(), getName());
      //new SimpleAuthenticationInfo(username, "blue".toCharArray(), getName());

    }
View Full Code Here

   
    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

  protected AuthenticationInfo doGetAuthenticationInfo(
      AuthenticationToken authcToken) throws AuthenticationException {
    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

//        if (userToken.getExpirationDate() < System.currentTimeMillis()) {
//            throw new AuthenticationException(ErrorMessages.EXPIRED_CREDENTIAL);
//        }
        // all is well so far...

        return new SimpleAuthenticationInfo(theUser.getId(), "", getName());
    }
View Full Code Here

        }

        logger.debug("ConnectionId is set to " + connection.getId());

        // all is well so far...
        return new SimpleAuthenticationInfo(connection.getCredentials().getIdentity(), "", getName());
    }
View Full Code Here

            if ( account == null ) {
                LOG.debug( "Unknown subject identifier: {}" + username );
                return null;
            }
            LOG.debug( "Found account for {}: {}", username, account );
            return new SimpleAuthenticationInfo( account.subjectIdentifier().get(), account.password().get(), getName() );

        } finally {
            uow.discard();
        }
    }
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.