Search in sources :

Example 1 with EmailVerificationStatusHolder

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

the class AppController method verifySenderEmail.

@PostMapping(path = { "/v1/apps/self/verifyEmail", "/v3/studies/self/verifyEmail" })
public EmailVerificationStatusHolder verifySenderEmail() {
    UserSession session = getAuthenticatedSession(DEVELOPER);
    App app = appService.getApp(session.getAppId());
    EmailVerificationStatus status = emailVerificationService.verifyEmailAddress(app.getSupportEmail());
    return new EmailVerificationStatusHolder(status);
}
Also used : App(org.sagebionetworks.bridge.models.apps.App) UserSession(org.sagebionetworks.bridge.models.accounts.UserSession) EmailVerificationStatus(org.sagebionetworks.bridge.services.EmailVerificationStatus) EmailVerificationStatusHolder(org.sagebionetworks.bridge.models.apps.EmailVerificationStatusHolder) PostMapping(org.springframework.web.bind.annotation.PostMapping)

Example 2 with EmailVerificationStatusHolder

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

the class AppController method getEmailStatus.

@GetMapping(path = { "/v1/apps/self/emailStatus", "/v3/studies/self/emailStatus" })
public EmailVerificationStatusHolder getEmailStatus() {
    UserSession session = getAuthenticatedSession(DEVELOPER);
    App app = appService.getApp(session.getAppId());
    EmailVerificationStatus status = emailVerificationService.getEmailStatus(app.getSupportEmail());
    return new EmailVerificationStatusHolder(status);
}
Also used : App(org.sagebionetworks.bridge.models.apps.App) UserSession(org.sagebionetworks.bridge.models.accounts.UserSession) EmailVerificationStatus(org.sagebionetworks.bridge.services.EmailVerificationStatus) EmailVerificationStatusHolder(org.sagebionetworks.bridge.models.apps.EmailVerificationStatusHolder) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 3 with EmailVerificationStatusHolder

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

the class AppControllerTest method getEmailStatus.

@Test
public void getEmailStatus() throws Exception {
    doReturn(mockSession).when(controller).getAuthenticatedSession(DEVELOPER);
    EmailVerificationStatusHolder result = controller.getEmailStatus();
    verify(mockVerificationService).getEmailStatus(EMAIL_ADDRESS);
    assertEquals(result.getStatus(), VERIFIED);
}
Also used : EmailVerificationStatusHolder(org.sagebionetworks.bridge.models.apps.EmailVerificationStatusHolder) Test(org.testng.annotations.Test)

Example 4 with EmailVerificationStatusHolder

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

the class AppControllerTest method verifySenderEmail.

@Test
public void verifySenderEmail() throws Exception {
    doReturn(mockSession).when(controller).getAuthenticatedSession(DEVELOPER);
    when(mockVerificationService.verifyEmailAddress(EMAIL_ADDRESS)).thenReturn(VERIFIED);
    EmailVerificationStatusHolder result = controller.verifySenderEmail();
    verify(mockVerificationService).verifyEmailAddress(EMAIL_ADDRESS);
    assertEquals(result.getStatus(), VERIFIED);
}
Also used : EmailVerificationStatusHolder(org.sagebionetworks.bridge.models.apps.EmailVerificationStatusHolder) Test(org.testng.annotations.Test)

Aggregations

EmailVerificationStatusHolder (org.sagebionetworks.bridge.models.apps.EmailVerificationStatusHolder)4 UserSession (org.sagebionetworks.bridge.models.accounts.UserSession)2 App (org.sagebionetworks.bridge.models.apps.App)2 EmailVerificationStatus (org.sagebionetworks.bridge.services.EmailVerificationStatus)2 Test (org.testng.annotations.Test)2 GetMapping (org.springframework.web.bind.annotation.GetMapping)1 PostMapping (org.springframework.web.bind.annotation.PostMapping)1