Package br.com.caelum.vraptor.security

Examples of br.com.caelum.vraptor.security.User


  @Inject private Permission permission;

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


    return new SimpleAuthenticationInfo(user, user.getPassword(), getName());
  }

  @Override
  protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
    User user = (User) getAvailablePrincipal(principals);

    Set<String> roles = permission.getRolesByUser(user.getUsername());
    SimpleAuthorizationInfo simpleAuthorizationInfo = new SimpleAuthorizationInfo(roles);

    for (String role : roles) {
      Set<String> permissions = permission.getPermissionsByRole(role);
      simpleAuthorizationInfo.addStringPermissions(permissions);
View Full Code Here

TOP

Related Classes of br.com.caelum.vraptor.security.User

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.