use of eu.bcvsolutions.idm.core.security.api.dto.IdmJwtAuthenticationDto in project CzechIdMng by bcvsolutions.
the class ExtendExpirationFilterTest method testSuccBasicAuthTokenExtension.
@Test
public void testSuccBasicAuthTokenExtension() throws Exception {
IdmJwtAuthenticationDto authDto = AuthenticationTestUtils.getAuthDto(identityService.getByUsername(TEST_ADMIN_USERNAME), Lists.newArrayList(IdmAuthorityUtils.getAdminAuthority()));
String token = getAuthToken(authDto);
String basicAuth = AuthenticationTestUtils.getBasicAuth(TEST_ADMIN_USERNAME, TEST_ADMIN_PASSWORD);
sleep();
MvcResult result = getMockMvc().perform(get(AuthenticationTestUtils.getSelfPath(TEST_ADMIN_USERNAME)).header("Authorization", "Basic " + basicAuth).header(JwtAuthenticationMapper.AUTHENTICATION_TOKEN_NAME, token).contentType(HAL_CONTENT_TYPE)).andExpect(status().isOk()).andExpect(content().contentType(HAL_CONTENT_TYPE)).andExpect(jsonPath("$.username", equalTo(TEST_ADMIN_USERNAME))).andReturn();
IdmJwtAuthenticationDto extendedDto = getIdmJwtDto(result);
checkSuccessfulTokenExtension(authDto, extendedDto);
}
Aggregations