Guest User

Untitled

a guest
Jan 5th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. /*
  2. * (non-Javadoc)
  3. *
  4. * @see com.intergrupo.igapps.security.service.ISecurityService#embedLogin(com.intergrupo.igapps.forms.domain.User)
  5. */
  6. @Override
  7. public void embedLogin(User user) {
  8. List<GrantedAuthority> roles = new ArrayList<GrantedAuthority>();
  9. roles.add(new GrantedAuthorityImpl(Role.ROLE_EMBED));
  10. UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(user.getEmail(), user.getPassword(), roles);
  11. SecurityContextHolder.getContext().setAuthentication(token);
  12. IgAppsContext ctx = new IgAppsContext();
  13. ctx.setTenant(user.getTenantId());
  14. ctx.setUser(user);
  15. ctx.setOwner(false);
  16. IgAppsContext.setContext(ctx);
  17. }
Add Comment
Please, Sign In to add comment