Search in sources :

Example 11 with AuditingHelper

use of org.cloudfoundry.credhub.helper.AuditingHelper in project credhub by cloudfoundry-incubator.

the class PermissionsEndpointTest method beforeEach.

@Before
public void beforeEach() throws Exception {
    mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).apply(springSecurity()).build();
    RequestHelper.setPassword(mockMvc, credentialName, "testpassword", CredentialWriteMode.NO_OVERWRITE.mode);
    auditingHelper = new AuditingHelper(requestAuditRecordRepository, eventAuditRecordRepository);
}
Also used : AuditingHelper(org.cloudfoundry.credhub.helper.AuditingHelper) Before(org.junit.Before)

Example 12 with AuditingHelper

use of org.cloudfoundry.credhub.helper.AuditingHelper in project credhub by cloudfoundry-incubator.

the class RegenerationEndpointTest method beforeEach.

@Before
public void beforeEach() throws Exception {
    mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).apply(springSecurity()).build();
    auditingHelper = new AuditingHelper(requestAuditRecordRepository, eventAuditRecordRepository);
    MockHttpServletRequestBuilder generatePasswordRequest = post(API_V1_DATA_ENDPOINT).header("Authorization", "Bearer " + AuthConstants.UAA_OAUTH2_PASSWORD_GRANT_TOKEN).accept(APPLICATION_JSON).contentType(APPLICATION_JSON).content("{\n" + "  \"name\" : \"picard\",\n" + "  \"type\" : \"password\",\n" + "  \"additional_permissions\":\n" + "  [\n" + "    {\n" + "      \"actor\": \" " + AuthConstants.UAA_OAUTH2_CLIENT_CREDENTIALS_ACTOR_ID + "\",\n" + "      \"operations\": [\"write\", \"read\"]\n" + "    }\n" + "  ]\n" + "}");
    String generatePasswordResult = this.mockMvc.perform(generatePasswordRequest).andDo(print()).andExpect(status().isOk()).andReturn().getResponse().getContentAsString();
    originalPassword = (new JSONObject(generatePasswordResult)).getString("value");
    assertThat(originalPassword, notNullValue());
}
Also used : JSONObject(org.json.JSONObject) MockHttpServletRequestBuilder(org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder) AuditingHelper(org.cloudfoundry.credhub.helper.AuditingHelper) Before(org.junit.Before)

Example 13 with AuditingHelper

use of org.cloudfoundry.credhub.helper.AuditingHelper in project credhub by cloudfoundry-incubator.

the class CredentialsControllerTypeSpecificSetTest method setUp.

@Before
public void setUp() throws Exception {
    Consumer<Long> fakeTimeSetter = mockOutCurrentTimeProvider(mockCurrentTimeProvider);
    fakeTimeSetter.accept(FROZEN_TIME.toEpochMilli());
    mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).apply(springSecurity()).build();
    auditingHelper = new AuditingHelper(requestAuditRecordRepository, eventAuditRecordRepository);
}
Also used : AuditingHelper(org.cloudfoundry.credhub.helper.AuditingHelper) Before(org.junit.Before)

Example 14 with AuditingHelper

use of org.cloudfoundry.credhub.helper.AuditingHelper in project credhub by cloudfoundry-incubator.

the class CredentialDeleteTest method beforeEach.

@Before
public void beforeEach() {
    mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).apply(springSecurity()).build();
    auditingHelper = new AuditingHelper(requestAuditRecordRepository, eventAuditRecordRepository);
}
Also used : AuditingHelper(org.cloudfoundry.credhub.helper.AuditingHelper) Before(org.junit.Before)

Example 15 with AuditingHelper

use of org.cloudfoundry.credhub.helper.AuditingHelper in project credhub by cloudfoundry-incubator.

the class CredentialFindTest method beforeEach.

@Before
public void beforeEach() {
    mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).apply(springSecurity()).build();
    auditingHelper = new AuditingHelper(requestAuditRecordRepository, eventAuditRecordRepository);
}
Also used : AuditingHelper(org.cloudfoundry.credhub.helper.AuditingHelper) Before(org.junit.Before)

Aggregations

AuditingHelper (org.cloudfoundry.credhub.helper.AuditingHelper)19 Before (org.junit.Before)19 MockHttpServletRequestBuilder (org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder)2 CertificateCredentialValue (org.cloudfoundry.credhub.credential.CertificateCredentialValue)1 RsaCredentialValue (org.cloudfoundry.credhub.credential.RsaCredentialValue)1 SshCredentialValue (org.cloudfoundry.credhub.credential.SshCredentialValue)1 StringCredentialValue (org.cloudfoundry.credhub.credential.StringCredentialValue)1 UserCredentialValue (org.cloudfoundry.credhub.credential.UserCredentialValue)1 GenerationParameters (org.cloudfoundry.credhub.request.GenerationParameters)1 StringGenerationParameters (org.cloudfoundry.credhub.request.StringGenerationParameters)1 JSONObject (org.json.JSONObject)1 Matchers.anyString (org.mockito.Matchers.anyString)1