Search in sources :

Example 1 with GetChapSessionResult

use of edu.stanford.bmir.protege.web.shared.auth.GetChapSessionResult 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)

Aggregations

ChapSession (edu.stanford.bmir.protege.web.shared.auth.ChapSession)1 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