aboutsummaryrefslogtreecommitdiff
path: root/id/server/idserverlib/src
diff options
context:
space:
mode:
Diffstat (limited to 'id/server/idserverlib/src')
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/moduls/RequestImpl.java17
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/builder/assertion/PVP2AssertionBuilder.java7
2 files changed, 22 insertions, 2 deletions
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/moduls/RequestImpl.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/moduls/RequestImpl.java
index 91ba49fe8..1e0dfca8a 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/moduls/RequestImpl.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/moduls/RequestImpl.java
@@ -54,8 +54,12 @@ public abstract class RequestImpl implements IRequest, Serializable{
public static final String DATAID_REQUESTED_ATTRIBUTES = "requestedAttributes";
public static final String DATAID_INTERFEDERATIOIDP_ENTITYID = "interIDPEntityID";
+ public static final String DATAID_REQUESTER_IP_ADDRESS = "requesterIP";
+
public static final String eIDAS_GENERIC_REQ_DATA_COUNTRY = "country";
+
+
private static final long serialVersionUID = 1L;
private String module = null;
@@ -93,10 +97,10 @@ public abstract class RequestImpl implements IRequest, Serializable{
*/
public final void initialize(HttpServletRequest req) throws ConfigurationException {
//set requestID
- requestID = Random.nextRandom();
+ requestID = Random.nextLongRandom();
//set unique transaction identifier for logging
- uniqueTransactionIdentifer = Random.nextRandom();
+ uniqueTransactionIdentifer = Random.nextLongRandom();
TransactionIDUtils.setTransactionId(uniqueTransactionIdentifer);
@@ -169,6 +173,15 @@ public abstract class RequestImpl implements IRequest, Serializable{
else
Logger.warn("No unique session-identifier FOUND, but it should be allready set into request!?!");
+ //set requester's IP address
+ try {
+ setGenericDataToSession(DATAID_REQUESTER_IP_ADDRESS, req.getRemoteAddr());
+
+ } catch (SessionDataStorageException e) {
+ Logger.warn("Can not store remote IP address to 'pendingRequest' during an exception." , e);
+
+ }
+
}
/**
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/builder/assertion/PVP2AssertionBuilder.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/builder/assertion/PVP2AssertionBuilder.java
index 200429093..55d8fa1ff 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/builder/assertion/PVP2AssertionBuilder.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/builder/assertion/PVP2AssertionBuilder.java
@@ -459,8 +459,15 @@ public class PVP2AssertionBuilder implements PVPConstants {
subjectConfirmationData.setNotOnOrAfter(new DateTime(authData.getSsoSessionValidTo().getTime()));
// subjectConfirmationData.setNotBefore(date);
+ //set 'recipient' attribute in subjectConformationData
subjectConfirmationData.setRecipient(assertionConsumerService.getLocation());
+ //set IP address of the user machine as 'Address' attribute in subjectConformationData
+ String usersIPAddress = pendingReq.getGenericData(
+ PVPTargetConfiguration.DATAID_REQUESTER_IP_ADDRESS, String.class);
+ if (MiscUtil.isNotEmpty(usersIPAddress))
+ subjectConfirmationData.setAddress(usersIPAddress);
+
//set SLO information
sloInformation.setUserNameIdentifier(subjectNameID.getValue());
sloInformation.setNameIDFormat(subjectNameID.getFormat());