[java-identity-provider COMMIT] in /trunk/idp-authn-api/src/main/java/net/shibboleth/idp/session: AuthenticationEvent...

noreply at shibboleth.net noreply at shibboleth.net
Sat Aug 13 16:04:05 BST 2011


Author: lajoie
Date: Sat Aug 13 16:04:04 2011
New Revision: 4014

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=4014&view=rev
Log:
Implement AuthnticationEvent equals/hashcode
Rename session creation strategy to session factory

Added:
    trunk/idp-authn-api/src/main/java/net/shibboleth/idp/session/BasicSessionFactory.java   (contents, props changed)
      - copied, changed from r4012, trunk/idp-authn-api/src/main/java/net/shibboleth/idp/session/BasicSessionCreationStrategy.java
    trunk/idp-authn-api/src/main/java/net/shibboleth/idp/session/SessionFactory.java   (contents, props changed)
      - copied, changed from r4012, trunk/idp-authn-api/src/main/java/net/shibboleth/idp/session/SessionCreationStrategy.java
Removed:
    trunk/idp-authn-api/src/main/java/net/shibboleth/idp/session/BasicSessionCreationStrategy.java
    trunk/idp-authn-api/src/main/java/net/shibboleth/idp/session/SessionCreationStrategy.java
Modified:
    trunk/idp-authn-api/src/main/java/net/shibboleth/idp/session/AuthenticationEvent.java

Modified: trunk/idp-authn-api/src/main/java/net/shibboleth/idp/session/AuthenticationEvent.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-authn-api/src/main/java/net/shibboleth/idp/session/AuthenticationEvent.java?rev=4014&r1=4013&r2=4014&view=diff
==============================================================================
--- trunk/idp-authn-api/src/main/java/net/shibboleth/idp/session/AuthenticationEvent.java (original)
+++ trunk/idp-authn-api/src/main/java/net/shibboleth/idp/session/AuthenticationEvent.java Sat Aug 13 16:04:04 2011
@@ -21,9 +21,8 @@
 
 import org.opensaml.messaging.context.AbstractSubcontextContainer;
 import org.opensaml.util.Assert;
+import org.opensaml.util.ObjectSupport;
 import org.opensaml.util.StringSupport;
-
-//TODO implement hashCode/equals - need to implement this for AbstractSubcontextContainer as well
 
 /**
  * Describes an authentication event that took place within the scope of an {@link IdPSession}.
@@ -35,7 +34,7 @@
 
     /** Service for which the principal was authenticated. */
     private String serviceId;
-    
+
     /** The principal established by the authentication event. */
     private Principal principal;
 
@@ -59,7 +58,7 @@
     public String getServiceId() {
         return serviceId;
     }
-    
+
     /**
      * Sets the identifier of the service for which the principal was authenticated.
      * 
@@ -69,7 +68,7 @@
         serviceId = StringSupport.trimOrNull(id);
         Assert.isNotNull(serviceId, "Service ID can not be null or empty");
     }
-    
+
     /**
      * Gets the principal established by the authentication event.
      * 
@@ -146,4 +145,32 @@
     protected void setExpirationInstant(long instant) {
         expirationInstant = instant;
     }
+
+    /** {@inheritDoc} */
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + authnMethod.hashCode();
+        result = prime * result + serviceId.hashCode();
+        return result;
+    }
+
+    /** {@inheritDoc} */
+    public boolean equals(Object obj) {
+        if (obj == null) {
+            return false;
+        }
+
+        if (this == obj) {
+            return true;
+        }
+
+        if (obj instanceof AuthenticationEvent) {
+            AuthenticationEvent other = (AuthenticationEvent) obj;
+            return ObjectSupport.equals(getServiceId(), other.getServiceId())
+                    && ObjectSupport.equals(getAuthenticationMethod(), other.getAuthenticationMethod());
+        }
+
+        return false;
+    }
 }

Copied: trunk/idp-authn-api/src/main/java/net/shibboleth/idp/session/BasicSessionFactory.java (from r4012, trunk/idp-authn-api/src/main/java/net/shibboleth/idp/session/BasicSessionCreationStrategy.java)
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-authn-api/src/main/java/net/shibboleth/idp/session/BasicSessionFactory.java?p2=trunk/idp-authn-api/src/main/java/net/shibboleth/idp/session/BasicSessionFactory.java&p1=trunk/idp-authn-api/src/main/java/net/shibboleth/idp/session/BasicSessionCreationStrategy.java&r1=4012&r2=4014&rev=4014&view=diff
==============================================================================
--- trunk/idp-authn-api/src/main/java/net/shibboleth/idp/session/BasicSessionCreationStrategy.java (original)
+++ trunk/idp-authn-api/src/main/java/net/shibboleth/idp/session/BasicSessionFactory.java Sat Aug 13 16:04:04 2011
@@ -24,10 +24,10 @@
 import edu.vt.middleware.crypt.util.HexConverter;
 
 /**
- * A basic {@link SessionCreationStrategy} that generates a the session ID and session secret using a
+ * A basic {@link SessionFactory} that generates a the session ID and session secret using a
  * {@link SecureRandom} PRNG.
  */
-public class BasicSessionCreationStrategy implements SessionCreationStrategy {
+public class BasicSessionFactory implements SessionFactory {
 
     /** Number of random bits within a session ID. Default value: {@value} */
     private final int sessionIDSize = 32;
@@ -39,7 +39,7 @@

[... 24 lines stripped ...]


More information about the commits mailing list