[java-identity-provider COMMIT] in /trunk/idp-saml-impl/src: main/java/net/shibboleth/idp/saml/impl/profile/saml1/Add...

noreply at shibboleth.net noreply at shibboleth.net
Thu Jan 9 21:46:06 EST 2014


Author: scantor
Date: Thu Jan  9 21:46:06 2014
New Revision: 5175

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=5175&view=rev
Log:
Add SubjectLocality

Modified:
    trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/saml1/AddAuthenticationStatementToAssertion.java
    trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/saml2/AddAuthnStatementToAssertion.java
    trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/impl/profile/saml1/AddAuthenticationStatementToAssertionTest.java
    trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/impl/profile/saml2/AddAuthnStatementToAssertionTest.java

Modified: trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/saml1/AddAuthenticationStatementToAssertion.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/saml1/AddAuthenticationStatementToAssertion.java?rev=5175&r1=5174&r2=5175&view=diff
==============================================================================
--- trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/saml1/AddAuthenticationStatementToAssertion.java (original)
+++ trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/saml1/AddAuthenticationStatementToAssertion.java Thu Jan  9 21:46:06 2014
@@ -41,6 +41,7 @@
 import net.shibboleth.utilities.java.support.logic.Constraint;
 
 import org.joda.time.DateTime;
+import org.opensaml.core.xml.XMLObjectBuilderFactory;
 import org.opensaml.core.xml.config.XMLObjectProviderRegistrySupport;
 import org.opensaml.messaging.context.navigate.ChildContextLookup;
 import org.opensaml.messaging.context.navigate.MessageLookup;
@@ -48,6 +49,7 @@
 import org.opensaml.saml.saml1.core.Assertion;
 import org.opensaml.saml.saml1.core.AuthenticationStatement;
 import org.opensaml.saml.saml1.core.Response;
+import org.opensaml.saml.saml1.core.SubjectLocality;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -245,9 +247,11 @@
             @Nonnull final ProfileRequestContext profileRequestContext,
             @Nullable final RequestedPrincipalContext requestedPrincipalContext) {
 
+        final XMLObjectBuilderFactory bf = XMLObjectProviderRegistrySupport.getBuilderFactory();
         final SAMLObjectBuilder<AuthenticationStatement> statementBuilder = (SAMLObjectBuilder<AuthenticationStatement>)
-                XMLObjectProviderRegistrySupport.getBuilderFactory().<AuthenticationStatement>getBuilderOrThrow(
-                        AuthenticationStatement.TYPE_NAME);
+                bf.<AuthenticationStatement>getBuilderOrThrow(AuthenticationStatement.TYPE_NAME);
+        final SAMLObjectBuilder<SubjectLocality> localityBuilder = (SAMLObjectBuilder<SubjectLocality>)
+                bf.<SubjectLocality>getBuilderOrThrow(SubjectLocality.TYPE_NAME);
 
         final AuthenticationStatement statement = statementBuilder.buildObject();
         statement.setAuthenticationInstant(new DateTime(authenticationResult.getAuthenticationInstant()));
@@ -257,6 +261,15 @@
         } else {
             statement.setAuthenticationMethod(methodLookupStrategy.apply(profileRequestContext).getName());
         }
+        
+        if (getHttpServletRequest() != null) {
+            final SubjectLocality locality = localityBuilder.buildObject();
+            locality.setIPAddress(getHttpServletRequest().getRemoteAddr());
+            statement.setSubjectLocality(locality);
+        } else {
+            log.debug("{} HttpServletRequest not available, omitting SubjectLocality element", getLogPrefix());
+        }
+        
         return statement;
     }
     

Modified: trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/saml2/AddAuthnStatementToAssertion.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/saml2/AddAuthnStatementToAssertion.java?rev=5175&r1=5174&r2=5175&view=diff
==============================================================================
--- trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/saml2/AddAuthnStatementToAssertion.java (original)
+++ trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/saml2/AddAuthnStatementToAssertion.java Thu Jan  9 21:46:06 2014
@@ -50,6 +50,7 @@
 import org.opensaml.messaging.context.navigate.ChildContextLookup;
 import org.opensaml.messaging.context.navigate.MessageLookup;
 import org.opensaml.saml.common.SAMLObjectBuilder;
+import org.opensaml.saml.saml2.core.SubjectLocality;
 import org.opensaml.saml.saml2.core.Assertion;
 import org.opensaml.saml.saml2.core.AuthnContext;
 import org.opensaml.saml.saml2.core.AuthnStatement;
@@ -259,6 +260,8 @@
                 bf.<AuthnStatement>getBuilderOrThrow(AuthnStatement.TYPE_NAME);
         final SAMLObjectBuilder<AuthnContext> authnContextBuilder = (SAMLObjectBuilder<AuthnContext>)
                 bf.<AuthnContext>getBuilderOrThrow(AuthnContext.TYPE_NAME);

[... 103 lines stripped ...]


More information about the commits mailing list