@Test public void testGetTokenInfoBeforeAuthenticate() { try { authentication.getTokenInfo(); fail("IllegalStateException expected"); } catch (IllegalStateException e) { } }
@NotNull TokenInfo getTokenInfo() { if (tokenInfo == null) { throw new IllegalStateException("Token info can only be retrieved after successful authentication."); } return tokenInfo; }
TokenAuthentication implements Authentication { @NotNull TokenInfo getTokenInfo() { if (tokenInfo == null) { throw new IllegalStateException("Token info can only be retrieved after successful authentication."); } return tokenInfo; } }
TokenAuthentication implements Authentication { @NotNull TokenInfo getTokenInfo() { if (tokenInfo == null) { throw new IllegalStateException("Token info can only be retrieved after successful authentication."); } return tokenInfo; } TokenAuthentication(@NotNull TokenProvider tokenProvider); }
TokenAuthentication implements Authentication { @NotNull TokenInfo getTokenInfo() { if (tokenInfo == null) { throw new IllegalStateException("Token info can only be retrieved after successful authentication."); } return tokenInfo; } TokenAuthentication(@NotNull TokenProvider tokenProvider); @Override boolean authenticate(@Nullable Credentials credentials); @Nullable @Override String getUserId(); @Nullable @Override Principal getUserPrincipal(); }
TokenAuthentication implements Authentication { @NotNull TokenInfo getTokenInfo() { if (tokenInfo == null) { throw new IllegalStateException("Token info can only be retrieved after successful authentication."); } return tokenInfo; } TokenAuthentication(@NotNull TokenProvider tokenProvider); @Override boolean authenticate(@Nullable Credentials credentials); @Nullable @Override String getUserId(); @Nullable @Override Principal getUserPrincipal();  }