Search in sources :

Example 1 with ChapSession

use of edu.stanford.bmir.protege.web.shared.auth.ChapSession in project webprotege by protegeproject.

the class GetChapSessionActionHandler method execute.

@Nonnull
@Override
public GetChapSessionResult execute(@Nonnull GetChapSessionAction action, @Nonnull ExecutionContext executionContext) {
    UserId userId = action.getUserId();
    if (userId.isGuest()) {
        logger.info("Attempt at authenticating guest user");
        return new GetChapSessionResult(Optional.empty());
    }
    Optional<Salt> salt = authenticationManager.getSalt(userId);
    if (!salt.isPresent()) {
        logger.info("Attempt to authenticate non-existing user: {}", userId);
        return new GetChapSessionResult(Optional.empty());
    }
    ChapSession challengeMessage = chapSessionManager.getSession(salt.get());
    return new GetChapSessionResult(Optional.of(challengeMessage));
}
Also used : Salt(edu.stanford.bmir.protege.web.shared.auth.Salt) UserId(edu.stanford.bmir.protege.web.shared.user.UserId) ChapSession(edu.stanford.bmir.protege.web.shared.auth.ChapSession) GetChapSessionResult(edu.stanford.bmir.protege.web.shared.auth.GetChapSessionResult) Nonnull(javax.annotation.Nonnull)

Example 2 with ChapSession

use of edu.stanford.bmir.protege.web.shared.auth.ChapSession in project webprotege by protegeproject.

the class ChapSessionFactory_TestCase method shouldUseProvidedChallengeMessage.

@Test
public void shouldUseProvidedChallengeMessage() {
    ChapSession session = factory.create(salt);
    assertThat(session.getChallengeMessage(), is(challengeMessage));
}
Also used : ChapSession(edu.stanford.bmir.protege.web.shared.auth.ChapSession) Test(org.junit.Test)

Example 3 with ChapSession

use of edu.stanford.bmir.protege.web.shared.auth.ChapSession in project webprotege by protegeproject.

the class ChapSessionManager method getSession.

public ChapSession getSession(Salt salt) {
    ChapSession message = chapSessionFactory.create(salt);
    messageCache.put(message.getId(), message);
    return message;
}
Also used : ChapSession(edu.stanford.bmir.protege.web.shared.auth.ChapSession)

Example 4 with ChapSession

use of edu.stanford.bmir.protege.web.shared.auth.ChapSession in project webprotege by protegeproject.

the class ChapSessionFactory_TestCase method shouldUseProvidedSessionId.

@Test
public void shouldUseProvidedSessionId() {
    ChapSession session = factory.create(salt);
    assertThat(session.getId(), is(chapSessionId));
}
Also used : ChapSession(edu.stanford.bmir.protege.web.shared.auth.ChapSession) Test(org.junit.Test)

Example 5 with ChapSession

use of edu.stanford.bmir.protege.web.shared.auth.ChapSession in project webprotege by protegeproject.

the class ChapSessionFactory_TestCase method shouldUseProvidedSalt.

@Test
public void shouldUseProvidedSalt() {
    ChapSession session = factory.create(salt);
    assertThat(session.getSalt(), is(salt));
}
Also used : ChapSession(edu.stanford.bmir.protege.web.shared.auth.ChapSession) Test(org.junit.Test)

Aggregations

ChapSession (edu.stanford.bmir.protege.web.shared.auth.ChapSession)5 Test (org.junit.Test)3 GetChapSessionResult (edu.stanford.bmir.protege.web.shared.auth.GetChapSessionResult)1 Salt (edu.stanford.bmir.protege.web.shared.auth.Salt)1 UserId (edu.stanford.bmir.protege.web.shared.user.UserId)1 Nonnull (javax.annotation.Nonnull)1