Search in sources :

Example 1 with ChangeSecret

use of org.cloudfoundry.uaa.clients.ChangeSecret in project cf-java-client by cloudfoundry.

the class ClientsTest method changeSecret.

@Test
public void changeSecret() {
    String clientId = this.nameFactory.getClientId();
    String newClientSecret = this.nameFactory.getClientSecret();
    String oldClientSecret = this.nameFactory.getClientSecret();
    requestCreateClient(this.uaaClient, clientId, oldClientSecret).then(this.uaaClient.clients().changeSecret(ChangeSecretRequest.builder().clientId(clientId).oldSecret(oldClientSecret).secret(newClientSecret).build())).as(StepVerifier::create).consumeErrorWith(t -> assertThat(t).isInstanceOf(UaaException.class).hasMessage("invalid_client: Only a client can change client secret")).verify(Duration.ofMinutes(5));
}
Also used : UpdateMetadataResponse(org.cloudfoundry.uaa.clients.UpdateMetadataResponse) UpdateSecretAction(org.cloudfoundry.uaa.clients.UpdateSecretAction) StepVerifier(reactor.test.StepVerifier) UpdateClient(org.cloudfoundry.uaa.clients.UpdateClient) Client(org.cloudfoundry.uaa.clients.Client) DeleteClientRequest(org.cloudfoundry.uaa.clients.DeleteClientRequest) BatchUpdateClientsRequest(org.cloudfoundry.uaa.clients.BatchUpdateClientsRequest) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) IMPLICIT(org.cloudfoundry.uaa.tokens.GrantType.IMPLICIT) GetClientRequest(org.cloudfoundry.uaa.clients.GetClientRequest) CLIENT_CREDENTIALS(org.cloudfoundry.uaa.tokens.GrantType.CLIENT_CREDENTIALS) AsciiString(io.netty.util.AsciiString) Autowired(org.springframework.beans.factory.annotation.Autowired) TimeoutException(java.util.concurrent.TimeoutException) AbstractIntegrationTest(org.cloudfoundry.AbstractIntegrationTest) UpdateMetadataRequest(org.cloudfoundry.uaa.clients.UpdateMetadataRequest) PASSWORD(org.cloudfoundry.uaa.tokens.GrantType.PASSWORD) MixedActionsRequest(org.cloudfoundry.uaa.clients.MixedActionsRequest) UpdateClientAction(org.cloudfoundry.uaa.clients.UpdateClientAction) Duration(java.time.Duration) PaginationUtils(org.cloudfoundry.util.PaginationUtils) UpdateSecretClientAction(org.cloudfoundry.uaa.clients.UpdateSecretClientAction) BatchChangeSecretResponse(org.cloudfoundry.uaa.clients.BatchChangeSecretResponse) CreateClientResponse(org.cloudfoundry.uaa.clients.CreateClientResponse) ListMetadatasResponse(org.cloudfoundry.uaa.clients.ListMetadatasResponse) BatchCreateClientsResponse(org.cloudfoundry.uaa.clients.BatchCreateClientsResponse) ListClientsRequest(org.cloudfoundry.uaa.clients.ListClientsRequest) UpdateClientRequest(org.cloudfoundry.uaa.clients.UpdateClientRequest) BatchUpdateClientsResponse(org.cloudfoundry.uaa.clients.BatchUpdateClientsResponse) GetMetadataResponse(org.cloudfoundry.uaa.clients.GetMetadataResponse) CreateClient(org.cloudfoundry.uaa.clients.CreateClient) Test(org.junit.Test) Mono(reactor.core.publisher.Mono) BatchCreateClientsRequest(org.cloudfoundry.uaa.clients.BatchCreateClientsRequest) Flux(reactor.core.publisher.Flux) BatchChangeSecretRequest(org.cloudfoundry.uaa.clients.BatchChangeSecretRequest) Base64(java.util.Base64) DeleteClientAction(org.cloudfoundry.uaa.clients.DeleteClientAction) ChangeSecret(org.cloudfoundry.uaa.clients.ChangeSecret) ChangeSecretRequest(org.cloudfoundry.uaa.clients.ChangeSecretRequest) CreateClientRequest(org.cloudfoundry.uaa.clients.CreateClientRequest) ListMetadatasRequest(org.cloudfoundry.uaa.clients.ListMetadatasRequest) BatchDeleteClientsRequest(org.cloudfoundry.uaa.clients.BatchDeleteClientsRequest) ListClientsResponse(org.cloudfoundry.uaa.clients.ListClientsResponse) GetMetadataRequest(org.cloudfoundry.uaa.clients.GetMetadataRequest) REFRESH_TOKEN(org.cloudfoundry.uaa.tokens.GrantType.REFRESH_TOKEN) CreateClientAction(org.cloudfoundry.uaa.clients.CreateClientAction) AsciiString(io.netty.util.AsciiString) StepVerifier(reactor.test.StepVerifier) AbstractIntegrationTest(org.cloudfoundry.AbstractIntegrationTest) Test(org.junit.Test)

Aggregations

AsciiString (io.netty.util.AsciiString)1 Duration (java.time.Duration)1 Base64 (java.util.Base64)1 TimeoutException (java.util.concurrent.TimeoutException)1 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)1 AbstractIntegrationTest (org.cloudfoundry.AbstractIntegrationTest)1 BatchChangeSecretRequest (org.cloudfoundry.uaa.clients.BatchChangeSecretRequest)1 BatchChangeSecretResponse (org.cloudfoundry.uaa.clients.BatchChangeSecretResponse)1 BatchCreateClientsRequest (org.cloudfoundry.uaa.clients.BatchCreateClientsRequest)1 BatchCreateClientsResponse (org.cloudfoundry.uaa.clients.BatchCreateClientsResponse)1 BatchDeleteClientsRequest (org.cloudfoundry.uaa.clients.BatchDeleteClientsRequest)1 BatchUpdateClientsRequest (org.cloudfoundry.uaa.clients.BatchUpdateClientsRequest)1 BatchUpdateClientsResponse (org.cloudfoundry.uaa.clients.BatchUpdateClientsResponse)1 ChangeSecret (org.cloudfoundry.uaa.clients.ChangeSecret)1 ChangeSecretRequest (org.cloudfoundry.uaa.clients.ChangeSecretRequest)1 Client (org.cloudfoundry.uaa.clients.Client)1 CreateClient (org.cloudfoundry.uaa.clients.CreateClient)1 CreateClientAction (org.cloudfoundry.uaa.clients.CreateClientAction)1 CreateClientRequest (org.cloudfoundry.uaa.clients.CreateClientRequest)1 CreateClientResponse (org.cloudfoundry.uaa.clients.CreateClientResponse)1