@Test public void getLoggedInUser_notPresent() { when(securityContextHolder.getContext().getAuthentication()).thenReturn(null); final Optional<Authentication> loggedInUser = securityContextService.getLoggedInUser(); assertThat(loggedInUser).isEmpty(); }
@Override public Optional<Authentication> getLoggedInUser() { return Optional.ofNullable(securityContextHolder.getContext().getAuthentication()); }
SecurityContextServiceImpl implements SecurityContextService { @Override public Optional<Authentication> getLoggedInUser() { return Optional.ofNullable(securityContextHolder.getContext().getAuthentication()); } }
SecurityContextServiceImpl implements SecurityContextService { @Override public Optional<Authentication> getLoggedInUser() { return Optional.ofNullable(securityContextHolder.getContext().getAuthentication()); } SecurityContextServiceImpl(final SecurityContextHolderSpringDelegate securityContextHolder, final ProfileService profileService); }
SecurityContextServiceImpl implements SecurityContextService { @Override public Optional<Authentication> getLoggedInUser() { return Optional.ofNullable(securityContextHolder.getContext().getAuthentication()); } SecurityContextServiceImpl(final SecurityContextHolderSpringDelegate securityContextHolder, final ProfileService profileService); @Override Optional<Authentication> getLoggedInUser(); @Override boolean isUserFullyAuthenticated(); @Override Optional<UserProfile> getLoggedInUserProfile(); }
SecurityContextServiceImpl implements SecurityContextService { @Override public Optional<Authentication> getLoggedInUser() { return Optional.ofNullable(securityContextHolder.getContext().getAuthentication()); } SecurityContextServiceImpl(final SecurityContextHolderSpringDelegate securityContextHolder, final ProfileService profileService); @Override Optional<Authentication> getLoggedInUser(); @Override boolean isUserFullyAuthenticated(); @Override Optional<UserProfile> getLoggedInUserProfile();  }