aboutsummaryrefslogtreecommitdiff
path: root/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage
diff options
context:
space:
mode:
Diffstat (limited to 'id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage')
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/DBAuthenticationSessionStoreage.java117
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/DBTransactionStorage.java16
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/IAuthenticationSessionStoreage.java42
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/ITransactionStorage.java135
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/RedisTransactionStorage.java7
5 files changed, 88 insertions, 229 deletions
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/DBAuthenticationSessionStoreage.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/DBAuthenticationSessionStoreage.java
index 0df6379b0..405e44112 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/DBAuthenticationSessionStoreage.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/DBAuthenticationSessionStoreage.java
@@ -40,13 +40,19 @@ import org.springframework.transaction.annotation.Transactional;
import com.fasterxml.jackson.core.JsonProcessingException;
+import at.gv.egiz.eaaf.core.api.IRequest;
+import at.gv.egiz.eaaf.core.api.idp.slo.SLOInformationInterface;
+import at.gv.egiz.eaaf.core.exceptions.EAAFConfigurationException;
+import at.gv.egiz.eaaf.core.impl.utils.Random;
+import at.gv.egiz.eaaf.modules.pvp2.sp.exception.AssertionAttributeExtractorExeption;
+import at.gv.egiz.eaaf.modules.pvp2.sp.impl.utils.AssertionAttributeExtractor;
import at.gv.egovernment.moa.id.auth.data.AuthenticationSession;
import at.gv.egovernment.moa.id.auth.data.AuthenticationSessionExtensions;
+import at.gv.egovernment.moa.id.auth.data.AuthenticationSessionWrapper;
import at.gv.egovernment.moa.id.auth.exception.AuthenticationException;
import at.gv.egovernment.moa.id.auth.exception.BuildException;
import at.gv.egovernment.moa.id.commons.api.AuthConfiguration;
import at.gv.egovernment.moa.id.commons.api.IOAAuthParameters;
-import at.gv.egovernment.moa.id.commons.api.IRequest;
import at.gv.egovernment.moa.id.commons.api.data.IAuthenticationSession;
import at.gv.egovernment.moa.id.commons.db.dao.session.AuthenticatedSessionStore;
import at.gv.egovernment.moa.id.commons.db.dao.session.InterfederationSessionStore;
@@ -54,11 +60,8 @@ import at.gv.egovernment.moa.id.commons.db.dao.session.OASessionStore;
import at.gv.egovernment.moa.id.commons.db.dao.session.OldSSOSessionIDStore;
import at.gv.egovernment.moa.id.commons.db.ex.MOADatabaseException;
import at.gv.egovernment.moa.id.commons.utils.JsonMapper;
+import at.gv.egovernment.moa.id.config.auth.OAAuthParameterDecorator;
import at.gv.egovernment.moa.id.data.EncryptedData;
-import at.gv.egovernment.moa.id.data.SLOInformationInterface;
-import at.gv.egovernment.moa.id.protocols.pvp2x.exceptions.AssertionAttributeExtractorExeption;
-import at.gv.egovernment.moa.id.protocols.pvp2x.utils.AssertionAttributeExtractor;
-import at.gv.egovernment.moa.id.util.Random;
import at.gv.egovernment.moa.id.util.SessionEncrytionUtil;
import at.gv.egovernment.moa.logging.Logger;
import at.gv.egovernment.moa.util.MiscUtil;
@@ -68,35 +71,18 @@ import at.gv.egovernment.moa.util.MiscUtil;
public class DBAuthenticationSessionStoreage implements IAuthenticationSessionStoreage{
@PersistenceContext(unitName="session")
- private EntityManager entityManager;
+ private EntityManager entityManager;
@Autowired AuthConfiguration authConfig;
private static JsonMapper mapper = new JsonMapper();
-
- //@Autowired MOASessionDBUtils moaSessionDBUtils;
-
- @Override
- public boolean isAuthenticated(String internalSsoSessionID) {
-
- AuthenticatedSessionStore session;
- try {
- session = searchInDatabase(internalSsoSessionID);
- return session.isAuthenticated();
-
- } catch (MOADatabaseException e) {
- return false;
- }
- }
-
@Override
public AuthenticationSession createInternalSSOSession(IRequest target) throws MOADatabaseException, BuildException {
String id = Random.nextLongRandom();
try {
AuthenticatedSessionStore dbsession = new AuthenticatedSessionStore();
dbsession.setSessionid(id);
- dbsession.setAuthenticated(false);
//set Timestamp in this state, because automated timestamp generation is buggy in Hibernate 4.2.1
Date now = new Date();
@@ -106,9 +92,10 @@ public class DBAuthenticationSessionStoreage implements IAuthenticationSessionSt
//set additional session informations
AuthenticationSessionExtensions sessionExt = new AuthenticationSessionExtensions();
sessionExt.setUniqueSessionId(target.getUniqueSessionIdentifier());
- dbsession.setAdditionalInformation(mapper.serialize(sessionExt).getBytes("UTF-8"));
+ dbsession.setAdditionalInformationBytes(mapper.serialize(sessionExt).getBytes("UTF-8"));
- AuthenticationSession session = new AuthenticationSession(id, now, target.getMOASession());
+ AuthenticationSession session = new AuthenticationSession(id, now,
+ (IAuthenticationSession)target.getSessionData(AuthenticationSessionWrapper.class));
encryptSession(session, dbsession);
//store AssertionStore element to Database
@@ -123,7 +110,7 @@ public class DBAuthenticationSessionStoreage implements IAuthenticationSessionSt
} catch (JsonProcessingException | UnsupportedEncodingException e) {
Logger.warn("Extended session information can not be stored.", e);
- throw new MOADatabaseException(e);
+ throw new MOADatabaseException("Extended session information can not be stored.", e);
}
@@ -153,9 +140,9 @@ public class DBAuthenticationSessionStoreage implements IAuthenticationSessionSt
public AuthenticationSessionExtensions getAuthenticationSessionExtensions(String sessionID) throws MOADatabaseException {
AuthenticatedSessionStore dbsession = searchInDatabase(sessionID);
- if (MiscUtil.isNotEmpty(dbsession.getAdditionalInformation())) {
+ if (dbsession.getAdditionalInformationBytes() != null) {
try {
- return (AuthenticationSessionExtensions)mapper.deserialize(new String(dbsession.getAdditionalInformation(), "UTF-8"),
+ return (AuthenticationSessionExtensions)mapper.deserialize(new String(dbsession.getAdditionalInformationBytes(), "UTF-8"),
AuthenticationSessionExtensions.class);
} catch (Exception e) {
@@ -171,7 +158,7 @@ public class DBAuthenticationSessionStoreage implements IAuthenticationSessionSt
try {
AuthenticatedSessionStore dbsession = searchInDatabase(sessionID);
- dbsession.setAdditionalInformation(
+ dbsession.setAdditionalInformationBytes(
mapper.serialize(sessionExtensions).getBytes("UTF-8"));
entityManager.merge(dbsession);
@@ -180,7 +167,7 @@ public class DBAuthenticationSessionStoreage implements IAuthenticationSessionSt
} catch (MOADatabaseException e) {
Logger.warn("MOASession could not be stored.");
- throw new MOADatabaseException(e);
+ throw new MOADatabaseException("MOASession could not be stored.", e);
} catch (JsonProcessingException | UnsupportedEncodingException e) {
Logger.warn("Extended session information can not be stored.", e);
@@ -228,12 +215,12 @@ public class DBAuthenticationSessionStoreage implements IAuthenticationSessionSt
}
@Override
- public AuthenticationSession getInternalMOASessionWithSSOID(String SSOSessionID) throws MOADatabaseException {
- MiscUtil.assertNotNull(SSOSessionID, "SSOsessionID");
- Logger.trace("Get authenticated session with SSOID " + SSOSessionID + " from database.");
+ public String getInternalSSOSessionWithSSOID(String externelSSOId) throws MOADatabaseException {
+ MiscUtil.assertNotNull(externelSSOId, "SSOsessionID");
+ Logger.trace("Get authenticated session with SSOID " + externelSSOId + " from database.");
Query query = entityManager.createNamedQuery("getSessionWithSSOID");
- query.setParameter("sessionid", SSOSessionID);
+ query.setParameter("sessionid", externelSSOId);
List<AuthenticatedSessionStore> results = query.getResultList();
Logger.trace("Found entries: " + results.size());
@@ -245,7 +232,7 @@ public class DBAuthenticationSessionStoreage implements IAuthenticationSessionSt
} else
try {
- return decryptSession(results.get(0));
+ return decryptSession(results.get(0)).getSSOSessionID();
} catch (Throwable e) {
Logger.warn("MOASession deserialization-exception by using internal MOASessionID=" + results.get(0).getSessionid(), e);
@@ -290,11 +277,11 @@ public class DBAuthenticationSessionStoreage implements IAuthenticationSessionSt
}
@Override
- public void addSSOInformation(String moaSessionID, String SSOSessionID,
+ public void addSSOInformation(String internalSSOSessionID, String externalSSOSessionID,
SLOInformationInterface SLOInfo, IRequest protocolRequest) throws AuthenticationException {
Query query = entityManager.createNamedQuery("getSessionWithID");
- query.setParameter("sessionid", moaSessionID);
+ query.setParameter("sessionid", internalSSOSessionID);
List<AuthenticatedSessionStore> results = query.getResultList();
Logger.trace("Found entries: " + results.size());
@@ -312,7 +299,7 @@ public class DBAuthenticationSessionStoreage implements IAuthenticationSessionSt
//check if OA already has an active OA session
if (dbsession.getActiveOAsessions() != null) {
for (OASessionStore el : dbsession.getActiveOAsessions()) {
- if (el.getOaurlprefix().equals(protocolRequest.getOAURL()))
+ if (el.getOaurlprefix().equals(protocolRequest.getSPEntityId()))
activeOA = el;
}
}
@@ -321,7 +308,7 @@ public class DBAuthenticationSessionStoreage implements IAuthenticationSessionSt
activeOA = new OASessionStore();
//set active OA applications
- activeOA.setOaurlprefix(protocolRequest.getOAURL());
+ activeOA.setOaurlprefix(protocolRequest.getSPEntityId());
activeOA.setMoasession(dbsession);
activeOA.setCreated(new Date());
@@ -353,28 +340,28 @@ public class DBAuthenticationSessionStoreage implements IAuthenticationSessionSt
}
dbsession.setSSOSession(true);
- dbsession.setSSOsessionid(SSOSessionID);
- dbsession.setAuthenticated(false);
+ dbsession.setSSOsessionid(externalSSOSessionID);
+ dbsession.setAuthenticated(true);
//Store MOASession
entityManager.merge(dbsession);
if (SLOInfo != null)
- Logger.info("Add SSO-Session login information for OA: " + protocolRequest.getOAURL()
+ Logger.info("Add SSO-Session login information for OA: " + protocolRequest.getSPEntityId()
+ " and AssertionID: " + SLOInfo.getSessionIndex());
else
- Logger.info("Add SSO-Session login information for OA: " + protocolRequest.getOAURL());
+ Logger.info("Add SSO-Session login information for OA: " + protocolRequest.getSPEntityId());
}
@Override
- public List<OASessionStore> getAllActiveOAFromMOASession(IAuthenticationSession moaSession) {
- MiscUtil.assertNotNull(moaSession, "MOASession");
+ public List<OASessionStore> getAllActiveOAFromMOASession(String ssoSessionId) {
+ MiscUtil.assertNotNull( ssoSessionId, "MOASession");
- Logger.trace("Get OAs for moaSession " + moaSession.getSessionID() + " from database.");
+ Logger.trace("Get OAs for moaSession " + ssoSessionId + " from database.");
Query query = entityManager.createNamedQuery("getAllActiveOAsForSessionID");
- query.setParameter("sessionID", moaSession.getSessionID());
+ query.setParameter("sessionID", ssoSessionId);
List<OASessionStore> results = query.getResultList();
Logger.trace("Found entries: " + results.size());
@@ -384,13 +371,13 @@ public class DBAuthenticationSessionStoreage implements IAuthenticationSessionSt
}
@Override
- public List<InterfederationSessionStore> getAllActiveIDPsFromMOASession(IAuthenticationSession moaSession) {
- MiscUtil.assertNotNull(moaSession, "MOASession");
+ public List<InterfederationSessionStore> getAllActiveIDPsFromMOASession(String ssoSessionId) {
+ MiscUtil.assertNotNull( ssoSessionId, "MOASession");
- Logger.trace("Get active IDPs for moaSession " + moaSession.getSessionID() + " from database.");
+ Logger.trace("Get active IDPs for moaSession " + ssoSessionId + " from database.");
Query query = entityManager.createNamedQuery("getAllActiveIDPsForSessionID");
- query.setParameter("sessionID", moaSession.getSessionID());
+ query.setParameter("sessionID", ssoSessionId);
List<InterfederationSessionStore> results = query.getResultList();
Logger.trace("Found entries: " + results.size());
@@ -399,7 +386,7 @@ public class DBAuthenticationSessionStoreage implements IAuthenticationSessionSt
}
@Override
- public IAuthenticationSession searchMOASessionWithNameIDandOAID(String oaID, String userNameID) {
+ public String searchSSOSessionWithNameIDandOAID(String oaID, String userNameID) {
MiscUtil.assertNotNull(oaID, "OnlineApplicationIdentifier");
MiscUtil.assertNotNull(userNameID, "userNameID");
Logger.trace("Get moaSession for userNameID " + userNameID + " and OA "
@@ -419,8 +406,10 @@ public class DBAuthenticationSessionStoreage implements IAuthenticationSessionSt
}
- try {
- return decryptSession(results.get(0));
+ try {
+ AuthenticationSession decrytedSession = decryptSession(results.get(0));
+
+ return decrytedSession.getSSOSessionID();
} catch (BuildException e) {
Logger.warn("MOASession deserialization-exception by using MOASessionID=" + results.get(0).getSessionid(), e);
@@ -434,11 +423,11 @@ public class DBAuthenticationSessionStoreage implements IAuthenticationSessionSt
MiscUtil.assertNotNull(moaSession, "MOASession");
MiscUtil.assertNotNull(oaID, "OnlineApplicationIdentifier");
MiscUtil.assertNotNull(protocolType, "usedProtocol");
- Logger.trace("Get active OnlineApplication for sessionID " + moaSession.getSessionID() + " with OAID "
+ Logger.trace("Get active OnlineApplication for sessionID " + moaSession.getSSOSessionID() + " with OAID "
+ oaID + " from database.");
Query query = entityManager.createNamedQuery("getActiveOAWithSessionIDandOAIDandProtocol");
- query.setParameter("sessionID", moaSession.getSessionID());
+ query.setParameter("sessionID", moaSession.getSSOSessionID());
query.setParameter("oaID", oaID);
query.setParameter("protocol", protocolType);
List<AuthenticatedSessionStore> results = query.getResultList();
@@ -545,25 +534,25 @@ public class DBAuthenticationSessionStoreage implements IAuthenticationSessionSt
}
@Override
- public void addFederatedSessionInformation(IRequest req, String idpEntityID, AssertionAttributeExtractor extractor) throws MOADatabaseException, AssertionAttributeExtractorExeption, BuildException {
+ public void addFederatedSessionInformation(IRequest req, String idpEntityID, AssertionAttributeExtractor extractor) throws MOADatabaseException, AssertionAttributeExtractorExeption, BuildException, EAAFConfigurationException {
AuthenticatedSessionStore dbsession = null;
- AuthenticationSession moaSession = null;
+ String internalSSOSessionId = null;
Date now = new Date();
//search for active session
if (MiscUtil.isNotEmpty(req.getInternalSSOSessionIdentifier())) {
Logger.debug("Internal SSO-Session object: " + req.getInternalSSOSessionIdentifier() + " used for federated SSO");
- moaSession = getInternalMOASessionWithSSOID(req.getInternalSSOSessionIdentifier());
+ internalSSOSessionId = req.getInternalSSOSessionIdentifier();
} else {
Logger.debug("No internal SSO-Session object exists for federated SSO --> create new session object");
- moaSession = createInternalSSOSession(req);
+ internalSSOSessionId = createInternalSSOSession(req).getSSOSessionID();
}
- if (moaSession != null) {
+ if (MiscUtil.isNotEmpty(internalSSOSessionId)) {
try {
- dbsession = searchInDatabase(moaSession.getSessionID());
+ dbsession = searchInDatabase(internalSSOSessionId);
}catch (MOADatabaseException e) {
Logger.error("NO MOASession found but MOASession MUST already exist!");
@@ -617,7 +606,7 @@ public class DBAuthenticationSessionStoreage implements IAuthenticationSessionSt
idp.setIdpurlprefix(idpEntityID);
idp.setAuthURL(req.getAuthURL());
- IOAAuthParameters oa = authConfig.getOnlineApplicationParameter(idp.getIdpurlprefix());
+ IOAAuthParameters oa = authConfig.getServiceProviderConfiguration(idp.getIdpurlprefix(), OAAuthParameterDecorator.class);
idp.setStoreSSOInformation(oa.isInterfederationSSOStorageAllowed());
idp.setMoasession(dbsession);
idpList.add(idp);
@@ -793,7 +782,7 @@ public class DBAuthenticationSessionStoreage implements IAuthenticationSessionSt
Query query = entityManager.createNamedQuery("getSSOSessionWithOldSessionID");
query.setParameter("sessionid", ssoId);
List<OldSSOSessionIDStore> results = query.getResultList();
-
+
Logger.trace("Found entries: " + results.size());
// Assertion requires an unique artifact
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/DBTransactionStorage.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/DBTransactionStorage.java
index 2395b913d..61c83aaf2 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/DBTransactionStorage.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/DBTransactionStorage.java
@@ -37,6 +37,7 @@ import org.hibernate.HibernateException;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
+import at.gv.egiz.eaaf.core.api.storage.ITransactionStorage;
import at.gv.egovernment.moa.id.auth.exception.AuthenticationException;
import at.gv.egovernment.moa.id.auth.exception.BuildException;
import at.gv.egovernment.moa.id.commons.db.dao.session.AssertionStore;
@@ -240,15 +241,22 @@ public class DBTransactionStorage implements ITransactionStorage {
}
}
- public Object getAssertionStore(String key) throws MOADatabaseException{
+ @Override
+ public Object getRaw(String key) throws MOADatabaseException {
return searchInDatabase(key);
}
@Override
- public void putAssertionStore(Object element) throws MOADatabaseException{
- entityManager.merge(element);
+ public void putRaw(String key, Object element) throws MOADatabaseException {
+ if (element instanceof AssertionStore)
+ entityManager.merge(element);
+ else {
+ Logger.error("Can not persist Object of type: " + element.getClass().getName());
+ throw new RuntimeException("Can not persist Object of type: " + element.getClass().getName());
+
+ }
}
private void cleanDelete(AssertionStore element) {
@@ -310,7 +318,7 @@ public class DBTransactionStorage implements ITransactionStorage {
} catch (BuildException e) {
Logger.warn("Sessioninformation could not be stored.");
- throw new MOADatabaseException(e);
+ throw new MOADatabaseException("Can not store data into transaction-storage", e);
}
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/IAuthenticationSessionStoreage.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/IAuthenticationSessionStoreage.java
index c8d09e17e..add697a85 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/IAuthenticationSessionStoreage.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/IAuthenticationSessionStoreage.java
@@ -25,34 +25,27 @@ package at.gv.egovernment.moa.id.storage;
import java.util.Date;
import java.util.List;
+import at.gv.egiz.eaaf.core.api.IRequest;
+import at.gv.egiz.eaaf.core.api.idp.slo.SLOInformationInterface;
+import at.gv.egiz.eaaf.core.exceptions.EAAFConfigurationException;
+import at.gv.egiz.eaaf.modules.pvp2.sp.exception.AssertionAttributeExtractorExeption;
+import at.gv.egiz.eaaf.modules.pvp2.sp.impl.utils.AssertionAttributeExtractor;
import at.gv.egovernment.moa.id.auth.data.AuthenticationSession;
import at.gv.egovernment.moa.id.auth.data.AuthenticationSessionExtensions;
import at.gv.egovernment.moa.id.auth.exception.AuthenticationException;
import at.gv.egovernment.moa.id.auth.exception.BuildException;
-import at.gv.egovernment.moa.id.commons.api.IRequest;
import at.gv.egovernment.moa.id.commons.api.data.IAuthenticationSession;
import at.gv.egovernment.moa.id.commons.db.dao.session.AuthenticatedSessionStore;
import at.gv.egovernment.moa.id.commons.db.dao.session.InterfederationSessionStore;
import at.gv.egovernment.moa.id.commons.db.dao.session.OASessionStore;
import at.gv.egovernment.moa.id.commons.db.dao.session.OldSSOSessionIDStore;
import at.gv.egovernment.moa.id.commons.db.ex.MOADatabaseException;
-import at.gv.egovernment.moa.id.data.SLOInformationInterface;
-import at.gv.egovernment.moa.id.protocols.pvp2x.exceptions.AssertionAttributeExtractorExeption;
-import at.gv.egovernment.moa.id.protocols.pvp2x.utils.AssertionAttributeExtractor;
/**
* @author tlenz
*
*/
public interface IAuthenticationSessionStoreage {
-
- /**
- * Check if the stored MOASession is already authenticated
- *
- * @param internalSsoSessionID Internal MOA SSO-Session identifier
- * @return true if the MOASession is authenticated, otherwise false
- */
- public boolean isAuthenticated(String internalSsoSessionID);
/**
* Create a new MOA SSO-Session object in database
@@ -110,13 +103,13 @@ public interface IAuthenticationSessionStoreage {
public void setAuthenticated(String internalSsoSessionID, boolean isAuthenticated);
/**
- * Find the MOASessionId of an active Single Sign-On session
+ * Find the internal SSO session identifier of an active Single Sign-On session
*
- * @param SSOSessionID Single Sign-On sessionID
- * @return internal MOA SSO-Session of the associated SSO-Session Id
+ * @param externelSSOId external Single Sign-On sessionID
+ * @return internal SSO-Session identifier
* @throws MOADatabaseException
*/
- public AuthenticationSession getInternalMOASessionWithSSOID(String SSOSessionID) throws MOADatabaseException;
+ public String getInternalSSOSessionWithSSOID(String externelSSOId) throws MOADatabaseException;
/**
* Check if a MOASession is an active Single Sign-On session
@@ -151,28 +144,28 @@ public interface IAuthenticationSessionStoreage {
/**
* Get all Single Sign-On authenticated Service-Provider of a MOASession
*
- * @param moaSession MOASession data object
+ * @param ssoSessionId SSO session id
* @return List of Service-Provider information
*/
- public List<OASessionStore> getAllActiveOAFromMOASession(IAuthenticationSession moaSession);
+ public List<OASessionStore> getAllActiveOAFromMOASession(String ssoSessionId);
/**
* Get all active interfederation connections for a MOASession
*
- * @param moaSession MOASession data object
+ * @param ssoSessionId SSO session id
* @return List of Interfederation-IDP information
*/
- public List<InterfederationSessionStore> getAllActiveIDPsFromMOASession(IAuthenticationSession moaSession);
+ public List<InterfederationSessionStore> getAllActiveIDPsFromMOASession(String ssoSessionId);
/**
- * Search a MOASession by using already transfered authentication information
+ * Search a SSO session by using already transfered authentication information
*
* @param oaID Service-Provider identifier, which has received the authentication information
* @param userNameID UserId (bPK), which was send to this Service-Provider
- * @return MOASession, or null if no corresponding MOASession is found
+ * @return SSO-session identifier, or null if no corresponding SSO session is found
*/
- public IAuthenticationSession searchMOASessionWithNameIDandOAID(String oaID, String userNameID);
+ public String searchSSOSessionWithNameIDandOAID(String oaID, String userNameID);
/**
* Search a active Single Sign-On session for a specific Service-Provider
@@ -220,8 +213,9 @@ public interface IAuthenticationSessionStoreage {
* @throws MOADatabaseException
* @throws AssertionAttributeExtractorExeption
* @throws BuildException
+ * @throws EAAFConfigurationException
*/
- public void addFederatedSessionInformation(IRequest req, String idpEntityID, AssertionAttributeExtractor extractor) throws MOADatabaseException, AssertionAttributeExtractorExeption, BuildException;
+ public void addFederatedSessionInformation(IRequest req, String idpEntityID, AssertionAttributeExtractor extractor) throws MOADatabaseException, AssertionAttributeExtractorExeption, BuildException, EAAFConfigurationException;
/**
* Search an active federation IDP which could be used for federated Single Sign-On by using an AttributeQuery
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/ITransactionStorage.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/ITransactionStorage.java
deleted file mode 100644
index 51a36d426..000000000
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/ITransactionStorage.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Copyright 2014 Federal Chancellery Austria
- * MOA-ID has been developed in a cooperation between BRZ, the Federal
- * Chancellery Austria - ICT staff unit, and Graz University of Technology.
- *
- * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
- * the European Commission - subsequent versions of the EUPL (the "Licence");
- * You may not use this work except in compliance with the Licence.
- * You may obtain a copy of the Licence at:
- * http://www.osor.eu/eupl/
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the Licence is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the Licence for the specific language governing permissions and
- * limitations under the Licence.
- *
- * This product combines work with different licenses. See the "NOTICE" text
- * file for details on the various modules and licenses.
- * The "NOTICE" text file is part of the distribution. Any derivative works
- * that you distribute must include a readable copy of the "NOTICE" text file.
- */
-package at.gv.egovernment.moa.id.storage;
-
-import java.util.Date;
-import java.util.List;
-
-import at.gv.egovernment.moa.id.auth.exception.AuthenticationException;
-import at.gv.egovernment.moa.id.commons.db.ex.MOADatabaseException;
-
-/**
- * @author tlenz
- *
- */
-public interface ITransactionStorage {
-
- /**
- * Check if transaction storage contains a data object with a specific key
- *
- * @param key Key, which identifies a data object
- * @return true if key is found, otherwise false
- */
- public boolean containsKey(String key);
-
- /**
- * Store a data object with a key to transaction storage
- *
- * @param key Id which identifiers the data object
- * @param value Data object which should be stored.
- * This data must implement the <code>java.io.Serializable</code> interface
- * @param timeout_ms Defines the period of time a data object is kept within the storage
- * @throws MOADatabaseException In case of store operation failed
- */
- public void put(String key, Object value, int timeout_ms) throws MOADatabaseException;
-
- /**
- * Get a data object from transaction storage
- *
- * @param key key Id which identifiers the data object
- * @return The transaction-data object, or null
- * @throws MOADatabaseException In case of load operation failed
- */
- public Object get(String key) throws MOADatabaseException;
-
- /**
- * Get a data object from transaction storage
- *
- * @param key Id which identifiers the data object
- * @param clazz The class type which is stored with this key
- * @return The transaction-data object from type class, or null
- * @throws MOADatabaseException In case of load operation failed
- */
- public <T> T get(String key, final Class<T> clazz) throws MOADatabaseException;
-
- /**
- * Get a data object from transaction storage
- *
- * @param key Id which identifiers the data object
- * @param clazz The class type which is stored with this key
- * @param Data-object timeout in [ms]
- * @return The transaction-data object from type class, or null
- * @throws MOADatabaseException In case of load operation failed
- * @throws AuthenticationException In case of data-object timeout occurs
- */
- public <T> T get(String key, final Class<T> clazz, long dataTimeOut) throws MOADatabaseException, AuthenticationException;
-
-
- /**
- * Change the key of a data object and store it under the new key
- *
- * @param oldKey Old key of the data object
- * @param newKey New key, which should be used to store the data object
- * @param value Data object which should be stored
- * @throws MOADatabaseException In case of store operation failed
- */
- public void changeKey(String oldKey, String newKey, Object value) throws MOADatabaseException;
-
- /**
- * Remove a data object from transaction storage
- *
- * @param key Id which identifiers the data object
- */
- public void remove(String key);
-
- /**
- * Get all entries for Clean-up the transaction storage
- *
- * @param now Current time
- * @param dataTimeOut Data-object timeout in [ms]
- * @return List of entry-keys which as a timeout
- */
- public List<String> clean(Date now, long dataTimeOut);
-
-
- /**
- * Get whole AssertionStoreObject, required for SLO
- * <br>
- * <b>IMPORTANT:</b> This method does NOT decrypt information before storage
- *
- * @param key key Id which identifiers the data object
- * @return The transaction-data object, or null
- * @throws MOADatabaseException In case of load operation failed
- */
- public Object getAssertionStore(String key) throws MOADatabaseException;
-
- /**
- * Put whole AssertionStoreObject to db, required for SLO
- * <br>
- * <b>IMPORTANT:</b> This method does NOT encrypt information before storage
- *
- * @param element assertion store object
- */
- public void putAssertionStore(Object element) throws MOADatabaseException;
-
-}
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/RedisTransactionStorage.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/RedisTransactionStorage.java
index 2b9a6656b..8d36e81bb 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/RedisTransactionStorage.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/RedisTransactionStorage.java
@@ -39,6 +39,8 @@ import org.springframework.data.redis.core.SessionCallback;
import org.springframework.data.redis.serializer.JacksonJsonRedisSerializer;
import org.springframework.stereotype.Service;
+import at.gv.egiz.eaaf.core.api.storage.ITransactionStorage;
+import at.gv.egiz.eaaf.core.exceptions.EAAFException;
import at.gv.egovernment.moa.id.auth.exception.AuthenticationException;
import at.gv.egovernment.moa.id.commons.api.AuthConfiguration;
import at.gv.egovernment.moa.id.commons.db.dao.session.AssertionStore;
@@ -351,12 +353,13 @@ private AssertionStore prepareAssertion(AssertionStore element, String key, Obje
}
@Override
-public Object getAssertionStore(String key) throws MOADatabaseException {
+public Object getRaw(String key) throws EAAFException {
return searchInDatabase(key);
+
}
@Override
-public void putAssertionStore(Object element) throws MOADatabaseException {
+public void putRaw(String key, Object element) throws EAAFException {
// TODO Auto-generated method stub
AssertionStore as = (AssertionStore)element;
final int expTime = redisTemplate.getExpire(as.getArtifact(), TimeUnit.MILLISECONDS).intValue();