Search in sources :

Example 1 with CmsPublicKey

use of org.sagebionetworks.bridge.models.CmsPublicKey in project BridgeServer2 by Sage-Bionetworks.

the class AppControllerTest method canGetCmsPublicKeyPemFile.

@Test
public void canGetCmsPublicKeyPemFile() throws Exception {
    doReturn(mockSession).when(controller).getAuthenticatedSession(DEVELOPER);
    CmsPublicKey result = controller.getAppPublicKeyAsPem();
    assertTrue(result.getPublicKey().contains("-----BEGIN CERTIFICATE-----"));
}
Also used : CmsPublicKey(org.sagebionetworks.bridge.models.CmsPublicKey) Test(org.testng.annotations.Test)

Example 2 with CmsPublicKey

use of org.sagebionetworks.bridge.models.CmsPublicKey in project BridgeServer2 by Sage-Bionetworks.

the class AppController method getAppPublicKeyAsPem.

@GetMapping(path = { "/v1/apps/self/publicKey", "/v3/studies/self/publicKey" })
public CmsPublicKey getAppPublicKeyAsPem() {
    UserSession session = getAuthenticatedSession(DEVELOPER);
    String pem = uploadCertificateService.getPublicKeyAsPem(session.getAppId());
    return new CmsPublicKey(pem);
}
Also used : CmsPublicKey(org.sagebionetworks.bridge.models.CmsPublicKey) UserSession(org.sagebionetworks.bridge.models.accounts.UserSession) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Aggregations

CmsPublicKey (org.sagebionetworks.bridge.models.CmsPublicKey)2 UserSession (org.sagebionetworks.bridge.models.accounts.UserSession)1 GetMapping (org.springframework.web.bind.annotation.GetMapping)1 Test (org.testng.annotations.Test)1