// Path: rss-2-kindle-common/src/main/java/org/roag/model/Roles.java
// public enum Roles {
//     ROLE_USER("ROLE_USER"),
//     ROLE_ADMIN("ROLE_ADMIN");
// 
//     private final String value;
// 
//     Roles(String value) {
//         this.value = value;
//     }
// 
//     @Override
//     public String toString() {
//         return this.value;
//     }
// }


import org.roag.model.Roles;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.web.bind.annotation.ModelAttribute;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
package org.roag.web;



/**
 * Created by eurohlam on 3/09/2018.
 */
public class AbstractController {

    @ModelAttribute("username")
    public String getPrincipal() {
        String userName = null;
        Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();

        if (principal instanceof UserDetails) {
            userName = ((UserDetails) principal).getUsername();
// Path: rss-2-kindle-common/src/main/java/org/roag/model/Roles.java
// public enum Roles {
//     ROLE_USER("ROLE_USER"),
//     ROLE_ADMIN("ROLE_ADMIN");
// 
//     private final String value;
// 
//     Roles(String value) {
//         this.value = value;
//     }
// 
//     @Override
//     public String toString() {
//         return this.value;
//     }
// }


// Path: rss-2-kindle-web/src/main/java/org/roag/web/AbstractController.java
import org.roag.model.Roles;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.web.bind.annotation.ModelAttribute;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

package org.roag.web;



/**
 * Created by eurohlam on 3/09/2018.
 */
public class AbstractController {

    @ModelAttribute("username")
    public String getPrincipal() {
        String userName = null;
        Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();

        if (principal instanceof UserDetails) {
            userName = ((UserDetails) principal).getUsername();
        } else {