@Test(expected = IllegalStateException.class) public void testGetUserIdBeforeLogin() { authentication.getUserId(); }
@Nullable @Override public String getUserId() { if (tokenInfo == null) { throw new IllegalStateException("UserId can only be retrieved after successful authentication."); } return tokenInfo.getUserId(); }
TokenAuthentication implements Authentication { @Nullable @Override public String getUserId() { if (tokenInfo == null) { throw new IllegalStateException("UserId can only be retrieved after successful authentication."); } return tokenInfo.getUserId(); } }
TokenAuthentication implements Authentication { @Nullable @Override public String getUserId() { if (tokenInfo == null) { throw new IllegalStateException("UserId can only be retrieved after successful authentication."); } return tokenInfo.getUserId(); } TokenAuthentication(@NotNull TokenProvider tokenProvider); }
TokenAuthentication implements Authentication { @Nullable @Override public String getUserId() { if (tokenInfo == null) { throw new IllegalStateException("UserId can only be retrieved after successful authentication."); } return tokenInfo.getUserId(); } TokenAuthentication(@NotNull TokenProvider tokenProvider); @Override boolean authenticate(@Nullable Credentials credentials); @Nullable @Override String getUserId(); @Nullable @Override Principal getUserPrincipal(); }
TokenAuthentication implements Authentication { @Nullable @Override public String getUserId() { if (tokenInfo == null) { throw new IllegalStateException("UserId can only be retrieved after successful authentication."); } return tokenInfo.getUserId(); } TokenAuthentication(@NotNull TokenProvider tokenProvider); @Override boolean authenticate(@Nullable Credentials credentials); @Nullable @Override String getUserId(); @Nullable @Override Principal getUserPrincipal();  }