// Path: src/main/java/com/sivalabs/jblogger/entities/Role.java
// @Entity
// @Table(name="roles")
// @Data
// public class Role implements Serializable
// {
// 	private static final long serialVersionUID = 1L;
// 	
// 	@Id
// 	@SequenceGenerator(name="role_id_generator", sequenceName="role_id_seq", initialValue = 100, allocationSize=1)
// 	@GeneratedValue(generator = "role_id_generator")
// 	private Long id;
// 	
// 	@Column(nullable=false, unique=true)
// 	@NotEmpty
// 	private String name;
// 		
// 	@ManyToMany(mappedBy="roles")
// 	private List<User> users;
// 
// }
// 
// Path: src/main/java/com/sivalabs/jblogger/entities/User.java
// @Entity
// @Table(name="users")
// @Data
// public class User implements Serializable
// {
// 	private static final long serialVersionUID = 1L;
// 	
// 	@Id
// 	@SequenceGenerator(name="user_id_generator", sequenceName="user_id_seq", initialValue = 100, allocationSize=1)
// 	@GeneratedValue(generator = "user_id_generator")
// 	private Long id;
// 	
// 	@Column(nullable=false)
// 	@NotEmpty()
// 	private String name;
// 	
// 	@Column(nullable=false, unique=true)
// 	@NotEmpty
// 	@Email(message="{errors.invalid_email}")
// 	private String email;
// 	
// 	@Column(nullable=false)
// 	@NotEmpty
// 	@Size(min=4)
// 	private String password;
// 	
// 	@ManyToMany(cascade=CascadeType.MERGE)
// 	@JoinTable(
// 	      name="user_role",
// 	      joinColumns={@JoinColumn(name="USER_ID", referencedColumnName="ID")},
// 	      inverseJoinColumns={@JoinColumn(name="ROLE_ID", referencedColumnName="ID")})
// 	private List<Role> roles = new ArrayList<>();
// 	
// }


import com.sivalabs.jblogger.entities.Role;
import com.sivalabs.jblogger.entities.User;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.AuthorityUtils;
import java.util.Collection;
import java.util.List;
package com.sivalabs.jblogger.security;



public class AuthenticatedUser extends org.springframework.security.core.userdetails.User
{

	private static final long serialVersionUID = 1L;
	private User user;
	
	public AuthenticatedUser(User user)
	{
		super(user.getEmail(), user.getPassword(), getAuthorities(user));
		this.user = user;
	}
	
// Path: src/main/java/com/sivalabs/jblogger/entities/Role.java
// @Entity
// @Table(name="roles")
// @Data
// public class Role implements Serializable
// {
// 	private static final long serialVersionUID = 1L;
// 	
// 	@Id
// 	@SequenceGenerator(name="role_id_generator", sequenceName="role_id_seq", initialValue = 100, allocationSize=1)
// 	@GeneratedValue(generator = "role_id_generator")
// 	private Long id;
// 	
// 	@Column(nullable=false, unique=true)
// 	@NotEmpty
// 	private String name;
// 		
// 	@ManyToMany(mappedBy="roles")
// 	private List<User> users;
// 
// }
// 
// Path: src/main/java/com/sivalabs/jblogger/entities/User.java
// @Entity
// @Table(name="users")
// @Data
// public class User implements Serializable
// {
// 	private static final long serialVersionUID = 1L;
// 	
// 	@Id
// 	@SequenceGenerator(name="user_id_generator", sequenceName="user_id_seq", initialValue = 100, allocationSize=1)
// 	@GeneratedValue(generator = "user_id_generator")
// 	private Long id;
// 	
// 	@Column(nullable=false)
// 	@NotEmpty()
// 	private String name;
// 	
// 	@Column(nullable=false, unique=true)
// 	@NotEmpty
// 	@Email(message="{errors.invalid_email}")
// 	private String email;
// 	
// 	@Column(nullable=false)
// 	@NotEmpty
// 	@Size(min=4)
// 	private String password;
// 	
// 	@ManyToMany(cascade=CascadeType.MERGE)
// 	@JoinTable(
// 	      name="user_role",
// 	      joinColumns={@JoinColumn(name="USER_ID", referencedColumnName="ID")},
// 	      inverseJoinColumns={@JoinColumn(name="ROLE_ID", referencedColumnName="ID")})
// 	private List<Role> roles = new ArrayList<>();
// 	
// }


// Path: src/main/java/com/sivalabs/jblogger/security/AuthenticatedUser.java
import com.sivalabs.jblogger.entities.Role;
import com.sivalabs.jblogger.entities.User;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.AuthorityUtils;
import java.util.Collection;
import java.util.List;

package com.sivalabs.jblogger.security;



public class AuthenticatedUser extends org.springframework.security.core.userdetails.User
{

	private static final long serialVersionUID = 1L;
	private User user;
	
	public AuthenticatedUser(User user)
	{
		super(user.getEmail(), user.getPassword(), getAuthorities(user));
		this.user = user;
	}
	
	public User getUser()