@Test void getCurrentLogin() { SecurityContextHolder.getContext().setAuthentication( new UsernamePasswordAuthenticationToken(LOGIN, null, new ArrayList<>())); assertNotNull(SecurityContextHolder.getContext().getAuthentication()); assertEquals(LOGIN, securityHelper.getCurrentLogin()); }
public String getCurrentLogin() { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); if (authentication == null) { logger.debug("Current user is not authenticated."); throw new AccessDeniedException("User is not authenticated."); } return authentication.getName(); }
SecurityHelper { public String getCurrentLogin() { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); if (authentication == null) { logger.debug("Current user is not authenticated."); throw new AccessDeniedException("User is not authenticated."); } return authentication.getName(); } }
SecurityHelper { public String getCurrentLogin() { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); if (authentication == null) { logger.debug("Current user is not authenticated."); throw new AccessDeniedException("User is not authenticated."); } return authentication.getName(); }  }
SecurityHelper { public String getCurrentLogin() { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); if (authentication == null) { logger.debug("Current user is not authenticated."); throw new AccessDeniedException("User is not authenticated."); } return authentication.getName(); }  String getCurrentRealm(); String getCurrentLogin(); }
SecurityHelper { public String getCurrentLogin() { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); if (authentication == null) { logger.debug("Current user is not authenticated."); throw new AccessDeniedException("User is not authenticated."); } return authentication.getName(); }  String getCurrentRealm(); String getCurrentLogin();  }