use of org.simbasecurity.core.domain.SessionEntity in project simba-os by cegeka.
the class SessionDatabaseRepositoryTest method canFindBySSOToken.
@Test
public void canFindBySSOToken() throws Exception {
User user = UserTestBuilder.aDefaultUser().build();
SSOToken ssoToken = new SSOToken("eenSsoTokentje");
SessionEntity session = new SessionEntity(user, ssoToken, "127.0.0.1", "192.168.1.1");
persistAndRefresh(user, session);
assertEquals(session, sessionDatabaseRepository.findBySSOToken(ssoToken));
}
use of org.simbasecurity.core.domain.SessionEntity in project simba-os by cegeka.
the class SessionServiceImpl method createSession.
@Override
public Session createSession(String userName, String clientIpAddress, String hostServerName, String userAgent, String requestURL) {
User user = userRepository.findByName(userName);
SSOToken ssoToken = new SSOToken(UUID.randomUUID().toString());
Session session = new SessionEntity(user, ssoToken, clientIpAddress, hostServerName);
sessionRepository.persist(session);
audit.log(auditLogEventFactory.createEventForSession(user.getUserName(), ssoToken, clientIpAddress, hostServerName, userAgent, requestURL, SESSION_CREATED));
return session;
}
Aggregations