private void authorize(Set<String> roles) { boolean hasRoles = identityManagement.hasRoles(roles); if (!hasRoles) throw new AeroGearSecurityException(HttpStatus.CREDENTIAL_NOT_AUTHORIZED); }
public SaleAgent register(SaleAgent user) { configuration.create(user, null); configuration.grant(DEFAULT_ROLE).to(user.getLoginName()); authenticationManager.login(user, null); return user; }