use of org.simbasecurity.api.service.thrift.SSOToken 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;
}
use of org.simbasecurity.api.service.thrift.SSOToken in project simba-os by cegeka.
the class AuthenticationFilterServiceImpl method getCurrentSession.
Session getCurrentSession(RequestData requestData) {
SSOToken ssoToken;
if (requestData.isSsoTokenMappingKeyProvided()) {
String ssoTokenKey = requestData.getRequestParameters().get(SIMBA_SSO_TOKEN);
ssoToken = ssoTokenMappingService.getSSOToken(ssoTokenKey);
if (ssoToken != null) {
ssoTokenMappingService.destroyMapping(ssoTokenKey);
}
} else {
ssoToken = requestData.getSsoToken();
}
return sessionService.getSession(ssoToken);
}
use of org.simbasecurity.api.service.thrift.SSOToken in project simba-os by cegeka.
the class AuthenticationFilterServiceImplTest method testGetCurrentSession_NoTokenMappingProvided.
@Test
public void testGetCurrentSession_NoTokenMappingProvided() {
SSOToken ssoToken = mock(SSOToken.class);
RequestData requestData = new RequestData(null, null, null, null, ssoToken, null, false, false, false, false, false, null, null, null, null);
serviceImpl.getCurrentSession(requestData);
verify(sessionServiceMock).getSession(same(ssoToken));
}
use of org.simbasecurity.api.service.thrift.SSOToken in project simba-os by cegeka.
the class DatabaseAuditLogProviderTest method auditEventIsPersisted_digestEnabled.
@Test
public void auditEventIsPersisted_digestEnabled() {
when(configurationServiceMock.getValue(SimbaConfigurationParameter.AUDIT_LOG_INTEGRITY_ENABLED)).thenReturn(Boolean.TRUE);
SSOToken ssoToken = new SSOToken();
AuditLogEvent event = new AuditLogEvent(AuditLogEventCategory.SESSION, "username", ssoToken, "remoteIP", "message", "userAgent", "hostServerName", "surname", "firstname", "requestURL", "CHAINID");
provider.log(event);
jdbcTemplate.query("SELECT * FROM SIMBA_AUDIT_LOG WHERE ssoToken=?", getRowMapper(false), ssoToken.getToken());
}
Aggregations