@Test(expected = InvalidTokenException.class) public void testUpdatedApprovals() { Date thirtySecondsAhead = new Date(System.currentTimeMillis() + 30000); approvalStore.addApproval( new Approval() .setUserId(userId) .setClientId("client") .setScope("read") .setExpiresAt(thirtySecondsAhead) .setStatus(ApprovalStatus.APPROVED)); Claims result = endpoint.checkToken(accessToken.getValue()); assertEquals(null, result.getAuthorities()); }
@Test(expected = InvalidTokenException.class) public void testExpiredApprovals() { approvalStore.revokeApproval( new Approval() .setUserId(userId) .setClientId("client") .setScope("read") .setExpiresAt(new Date()) .setStatus(ApprovalStatus.APPROVED)); approvalStore.addApproval( new Approval() .setUserId(userId) .setClientId("client") .setScope("read") .setExpiresAt(new Date()) .setStatus(ApprovalStatus.APPROVED)); Claims result = endpoint.checkToken(accessToken.getValue()); assertEquals(null, result.getAuthorities()); }
@Test public void testClientAuthoritiesNotInResult() { Claims result = endpoint.checkToken(accessToken.getValue()); assertEquals(null, result.getAuthorities()); }