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));
}
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));
}
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;
}
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));
}
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));
}
Aggregations