Search in sources :

Example 36 with UserId

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));
}
Also used : UserIdMention(edu.stanford.bmir.protege.web.shared.issues.mention.UserIdMention) UserId(edu.stanford.bmir.protege.web.shared.user.UserId) Test(org.junit.Test)

Example 37 with UserId

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));
}
Also used : UserId(edu.stanford.bmir.protege.web.shared.user.UserId) Test(org.junit.Test)

Example 38 with UserId

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);
}
Also used : UserId(edu.stanford.bmir.protege.web.shared.user.UserId) Test(org.junit.Test)

Example 39 with UserId

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);
}
Also used : UserId(edu.stanford.bmir.protege.web.shared.user.UserId) Test(org.junit.Test)

Example 40 with UserId

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();
    }
}
Also used : UserId(edu.stanford.bmir.protege.web.shared.user.UserId) Nonnull(javax.annotation.Nonnull)

Aggregations

UserId (edu.stanford.bmir.protege.web.shared.user.UserId)64 Nonnull (javax.annotation.Nonnull)20 Test (org.junit.Test)14 ProjectId (edu.stanford.bmir.protege.web.shared.project.ProjectId)13 Inject (javax.inject.Inject)6 OWLEntity (org.semanticweb.owlapi.model.OWLEntity)6 List (java.util.List)5 ImmutableList (com.google.common.collect.ImmutableList)4 AccessManager (edu.stanford.bmir.protege.web.server.access.AccessManager)4 WebProtegeSession (edu.stanford.bmir.protege.web.server.session.WebProtegeSession)4 WebProtegeSessionImpl (edu.stanford.bmir.protege.web.server.session.WebProtegeSessionImpl)4 OWLEntityData (edu.stanford.bmir.protege.web.shared.entity.OWLEntityData)4 EventTag (edu.stanford.bmir.protege.web.shared.event.EventTag)4 ArrayList (java.util.ArrayList)4 DispatchServiceCallback (edu.stanford.bmir.protege.web.client.dispatch.DispatchServiceCallback)3 Subject.forUser (edu.stanford.bmir.protege.web.server.access.Subject.forUser)3 Optional (java.util.Optional)3 Stopwatch (com.google.common.base.Stopwatch)2 ImmutableSet (com.google.common.collect.ImmutableSet)2 ProjectResource (edu.stanford.bmir.protege.web.server.access.ProjectResource)2