@Test public void should_return_customerId_when_authenticated() { SecurityContextHolder.getContext() .setAuthentication(new TestingAuthenticationToken(4711L, "credentials")); assertThat(securityService.getCustomerId(), is(4711L)); }
@Override public Long getCustomerId() { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); return authentication == null ? null : (Long) authentication.getPrincipal(); }
SecurityServiceImpl implements SecurityService { @Override public Long getCustomerId() { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); return authentication == null ? null : (Long) authentication.getPrincipal(); } }
SecurityServiceImpl implements SecurityService { @Override public Long getCustomerId() { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); return authentication == null ? null : (Long) authentication.getPrincipal(); }  }
SecurityServiceImpl implements SecurityService { @Override public Long getCustomerId() { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); return authentication == null ? null : (Long) authentication.getPrincipal(); }  @PostConstruct void postConstruct(); @Override Long getCustomerId(); @Override void authenticateToken(String token); @Override void removeAuthentication(); @Override @Transactional String createCodeForWebappToken(Long customerId, WebappCredentials credentials); @Override @Transactional String tradeCodeToWebappToken(String code); @Scheduled(initialDelay = 60_000L, fixedRate = 600_000L) @Transactional @Override void removeExpiredTokenCodes(); @Override @Transactional String doHerokuSingleSignOn(
      String token, String externalId, String email, long timestampSeconds, String salt); }
SecurityServiceImpl implements SecurityService { @Override public Long getCustomerId() { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); return authentication == null ? null : (Long) authentication.getPrincipal(); }  @PostConstruct void postConstruct(); @Override Long getCustomerId(); @Override void authenticateToken(String token); @Override void removeAuthentication(); @Override @Transactional String createCodeForWebappToken(Long customerId, WebappCredentials credentials); @Override @Transactional String tradeCodeToWebappToken(String code); @Scheduled(initialDelay = 60_000L, fixedRate = 600_000L) @Transactional @Override void removeExpiredTokenCodes(); @Override @Transactional String doHerokuSingleSignOn(
      String token, String externalId, String email, long timestampSeconds, String salt);  }