Search in sources :

Example 6 with AccountFederationEntity

use of com.gw2auth.oauth2.server.repository.account.AccountFederationEntity in project oauth2-server by gw2auth.

the class AccountControllerTest method deleteAccountFederation.

@WithGw2AuthLogin(issuer = "issuer", idAtIssuer = "idAtIssuer")
public void deleteAccountFederation(MockHttpSession session) throws Exception {
    final long accountId = AuthenticationHelper.getUser(session).orElseThrow().getAccountId();
    this.accountFederationRepository.save(new AccountFederationEntity("issuer2", "idAtIssuer2", accountId));
    this.mockMvc.perform(delete("/api/account/federation").session(session).queryParam("issuer", "issuer2").queryParam("idAtIssuer", "idAtIssuer2").with(csrf())).andExpect(status().isOk());
    final List<AccountFederationEntity> result = this.accountFederationRepository.findAllByAccountId(accountId);
    assertEquals(1, result.size());
    assertEquals(new AccountFederationEntity("issuer", "idAtIssuer", accountId), result.get(0));
}
Also used : AccountFederationEntity(com.gw2auth.oauth2.server.repository.account.AccountFederationEntity)

Aggregations

AccountFederationEntity (com.gw2auth.oauth2.server.repository.account.AccountFederationEntity)6 AccountEntity (com.gw2auth.oauth2.server.repository.account.AccountEntity)3 Transactional (org.springframework.transaction.annotation.Transactional)2 ClientConsentEntity (com.gw2auth.oauth2.server.repository.client.consent.ClientConsentEntity)1 ClientRegistrationEntity (com.gw2auth.oauth2.server.repository.client.registration.ClientRegistrationEntity)1 Gw2AccountVerificationEntity (com.gw2auth.oauth2.server.repository.verification.Gw2AccountVerificationEntity)1 StringEndsWith (org.hamcrest.core.StringEndsWith)1