Search in sources :

Example 1 with SignIn

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

the class CacheKeyTest method emailSignInRequest.

@Test
public void emailSignInRequest() {
    SignIn signIn = new SignIn.Builder().withAppId(TEST_APP_ID).withEmail("email@email.com").build();
    assertEquals(CacheKey.emailSignInRequest(signIn).toString(), "email@email.com:" + TEST_APP_ID + ":signInRequest");
}
Also used : SignIn(org.sagebionetworks.bridge.models.accounts.SignIn) Test(org.testng.annotations.Test)

Example 2 with SignIn

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

the class SignInValidatorTest method passwordSignInWithPhoneOK.

@Test
public void passwordSignInWithPhoneOK() {
    SignIn signIn = new SignIn.Builder().withAppId(TEST_APP_ID).withPhone(TestConstants.PHONE).withPassword(PASSWORD).build();
    Validate.entityThrowingException(SignInValidator.PASSWORD_SIGNIN, signIn);
}
Also used : SignIn(org.sagebionetworks.bridge.models.accounts.SignIn) Test(org.testng.annotations.Test)

Example 3 with SignIn

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

the class SignInValidatorTest method emailSignInOK.

@Test
public void emailSignInOK() {
    SignIn signIn = new SignIn.Builder().withAppId(TEST_APP_ID).withEmail(EMAIL).withToken(TOKEN).build();
    Validate.entityThrowingException(SignInValidator.EMAIL_SIGNIN, signIn);
}
Also used : SignIn(org.sagebionetworks.bridge.models.accounts.SignIn) Test(org.testng.annotations.Test)

Example 4 with SignIn

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

the class SignInValidatorTest method reauthWithInvalidPhoneInvalid.

@Test
public void reauthWithInvalidPhoneInvalid() {
    SignIn signIn = new SignIn.Builder().withPhone(new Phone("xxxxxxxxxx", "US")).build();
    assertValidatorMessage(SignInValidator.REAUTH_SIGNIN, signIn, "phone", "does not appear to be a phone number");
}
Also used : Phone(org.sagebionetworks.bridge.models.accounts.Phone) SignIn(org.sagebionetworks.bridge.models.accounts.SignIn) Test(org.testng.annotations.Test)

Example 5 with SignIn

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

the class SignInValidatorTest method phoneSignInRequestOK.

@Test
public void phoneSignInRequestOK() {
    SignIn signIn = new SignIn.Builder().withAppId(TEST_APP_ID).withPhone(TestConstants.PHONE).build();
    Validate.entityThrowingException(SignInValidator.PHONE_SIGNIN_REQUEST, signIn);
}
Also used : SignIn(org.sagebionetworks.bridge.models.accounts.SignIn) Test(org.testng.annotations.Test)

Aggregations

SignIn (org.sagebionetworks.bridge.models.accounts.SignIn)79 Test (org.testng.annotations.Test)61 App (org.sagebionetworks.bridge.models.apps.App)15 IdentifierUpdate (org.sagebionetworks.bridge.models.accounts.IdentifierUpdate)14 CriteriaContext (org.sagebionetworks.bridge.models.CriteriaContext)13 StatusMessage (org.sagebionetworks.bridge.models.StatusMessage)12 Account (org.sagebionetworks.bridge.models.accounts.Account)10 PostMapping (org.springframework.web.bind.annotation.PostMapping)9 Phone (org.sagebionetworks.bridge.models.accounts.Phone)7 UserSession (org.sagebionetworks.bridge.models.accounts.UserSession)7 JsonNode (com.fasterxml.jackson.databind.JsonNode)5 DateRangeResourceList (org.sagebionetworks.bridge.models.DateRangeResourceList)5 StudyParticipant (org.sagebionetworks.bridge.models.accounts.StudyParticipant)5 HealthDataSubmission (org.sagebionetworks.bridge.models.healthdata.HealthDataSubmission)5 ReportData (org.sagebionetworks.bridge.models.reports.ReportData)5 RequestContext (org.sagebionetworks.bridge.RequestContext)4 BadRequestException (org.sagebionetworks.bridge.exceptions.BadRequestException)4 ConsentRequiredException (org.sagebionetworks.bridge.exceptions.ConsentRequiredException)4 UnauthorizedException (org.sagebionetworks.bridge.exceptions.UnauthorizedException)3 ResponseStatus (org.springframework.web.bind.annotation.ResponseStatus)3