use of edu.stanford.bmir.protege.web.shared.user.UserId in project webprotege by protegeproject.
the class IssueBuilder_TestCase method shouldUpdateParticipantsOnBuild.
@Test
public void shouldUpdateParticipantsOnBuild() {
UserId participant = mock(UserId.class);
UserIdMention userIdMention = mock(UserIdMention.class);
when(userIdMention.getMentionedUserId()).thenReturn(Optional.of(participant));
when(parsedMention.getParsedMention()).thenReturn(userIdMention);
Issue issue = builder.build(mentionParser);
assertThat(issue.getParticipants(), hasItems(creator, participant));
}
use of edu.stanford.bmir.protege.web.shared.user.UserId in project webprotege by protegeproject.
the class IssueBuilder_TestCase method shouldBuildIssueWithSpecifiedAssignees.
@Test
public void shouldBuildIssueWithSpecifiedAssignees() {
UserId assignee = mock(UserId.class);
builder.assignTo(assignee, userId, TIMESTAMP);
Issue issue = builder.build(mentionParser);
assertThat(issue.getAssignees(), hasItem(assignee));
}
use of edu.stanford.bmir.protege.web.shared.user.UserId in project webprotege by protegeproject.
the class IssueBuilder_TestCase method shouldUpdateTimestampOnAssign.
@Test
public void shouldUpdateTimestampOnAssign() {
UserId assignee = mock(UserId.class);
builder.assignTo(assignee, userId, TIMESTAMP);
Issue issue = builder.build(mentionParser);
assertThatIssueUpdatedTimestampWasUpdated(issue);
}
use of edu.stanford.bmir.protege.web.shared.user.UserId in project webprotege by protegeproject.
the class GetEmailAddressActionTestCase method equalsReturnsTrueForSameUserId.
@Test
public void equalsReturnsTrueForSameUserId() {
UserId userId = UserId.getUserId("UserB");
GetEmailAddressAction actionA = new GetEmailAddressAction(userId);
GetEmailAddressAction actionB = new GetEmailAddressAction(userId);
assertEquals(actionA, actionB);
}
use of edu.stanford.bmir.protege.web.shared.user.UserId in project webprotege by protegeproject.
the class AuthenticatedActionHandler method execute.
@Nonnull
@Override
public final R execute(@Nonnull A action, @Nonnull ExecutionContext executionContext) {
UserId userId = action.getUserId();
Optional<SaltedPasswordDigest> passwordDigest = authenticationManager.getSaltedPasswordDigest(userId);
if (!passwordDigest.isPresent()) {
logger.info("Authentication attempt, but no digest of salted password set for user {}", userId);
return createAuthenticationFailedResult();
}
Optional<ChapSession> chapDataOptional = chapSessionManager.retrieveChallengeMessage(action.getChapSessionId());
if (!chapDataOptional.isPresent()) {
logger.info("Challenge expired for user {}", userId);
return createAuthenticationFailedResult();
}
ChapSession chapSession = chapDataOptional.get();
ChallengeMessage challenge = chapSession.getChallengeMessage();
ChapResponse chapResponse = action.getChapResponse();
boolean expectedResponse = chapResponseChecker.isExpectedResponse(chapResponse, challenge, passwordDigest.get());
if (expectedResponse) {
return executeAuthenticatedAction(action, executionContext);
} else {
return createAuthenticationFailedResult();
}
}
Aggregations