Package org.apache.shiro.authc

Examples of org.apache.shiro.authc.SimpleAuthenticationInfo


        DefaultSecurityManager securityManager = new DefaultSecurityManager();
        securityManager.setAuthenticator(new Authenticator() {
            @Override
            public AuthenticationInfo authenticate(AuthenticationToken authenticationToken)
                throws org.apache.shiro.authc.AuthenticationException {
                return new SimpleAuthenticationInfo(authenticationToken.getPrincipal(), authenticationToken
                    .getCredentials(), "openengsb");
            }
        });
        SecurityUtils.setSecurityManager(securityManager);
    }
View Full Code Here


        DefaultSecurityManager sm = new DefaultSecurityManager();
        sm.setAuthenticator(new Authenticator() {
            @Override
            public AuthenticationInfo authenticate(AuthenticationToken authenticationToken)
                throws AuthenticationException {
                return new SimpleAuthenticationInfo(new SimplePrincipalCollection(authenticationToken.getPrincipal(),
                    "openengsb"), authenticationToken.getCredentials());
            }
        });
        SecurityUtils.setSecurityManager(sm);
        ThreadContext.bind(sm);
View Full Code Here

    private AuthenticationDomain authenticator;

    @Override
    protected AuthenticationInfo doAuthenticate(AuthenticationToken token) throws AuthenticationException {
        if (token instanceof RootAuthenticationToken) {
            return new SimpleAuthenticationInfo(new Object(), null, "openengsb");
        }
        try {
            Authentication authenticate =
                authenticator.authenticate(token.getPrincipal().toString(), (Credentials) token.getCredentials());
            return new SimpleAuthenticationInfo(authenticate.getUsername(), authenticate.getCredentials(),
                "openengsb");
        } catch (org.openengsb.domain.authentication.AuthenticationException e) {
            throw new AuthenticationException(e);
        }
    }
View Full Code Here

  protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authcToken) throws AuthenticationException {
    UsernamePasswordToken token = (UsernamePasswordToken) authcToken;
    User user = accountService.findUserByLoginName(token.getUsername());
    if (user != null) {
      byte[] salt = Encodes.decodeHex(user.getSalt());
      return new SimpleAuthenticationInfo(new ShiroUser(user.getId(), user.getLoginName(), user.getName()),
          user.getPassword(), ByteSource.Util.bytes(salt), getName());
    } else {
      return null;
    }
  }
View Full Code Here

  protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authcToken) throws AuthenticationException {
    UsernamePasswordToken token = (UsernamePasswordToken) authcToken;
    User user = accountService.findUserByLoginName(token.getUsername());
    if (user != null) {
      byte[] salt = Encodes.decodeHex(user.getSalt());
      return new SimpleAuthenticationInfo(new ShiroUser(user.getId(), user.getLoginName(), user.getName()),
          user.getPassword(), ByteSource.Util.bytes(salt), getName());
    } else {
      return null;
    }
  }
View Full Code Here

      if ("disabled".equals(user.getStatus())) {
        throw new DisabledAccountException();
      }

      byte[] salt = Encodes.decodeHex(user.getSalt());
      return new SimpleAuthenticationInfo(new ShiroUser(user.getLoginName(), user.getName()), user.getPassword(),
          ByteSource.Util.bytes(salt), getName());
    } else {
      return null;
    }
  }
View Full Code Here

        Assert.hasText(usernamePasswordToken.getUsername(), "Username can not be null!");
        ProjectUser projectUser = projectUserService.getProjectUser(usernamePasswordToken.getUsername());
        //
        Assert.notNull(projectUser,String.format("User not found for username %s", usernamePasswordToken.getUsername()));
        //
        return new SimpleAuthenticationInfo(projectUser.getUsername(), projectUser.getPassword(), REALM_NAME);
    }
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

    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

        UsernamePasswordToken token = (UsernamePasswordToken) authToken;

        User user = (User) identityManagerment.findByUsername(token.getUsername());

        if (user != null) {
            return new SimpleAuthenticationInfo(user.getId(), new Sha512Hash(user.getPassword()), getName());
        } else {
            throw new RuntimeException("Authentication failed");
        }
    }
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.