[java-identity-provider] branch main updated: IDP-2083 - Treat NonnullElements as the default for collections

Scott Cantor cantor.2 at osu.edu
Tue Jun 20 20:55:40 UTC 2023


This is an automated email from the git hooks/post-receive script.

scantor pushed a commit to branch main
in repository java-identity-provider.

View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=fdd5d11c64184b3d28e75cc784be0c0cf3c11257

The following commit(s) were added to refs/heads/main by this push:
     new fdd5d11c6 IDP-2083 - Treat NonnullElements as the default for collections
fdd5d11c6 is described below

commit fdd5d11c64184b3d28e75cc784be0c0cf3c11257
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Jun 20 16:55:36 2023 -0400

    IDP-2083 - Treat NonnullElements as the default for collections
    
    https://shibboleth.atlassian.net/browse/IDP-2083
    
    Review idp-session-api/impl.
---
 .../shibboleth/idp/session/AbstractIdPSession.java | 18 +++++--------
 .../net/shibboleth/idp/session/IdPSession.java     | 31 +++++++++++-----------
 .../idp/session/SPSessionSerializerRegistry.java   | 10 +++----
 .../idp/session/context/LogoutContext.java         | 15 +++++------
 .../idp/session/context/SessionContext.java        |  2 +-
 .../navigate/CanonicalUsernameLookupStrategy.java  |  4 ++-
 .../idp/session/context/navigate/package-info.java |  4 ++-
 .../idp/session/context/package-info.java          |  5 +++-
 .../idp/session/criterion/package-info.java        |  5 +++-
 .../idp/session/logic/IPRangeBiPredicate.java      |  5 ++--
 .../LogoutPropagationFlowDescriptorSelector.java   |  5 ++--
 .../shibboleth/idp/session/logic/package-info.java |  4 ++-
 .../net/shibboleth/idp/session/package-info.java   |  4 ++-
 .../LogoutPropagationFlowDescriptorManager.java    |  3 +--
 .../session/impl/LogoutStatusStrategyFunction.java |  4 ++-
 .../idp/session/impl/StorageBackedIdPSession.java  |  9 +++----
 .../impl/StorageBackedIdPSessionSerializer.java    |  4 +--
 .../session/impl/StorageBackedSessionManager.java  | 26 ++++++++++--------
 .../shibboleth/idp/session/impl/package-info.java  |  5 +++-
 19 files changed, 85 insertions(+), 78 deletions(-)

diff --git a/idp-session-api/src/main/java/net/shibboleth/idp/session/AbstractIdPSession.java b/idp-session-api/src/main/java/net/shibboleth/idp/session/AbstractIdPSession.java
index 02df8fdaf..b21961259 100644
--- a/idp-session-api/src/main/java/net/shibboleth/idp/session/AbstractIdPSession.java
+++ b/idp-session-api/src/main/java/net/shibboleth/idp/session/AbstractIdPSession.java
@@ -32,7 +32,6 @@ import javax.annotation.concurrent.ThreadSafe;
 
 import net.shibboleth.idp.authn.AuthenticationResult;
 import net.shibboleth.shared.annotation.constraint.Live;
-import net.shibboleth.shared.annotation.constraint.NonnullElements;
 import net.shibboleth.shared.annotation.constraint.NotEmpty;
 import net.shibboleth.shared.annotation.constraint.NotLive;
 import net.shibboleth.shared.annotation.constraint.Unmodifiable;
@@ -165,7 +164,6 @@ public abstract class AbstractIdPSession implements IdPSession {
     }
 
     /** {@inheritDoc} */
-    @Override
     public boolean checkAddress(@Nonnull @NotEmpty final String address) throws SessionException {
         final AddressFamily family = getAddressFamily(address);
         final String bound = getAddress(family);
@@ -254,12 +252,12 @@ public abstract class AbstractIdPSession implements IdPSession {
     }
 
     /** {@inheritDoc} */
-    @Nonnull @NonnullElements @NotLive @Unmodifiable public Set<AuthenticationResult> getAuthenticationResults() {
+    @Nonnull @NotLive @Unmodifiable public Set<AuthenticationResult> getAuthenticationResults() {
         return authenticationResults.values()
                     .stream()
                     .filter(Optional::isPresent)
                     .map(Optional::orElseThrow)
-                    .collect(Collectors.toUnmodifiableSet());
+                    .collect(CollectionSupport.nonnullCollector(Collectors.toUnmodifiableSet())).get();
     }
 
     /** {@inheritDoc} */
@@ -326,31 +324,27 @@ public abstract class AbstractIdPSession implements IdPSession {
     }
 
     /** {@inheritDoc} */
-    @Override
-    @Nonnull @NonnullElements @NotLive @Unmodifiable public Set<SPSession> getSPSessions() {
+    @Nonnull @NotLive @Unmodifiable public Set<SPSession> getSPSessions() {
         return spSessions.values()
                     .stream()
                     .filter(Optional::isPresent)
                     .map(Optional::orElseThrow)
-                    .collect(Collectors.toUnmodifiableSet());
+                    .collect(CollectionSupport.nonnullCollector(Collectors.toUnmodifiableSet())).get();
     }
 
     /** {@inheritDoc} */
-    @Override
     @Nullable public SPSession getSPSession(@Nonnull @NotEmpty final String serviceId) {
         final Optional<SPSession> mapped = spSessions.get(StringSupport.trimOrNull(serviceId));
         return (mapped != null) ? mapped.orElse(null) : null;
     }
 
     /** {@inheritDoc} */
-    @Override
     @Nullable public SPSession addSPSession(@Nonnull final SPSession spSession)
             throws SessionException {
         return doAddSPSession(spSession);
     }
 
     /** {@inheritDoc} */
-    @Override
     public boolean removeSPSession(@Nonnull final SPSession spSession) throws SessionException {
         return doRemoveSPSession(spSession);
     }
@@ -434,7 +428,7 @@ public abstract class AbstractIdPSession implements IdPSession {
      * 
      * @return direct access to the result map
      */
-    @Nonnull @NonnullElements @Live protected Map<String, Optional<AuthenticationResult>> getAuthenticationResultMap() {
+    @Nonnull @Live protected Map<String, Optional<AuthenticationResult>> getAuthenticationResultMap() {
         return authenticationResults;
     }
 
@@ -443,7 +437,7 @@ public abstract class AbstractIdPSession implements IdPSession {
      * 
      * @return direct access to the service session map
      */
-    @Nonnull @NonnullElements @Live protected Map<String, Optional<SPSession>> getSPSessionMap() {
+    @Nonnull @Live protected Map<String, Optional<SPSession>> getSPSessionMap() {
         return spSessions;
     }
     
diff --git a/idp-session-api/src/main/java/net/shibboleth/idp/session/IdPSession.java b/idp-session-api/src/main/java/net/shibboleth/idp/session/IdPSession.java
index bde628411..a04d5ac42 100644
--- a/idp-session-api/src/main/java/net/shibboleth/idp/session/IdPSession.java
+++ b/idp-session-api/src/main/java/net/shibboleth/idp/session/IdPSession.java
@@ -25,7 +25,6 @@ import javax.annotation.Nullable;
 import javax.annotation.concurrent.ThreadSafe;
 
 import net.shibboleth.idp.authn.AuthenticationResult;
-import net.shibboleth.shared.annotation.constraint.NonnullElements;
 import net.shibboleth.shared.annotation.constraint.NotEmpty;
 import net.shibboleth.shared.annotation.constraint.NotLive;
 import net.shibboleth.shared.annotation.constraint.Unmodifiable;
@@ -39,28 +38,28 @@ import net.shibboleth.shared.component.IdentifiedComponent;
 public interface IdPSession extends IdentifiedComponent {
 
     /** Name of {@link org.slf4j.MDC} attribute that holds the current session ID: <code>idp.session.id</code>. */
-    public static final String MDC_ATTRIBUTE = "idp.session.id";
+    @Nonnull @NotEmpty static final String MDC_ATTRIBUTE = "idp.session.id";
 
     /**
      * Get the canonical principal name for the session.
      * 
      * @return the principal name
      */
-    @Nonnull @NotEmpty public String getPrincipalName();
+    @Nonnull @NotEmpty String getPrincipalName();
 
     /**
      * Get the time when this session was created.
      * 
      * @return time this session was created
      */
-    @Nonnull public Instant getCreationInstant();
+    @Nonnull Instant getCreationInstant();
     
     /**
      * Get the last activity instant for the session.
      * 
      * @return last activity instant for the session
      */
-    @Nonnull public Instant getLastActivityInstant();
+    @Nonnull Instant getLastActivityInstant();
     
     /**
      * Test the session's validity based on the supplied client address, possibly binding it
@@ -71,7 +70,7 @@ public interface IdPSession extends IdentifiedComponent {
      * @return true iff the session is valid for the specified client address
      * @throws SessionException if an error occurs binding the address to the session
      */
-    public boolean checkAddress(@Nonnull @NotEmpty final String address) throws SessionException;
+    boolean checkAddress(@Nonnull @NotEmpty final String address) throws SessionException;
     
     /**
      * Test the session's validity based on inactivity, while updating the last activity time.
@@ -79,14 +78,14 @@ public interface IdPSession extends IdentifiedComponent {
      * @return true iff the session is still valid
      * @throws SessionException if an error occurs updating the activity time
      */
-    public boolean checkTimeout() throws SessionException;
+    boolean checkTimeout() throws SessionException;
     
     /**
      * Get the unmodifiable set of {@link AuthenticationResult}s associated with this session.
      * 
      * @return unmodifiable set of results
      */
-    @Nonnull @NonnullElements @NotLive @Unmodifiable public Set<AuthenticationResult> getAuthenticationResults();
+    @Nonnull @NotLive @Unmodifiable Set<AuthenticationResult> getAuthenticationResults();
 
     /**
      * Get an associated {@link AuthenticationResult} given its flow ID.
@@ -95,7 +94,7 @@ public interface IdPSession extends IdentifiedComponent {
      * 
      * @return the authentication result, or null
      */
-    @Nullable public AuthenticationResult getAuthenticationResult(@Nonnull @NotEmpty final String flowId);
+    @Nullable AuthenticationResult getAuthenticationResult(@Nonnull @NotEmpty final String flowId);
 
     /**
      * Add a new {@link AuthenticationResult} to this IdP session, replacing any
@@ -106,7 +105,7 @@ public interface IdPSession extends IdentifiedComponent {
      * @return a previously existing result replaced by the new one, if any
      * @throws SessionException if an error occurs updating the session
      */
-    @Nullable public AuthenticationResult addAuthenticationResult(@Nonnull final AuthenticationResult result)
+    @Nullable AuthenticationResult addAuthenticationResult(@Nonnull final AuthenticationResult result)
             throws SessionException;
 
     /**
@@ -117,7 +116,7 @@ public interface IdPSession extends IdentifiedComponent {
      * 
      * @throws SessionException if an error occurs updating the session
      */
-    public void updateAuthenticationResultActivity(@Nonnull final AuthenticationResult result)
+    void updateAuthenticationResultActivity(@Nonnull final AuthenticationResult result)
             throws SessionException;
     
     /**
@@ -128,14 +127,14 @@ public interface IdPSession extends IdentifiedComponent {
      * @return true iff the given result had been associated with this IdP session and now is not
      * @throws SessionException if an error occurs accessing the session
      */
-    public boolean removeAuthenticationResult(@Nonnull final AuthenticationResult result) throws SessionException;
+    boolean removeAuthenticationResult(@Nonnull final AuthenticationResult result) throws SessionException;
     
     /**
      * Gets the unmodifiable collection of service sessions associated with this session.
      * 
      * @return unmodifiable collection of service sessions associated with this session
      */
-    @Nonnull @NonnullElements @NotLive @Unmodifiable public Set<SPSession> getSPSessions();
+    @Nonnull @NotLive @Unmodifiable Set<SPSession> getSPSessions();
 
     /**
      * Get the SPSession for a given service.
@@ -144,7 +143,7 @@ public interface IdPSession extends IdentifiedComponent {
      * 
      * @return the session service or null if no session exists for that service, may be null
      */
-    @Nullable public SPSession getSPSession(@Nonnull @NotEmpty final String serviceId);
+    @Nullable SPSession getSPSession(@Nonnull @NotEmpty final String serviceId);
     
     /**
      * Add a new SP session to this IdP session, replacing any existing session for the same
@@ -155,7 +154,7 @@ public interface IdPSession extends IdentifiedComponent {
      * @return a previously existing SPSession replaced by the new one, if any
      * @throws SessionException if an error occurs accessing the session
      */
-    @Nullable public SPSession addSPSession(@Nonnull final SPSession spSession)
+    @Nullable SPSession addSPSession(@Nonnull final SPSession spSession)
             throws SessionException;
     
     /**
@@ -166,6 +165,6 @@ public interface IdPSession extends IdentifiedComponent {
      * @return true iff the given SP session had been associated with this IdP session and now is not
      * @throws SessionException if an error occurs accessing the SP session
      */
-    public boolean removeSPSession(@Nonnull final SPSession spSession) throws SessionException;
+    boolean removeSPSession(@Nonnull final SPSession spSession) throws SessionException;
     
 }
\ No newline at end of file
diff --git a/idp-session-api/src/main/java/net/shibboleth/idp/session/SPSessionSerializerRegistry.java b/idp-session-api/src/main/java/net/shibboleth/idp/session/SPSessionSerializerRegistry.java
index 2f5925e31..750ffdf94 100644
--- a/idp-session-api/src/main/java/net/shibboleth/idp/session/SPSessionSerializerRegistry.java
+++ b/idp-session-api/src/main/java/net/shibboleth/idp/session/SPSessionSerializerRegistry.java
@@ -30,7 +30,6 @@ import org.slf4j.Logger;
 import org.springframework.beans.factory.annotation.Autowired;
 
 import net.shibboleth.shared.annotation.ParameterName;
-import net.shibboleth.shared.annotation.constraint.NonnullElements;
 import net.shibboleth.shared.component.AbstractInitializableComponent;
 import net.shibboleth.shared.logic.Constraint;
 import net.shibboleth.shared.primitive.LoggerFactory;
@@ -45,8 +44,7 @@ public final class SPSessionSerializerRegistry extends AbstractInitializableComp
     @Nonnull private final Logger log = LoggerFactory.getLogger(SPSessionSerializerRegistry.class);
     
     /** Storage for the registry mappings. */
-    @Nonnull @NonnullElements
-    private Map<Class<? extends SPSession>,StorageSerializer<? extends SPSession>> registry;
+    @Nonnull private Map<Class<? extends SPSession>,StorageSerializer<? extends SPSession>> registry;
 
     /** Constructor. */
     public SPSessionSerializerRegistry() {
@@ -61,7 +59,7 @@ public final class SPSessionSerializerRegistry extends AbstractInitializableComp
      * @since 4.1.0
      */
     @Autowired
-    public SPSessionSerializerRegistry(@Nullable @NonnullElements final Collection<Entry<?>> serializers) {
+    public SPSessionSerializerRegistry(@Nullable final Collection<Entry<?>> serializers) {
         registry = new HashMap<>();
         if (serializers != null) {
             serializers.forEach(e -> registry.put(e.getType(), e.getSerializer()));
@@ -73,8 +71,7 @@ public final class SPSessionSerializerRegistry extends AbstractInitializableComp
      * 
      * @param map  map to populate registry with
      */
-    public void setMappings(@Nonnull @NonnullElements final
-            Map<Class<? extends SPSession>,StorageSerializer<? extends SPSession>> map) {
+    public void setMappings(@Nonnull final Map<Class<? extends SPSession>,StorageSerializer<? extends SPSession>> map) {
         checkSetterPreconditions();
         Constraint.isNotNull(map, "Map cannot be null");
         
@@ -97,6 +94,7 @@ public final class SPSessionSerializerRegistry extends AbstractInitializableComp
         checkComponentActive();
         Constraint.isNotNull(type, "SPSession type cannot be null");
         
+        @SuppressWarnings("unchecked")
         final StorageSerializer<T> serializer = (StorageSerializer<T>) registry.get(type);
         if (serializer != null) {
             log.debug("Registry located StorageSerializer of type '{}' for SPSession type '{}'",
diff --git a/idp-session-api/src/main/java/net/shibboleth/idp/session/context/LogoutContext.java b/idp-session-api/src/main/java/net/shibboleth/idp/session/context/LogoutContext.java
index ad40c2786..fab4553eb 100644
--- a/idp-session-api/src/main/java/net/shibboleth/idp/session/context/LogoutContext.java
+++ b/idp-session-api/src/main/java/net/shibboleth/idp/session/context/LogoutContext.java
@@ -27,7 +27,6 @@ import javax.annotation.Nonnull;
 import net.shibboleth.idp.session.IdPSession;
 import net.shibboleth.idp.session.SPSession;
 import net.shibboleth.shared.annotation.constraint.Live;
-import net.shibboleth.shared.annotation.constraint.NonnullElements;
 import net.shibboleth.shared.annotation.constraint.NotEmpty;
 
 import org.opensaml.messaging.context.BaseContext;
@@ -43,13 +42,13 @@ import com.google.common.collect.Multimap;
 public final class LogoutContext extends BaseContext {
 
     /** Primary sessions to destroy. */
-    @Nonnull @NonnullElements private final Collection<IdPSession> idpSessions;
+    @Nonnull private final Collection<IdPSession> idpSessions;
 
     /** SP sessions needing logout. */
-    @Nonnull @NonnullElements private final Multimap<String,SPSession> sessionMap;
+    @Nonnull private final Multimap<String,SPSession> sessionMap;
 
     /** An index of the session objects by an externally assigned key. */
-    @Nonnull @NonnullElements private final Map<String,SPSession> keyedSessionMap;
+    @Nonnull private final Map<String,SPSession> keyedSessionMap;
         
     /** Constructor. */
     public LogoutContext() {
@@ -65,7 +64,7 @@ public final class LogoutContext extends BaseContext {
      * 
      * @since 4.0.0
      */
-    @Nonnull @NonnullElements @Live public Collection<IdPSession> getIdPSessions() {
+    @Nonnull @Live public Collection<IdPSession> getIdPSessions() {
         return idpSessions;
     }
 
@@ -74,7 +73,7 @@ public final class LogoutContext extends BaseContext {
      * 
      * @return service ID/session mappings
      */
-    @Nonnull @NonnullElements @Live public Multimap<String,SPSession> getSessionMap() {
+    @Nonnull @Live public Multimap<String,SPSession> getSessionMap() {
         return sessionMap;
     }
 
@@ -85,7 +84,7 @@ public final class LogoutContext extends BaseContext {
      * 
      * @return keyed session mappings
      */
-    @Nonnull @NonnullElements @Live public Map<String,SPSession> getKeyedSessionMap() {
+    @Nonnull @Live public Map<String,SPSession> getKeyedSessionMap() {
         return keyedSessionMap;
     }
 
@@ -96,7 +95,7 @@ public final class LogoutContext extends BaseContext {
      * 
      * @return the sessions for the service
      */
-    @Nonnull @NonnullElements @Live public Collection<SPSession> getSessions(@Nonnull @NotEmpty final String id) {
+    @Nonnull @Live public Collection<SPSession> getSessions(@Nonnull @NotEmpty final String id) {
         return sessionMap.get(id);
     }
     
diff --git a/idp-session-api/src/main/java/net/shibboleth/idp/session/context/SessionContext.java b/idp-session-api/src/main/java/net/shibboleth/idp/session/context/SessionContext.java
index 6081b1fb0..c677cf980 100644
--- a/idp-session-api/src/main/java/net/shibboleth/idp/session/context/SessionContext.java
+++ b/idp-session-api/src/main/java/net/shibboleth/idp/session/context/SessionContext.java
@@ -28,7 +28,7 @@ import org.opensaml.messaging.context.BaseContext;
 public final class SessionContext extends BaseContext {
 
     /** IdP session wrapped by this adapter. */
-    private IdPSession session;
+    @Nullable private IdPSession session;
 
     /** Constructor. */
     public SessionContext() {
diff --git a/idp-session-api/src/main/java/net/shibboleth/idp/session/context/navigate/CanonicalUsernameLookupStrategy.java b/idp-session-api/src/main/java/net/shibboleth/idp/session/context/navigate/CanonicalUsernameLookupStrategy.java
index 9e12928a0..6e4653433 100644
--- a/idp-session-api/src/main/java/net/shibboleth/idp/session/context/navigate/CanonicalUsernameLookupStrategy.java
+++ b/idp-session-api/src/main/java/net/shibboleth/idp/session/context/navigate/CanonicalUsernameLookupStrategy.java
@@ -19,6 +19,8 @@ package net.shibboleth.idp.session.context.navigate;
 
 import java.util.function.Function;
 
+import javax.annotation.Nullable;
+
 import org.opensaml.profile.context.ProfileRequestContext;
 
 import net.shibboleth.idp.authn.context.SubjectCanonicalizationContext;
@@ -32,7 +34,7 @@ import net.shibboleth.idp.session.context.SessionContext;
 public class CanonicalUsernameLookupStrategy implements Function<ProfileRequestContext, String> {
 
     /** {@inheritDoc} */
-    public String apply(final ProfileRequestContext input) {
+    @Nullable public String apply(@Nullable final ProfileRequestContext input) {
         
         if (input != null) {
             final SubjectCanonicalizationContext c14nContext =
diff --git a/idp-session-api/src/main/java/net/shibboleth/idp/session/context/navigate/package-info.java b/idp-session-api/src/main/java/net/shibboleth/idp/session/context/navigate/package-info.java
index 0ada25217..752a51032 100644
--- a/idp-session-api/src/main/java/net/shibboleth/idp/session/context/navigate/package-info.java
+++ b/idp-session-api/src/main/java/net/shibboleth/idp/session/context/navigate/package-info.java
@@ -18,5 +18,7 @@
 /**
  * Functions for traversing session-related contexts.
  */
+ at NonnullElements
+package net.shibboleth.idp.session.context.navigate;
 
-package net.shibboleth.idp.session.context.navigate;
\ No newline at end of file
+import net.shibboleth.shared.annotation.constraint.NonnullElements;
diff --git a/idp-session-api/src/main/java/net/shibboleth/idp/session/context/package-info.java b/idp-session-api/src/main/java/net/shibboleth/idp/session/context/package-info.java
index 45b82daa2..1ea7918ac 100644
--- a/idp-session-api/src/main/java/net/shibboleth/idp/session/context/package-info.java
+++ b/idp-session-api/src/main/java/net/shibboleth/idp/session/context/package-info.java
@@ -18,4 +18,7 @@
 /**
  * Context classes for managing session-related state.
  */
-package net.shibboleth.idp.session.context;
\ No newline at end of file
+ at NonnullElements
+package net.shibboleth.idp.session.context;
+
+import net.shibboleth.shared.annotation.constraint.NonnullElements;
diff --git a/idp-session-api/src/main/java/net/shibboleth/idp/session/criterion/package-info.java b/idp-session-api/src/main/java/net/shibboleth/idp/session/criterion/package-info.java
index 1ad4eb90a..7c6dc470b 100644
--- a/idp-session-api/src/main/java/net/shibboleth/idp/session/criterion/package-info.java
+++ b/idp-session-api/src/main/java/net/shibboleth/idp/session/criterion/package-info.java
@@ -18,4 +18,7 @@
 /**
  * Criterion classes for session lookup.
  */
-package net.shibboleth.idp.session.criterion;
\ No newline at end of file
+ at NonnullElements
+package net.shibboleth.idp.session.criterion;
+
+import net.shibboleth.shared.annotation.constraint.NonnullElements;
diff --git a/idp-session-api/src/main/java/net/shibboleth/idp/session/logic/IPRangeBiPredicate.java b/idp-session-api/src/main/java/net/shibboleth/idp/session/logic/IPRangeBiPredicate.java
index 12560b9cc..e0851e16a 100644
--- a/idp-session-api/src/main/java/net/shibboleth/idp/session/logic/IPRangeBiPredicate.java
+++ b/idp-session-api/src/main/java/net/shibboleth/idp/session/logic/IPRangeBiPredicate.java
@@ -25,7 +25,6 @@ import javax.annotation.Nullable;
 
 import com.google.common.net.InetAddresses;
 
-import net.shibboleth.shared.annotation.constraint.NonnullElements;
 import net.shibboleth.shared.collection.CollectionSupport;
 import net.shibboleth.shared.logic.Constraint;
 import net.shibboleth.shared.net.IPRange;
@@ -34,7 +33,7 @@ import net.shibboleth.shared.net.IPRange;
 public class IPRangeBiPredicate implements BiPredicate<String,String> {
     
     /** IP ranges to match against. */
-    @Nonnull @NonnullElements private Collection<IPRange> addressRanges;
+    @Nonnull private Collection<IPRange> addressRanges;
 
     /** Constructor. */
     IPRangeBiPredicate() {
@@ -46,7 +45,7 @@ public class IPRangeBiPredicate implements BiPredicate<String,String> {
      * 
      * @param ranges    address ranges to check against
      */
-    public void setRanges(@Nonnull @NonnullElements final Collection<IPRange> ranges) {
+    public void setRanges(@Nonnull final Collection<IPRange> ranges) {
         Constraint.isNotNull(ranges, "Address range collection cannot be null");
         
         addressRanges = CollectionSupport.copyToList(ranges);
diff --git a/idp-session-api/src/main/java/net/shibboleth/idp/session/logic/LogoutPropagationFlowDescriptorSelector.java b/idp-session-api/src/main/java/net/shibboleth/idp/session/logic/LogoutPropagationFlowDescriptorSelector.java
index 88f7c9f74..88467c4ef 100644
--- a/idp-session-api/src/main/java/net/shibboleth/idp/session/logic/LogoutPropagationFlowDescriptorSelector.java
+++ b/idp-session-api/src/main/java/net/shibboleth/idp/session/logic/LogoutPropagationFlowDescriptorSelector.java
@@ -26,7 +26,6 @@ import javax.annotation.Nullable;
 import net.shibboleth.idp.session.LogoutPropagationFlowDescriptor;
 import net.shibboleth.idp.session.SPSession;
 import net.shibboleth.shared.annotation.ParameterName;
-import net.shibboleth.shared.annotation.constraint.NonnullElements;
 import net.shibboleth.shared.collection.CollectionSupport;
 import net.shibboleth.shared.logic.Constraint;
 
@@ -36,7 +35,7 @@ import net.shibboleth.shared.logic.Constraint;
 public class LogoutPropagationFlowDescriptorSelector implements Function<SPSession,LogoutPropagationFlowDescriptor> {
 
     /** List of available flows. */
-    @Nonnull @NonnullElements private final List<LogoutPropagationFlowDescriptor> availableFlows;
+    @Nonnull private final List<LogoutPropagationFlowDescriptor> availableFlows;
 
     /**
      * Constructor.
@@ -44,7 +43,7 @@ public class LogoutPropagationFlowDescriptorSelector implements Function<SPSessi
      * @param flows the logout propagation flows to select from
      */
     public LogoutPropagationFlowDescriptorSelector(
-            @Nonnull @NonnullElements @ParameterName(name="flows") final List<LogoutPropagationFlowDescriptor> flows) {
+            @Nonnull @ParameterName(name="flows") final List<LogoutPropagationFlowDescriptor> flows) {
         availableFlows = CollectionSupport.copyToList(Constraint.isNotNull(flows, "Flows cannot be null"));
     }
 
diff --git a/idp-session-api/src/main/java/net/shibboleth/idp/session/logic/package-info.java b/idp-session-api/src/main/java/net/shibboleth/idp/session/logic/package-info.java
index cf2e6054a..833cedb50 100644
--- a/idp-session-api/src/main/java/net/shibboleth/idp/session/logic/package-info.java
+++ b/idp-session-api/src/main/java/net/shibboleth/idp/session/logic/package-info.java
@@ -16,5 +16,7 @@
  */
 
 /** Functions and Predicates related to the use of sessions. */
+ at NonnullElements
+package net.shibboleth.idp.session.logic;
 
-package net.shibboleth.idp.session.logic;
\ No newline at end of file
+import net.shibboleth.shared.annotation.constraint.NonnullElements;
diff --git a/idp-session-api/src/main/java/net/shibboleth/idp/session/package-info.java b/idp-session-api/src/main/java/net/shibboleth/idp/session/package-info.java
index 0273e7169..991badb72 100644
--- a/idp-session-api/src/main/java/net/shibboleth/idp/session/package-info.java
+++ b/idp-session-api/src/main/java/net/shibboleth/idp/session/package-info.java
@@ -16,5 +16,7 @@
  */
 
 /** APIs related to the construction and management of sessions. */
+ at NonnullElements
+package net.shibboleth.idp.session;
 
-package net.shibboleth.idp.session;
\ No newline at end of file
+import net.shibboleth.shared.annotation.constraint.NonnullElements;
diff --git a/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/LogoutPropagationFlowDescriptorManager.java b/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/LogoutPropagationFlowDescriptorManager.java
index 2b5a1487e..d824ab95c 100644
--- a/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/LogoutPropagationFlowDescriptorManager.java
+++ b/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/LogoutPropagationFlowDescriptorManager.java
@@ -24,7 +24,6 @@ import javax.annotation.Nullable;
 import org.springframework.beans.factory.annotation.Autowired;
 
 import net.shibboleth.idp.session.LogoutPropagationFlowDescriptor;
-import net.shibboleth.shared.annotation.constraint.NonnullElements;
 import net.shibboleth.shared.spring.config.IdentifiedComponentManager;
 
 /**
@@ -42,7 +41,7 @@ public class LogoutPropagationFlowDescriptorManager
      */
     @Autowired
     public LogoutPropagationFlowDescriptorManager(
-            @Nullable @NonnullElements final List<LogoutPropagationFlowDescriptor> freeObjects) {
+            @Nullable final List<LogoutPropagationFlowDescriptor> freeObjects) {
         super(freeObjects);
     }
 
diff --git a/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/LogoutStatusStrategyFunction.java b/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/LogoutStatusStrategyFunction.java
index 95ef88e13..b6d84f519 100644
--- a/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/LogoutStatusStrategyFunction.java
+++ b/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/LogoutStatusStrategyFunction.java
@@ -29,6 +29,8 @@ import org.opensaml.saml.saml2.core.StatusCode;
 
 import net.shibboleth.idp.session.IdPSession;
 import net.shibboleth.idp.session.context.LogoutContext;
+import net.shibboleth.shared.annotation.constraint.NotLive;
+import net.shibboleth.shared.annotation.constraint.Unmodifiable;
 import net.shibboleth.shared.collection.CollectionSupport;
 import net.shibboleth.shared.logic.Constraint;
 
@@ -62,7 +64,7 @@ public class LogoutStatusStrategyFunction implements Function<ProfileRequestCont
     }
 
     /** {@inheritDoc} */
-    @Nullable public List<String> apply(@Nullable final ProfileRequestContext input) {
+    @Nullable @Unmodifiable @NotLive public List<String> apply(@Nullable final ProfileRequestContext input) {
         
         final LogoutContext logoutCtx = logoutContextLookupStrategy.apply(input);
         if (logoutCtx != null) {
diff --git a/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/StorageBackedIdPSession.java b/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/StorageBackedIdPSession.java
index 21a75e1f0..c8d8d8306 100644
--- a/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/StorageBackedIdPSession.java
+++ b/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/StorageBackedIdPSession.java
@@ -34,7 +34,6 @@ import net.shibboleth.idp.session.SPSession;
 import net.shibboleth.idp.session.SPSessionSerializerRegistry;
 import net.shibboleth.idp.session.SessionException;
 import net.shibboleth.shared.annotation.constraint.Live;
-import net.shibboleth.shared.annotation.constraint.NonnullElements;
 import net.shibboleth.shared.annotation.constraint.NotEmpty;
 import net.shibboleth.shared.annotation.constraint.NotLive;
 import net.shibboleth.shared.annotation.constraint.Unmodifiable;
@@ -161,7 +160,7 @@ public class StorageBackedIdPSession extends AbstractIdPSession {
 
     /** {@inheritDoc} */
     @Override
-    @Nonnull @NonnullElements @NotLive @Unmodifiable public Set<AuthenticationResult> getAuthenticationResults() {
+    @Nonnull @NotLive @Unmodifiable public Set<AuthenticationResult> getAuthenticationResults() {
         
         // Check for any sparse/null values in the map, which need to be loaded before returning a complete set.
         final Iterator<Map.Entry<String,Optional<AuthenticationResult>>> entries =
@@ -330,7 +329,7 @@ public class StorageBackedIdPSession extends AbstractIdPSession {
 
     /** {@inheritDoc} */
     @Override
-    @Nonnull @NonnullElements @NotLive @Unmodifiable public Set<SPSession> getSPSessions() {
+    @Nonnull @NotLive @Unmodifiable public Set<SPSession> getSPSessions() {
         
         if (sessionManager.isTrackSPSessions() && sessionManager.storageServiceMeetsThreshold()) {
             // Check for any sparse/null values in the map, which need to be loaded before returning a complete set.
@@ -521,13 +520,13 @@ public class StorageBackedIdPSession extends AbstractIdPSession {
 
     /** {@inheritDoc} */
     @Override
-    @Nonnull @NonnullElements @Live protected Map<String, Optional<AuthenticationResult>> getAuthenticationResultMap() {
+    @Nonnull @Live protected Map<String, Optional<AuthenticationResult>> getAuthenticationResultMap() {
         return super.getAuthenticationResultMap();
     }
 
     /** {@inheritDoc} */
     @Override
-    @Nonnull @NonnullElements @Live protected Map<String, Optional<SPSession>> getSPSessionMap() {
+    @Nonnull @Live protected Map<String, Optional<SPSession>> getSPSessionMap() {
         return super.getSPSessionMap();
     }
     
diff --git a/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/StorageBackedIdPSessionSerializer.java b/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/StorageBackedIdPSessionSerializer.java
index c7874f5ea..03b4cd889 100644
--- a/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/StorageBackedIdPSessionSerializer.java
+++ b/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/StorageBackedIdPSessionSerializer.java
@@ -158,10 +158,8 @@ public class StorageBackedIdPSessionSerializer extends AbstractInitializableComp
             throw new IOException("Exception while serializing IdPSession", e);
         }
     }
-// Checkstyle: CyclomaticComplexity ON
 
     /** {@inheritDoc} */
-    // Checkstyle: CyclomaticComplexity OFF
     @Override @Nonnull public StorageBackedIdPSession deserialize(final long version,
             @Nonnull @NotEmpty final String context, @Nonnull @NotEmpty final String key,
             @Nonnull @NotEmpty final String value, @Nullable final Long expiration) throws IOException {
@@ -240,6 +238,6 @@ public class StorageBackedIdPSessionSerializer extends AbstractInitializableComp
             throw new IOException("Found invalid data structure while parsing IdPSession", e);
         }
     }
-    // Checkstyle: CyclomaticComplexity ON
+// Checkstyle: CyclomaticComplexity ON
 
 }
\ No newline at end of file
diff --git a/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/StorageBackedSessionManager.java b/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/StorageBackedSessionManager.java
index d5868598a..f767c472b 100644
--- a/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/StorageBackedSessionManager.java
+++ b/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/StorageBackedSessionManager.java
@@ -49,8 +49,9 @@ import net.shibboleth.idp.session.criterion.HttpServletRequestCriterion;
 import net.shibboleth.idp.session.criterion.SPSessionCriterion;
 import net.shibboleth.idp.session.criterion.SessionIdCriterion;
 import net.shibboleth.shared.annotation.constraint.NonnullAfterInit;
-import net.shibboleth.shared.annotation.constraint.NonnullElements;
 import net.shibboleth.shared.annotation.constraint.NotEmpty;
+import net.shibboleth.shared.annotation.constraint.NotLive;
+import net.shibboleth.shared.annotation.constraint.Unmodifiable;
 import net.shibboleth.shared.collection.CollectionSupport;
 import net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent;
 import net.shibboleth.shared.component.ComponentInitializationException;
@@ -160,7 +161,7 @@ public class StorageBackedSessionManager extends AbstractIdentifiableInitializab
     @Nonnull private final StorageBackedIdPSessionSerializer serializer;
 
     /** Flows that could potentially be used to authenticate the user. */
-    @Nonnull @NonnullElements private final Map<String,AuthenticationFlowDescriptor> flowDescriptorMap;
+    @Nonnull private final Map<String,AuthenticationFlowDescriptor> flowDescriptorMap;
 
     /** Mappings between a SPSession type and a serializer implementation. */
     @Nullable private SPSessionSerializerRegistry spSessionSerializerRegistry;
@@ -449,8 +450,7 @@ public class StorageBackedSessionManager extends AbstractIdentifiableInitializab
      * 
      * @param flows the flows available for possible use
      */
-    public void setAuthenticationFlowDescriptors(
-            @Nonnull @NonnullElements final Iterable<AuthenticationFlowDescriptor> flows) {
+    public void setAuthenticationFlowDescriptors(@Nonnull final Iterable<AuthenticationFlowDescriptor> flows) {
         checkSetterPreconditions();
         flowDescriptorMap.clear();
         for (final AuthenticationFlowDescriptor desc : Constraint.isNotNull(flows, "Flow collection cannot be null")) {
@@ -500,7 +500,8 @@ public class StorageBackedSessionManager extends AbstractIdentifiableInitializab
     }
 
     /** {@inheritDoc} */
-    @Override @Nonnull public IdPSession createSession(@Nonnull @NotEmpty final String principalName)
+    @Override
+    @Nonnull public IdPSession createSession(@Nonnull @NotEmpty final String principalName)
             throws SessionException {
         checkComponentActive();
 
@@ -543,7 +544,8 @@ public class StorageBackedSessionManager extends AbstractIdentifiableInitializab
     }
 
     /** {@inheritDoc} */
-    @Override public void destroySession(@Nonnull @NotEmpty final String sessionId, final boolean unbind)
+    @Override
+    public void destroySession(@Nonnull @NotEmpty final String sessionId, final boolean unbind)
             throws SessionException {
         checkComponentActive();
 
@@ -565,7 +567,8 @@ public class StorageBackedSessionManager extends AbstractIdentifiableInitializab
 
     /** {@inheritDoc} */
     // Checkstyle: CyclomaticComplexity OFF
-    @Override @Nonnull @NonnullElements public Iterable<IdPSession> resolve(@Nullable final CriteriaSet criteria)
+    @Override
+    @Nonnull @Unmodifiable @NotLive public Iterable<IdPSession> resolve(@Nullable final CriteriaSet criteria)
             throws ResolverException {
         checkComponentActive();
 
@@ -618,7 +621,8 @@ public class StorageBackedSessionManager extends AbstractIdentifiableInitializab
     // Checkstyle: CyclomaticComplexity On
     
     /** {@inheritDoc} */
-    @Override @Nullable public IdPSession resolveSingle(@Nullable final CriteriaSet criteria) throws ResolverException {
+    @Override
+    @Nullable public IdPSession resolveSingle(@Nullable final CriteriaSet criteria) throws ResolverException {
         final Iterator<IdPSession> i = resolve(criteria).iterator();
         if (i != null && i.hasNext()) {
             return i.next();
@@ -831,8 +835,8 @@ public class StorageBackedSessionManager extends AbstractIdentifiableInitializab
      * @return collection of zero or more sessions
      * @throws ResolverException if an error occurs during lookup
      */
-    @Nonnull @NonnullElements private Iterable<IdPSession>
-            lookupBySPSession(@Nonnull final SPSessionCriterion criterion) throws ResolverException {
+    @Nonnull private Iterable<IdPSession> lookupBySPSession(@Nonnull final SPSessionCriterion criterion)
+            throws ResolverException {
 
         final int contextSize = storageService.getCapabilities().getContextSize();
         final int keySize = storageService.getCapabilities().getKeySize();
@@ -923,4 +927,4 @@ public class StorageBackedSessionManager extends AbstractIdentifiableInitializab
         }
     }
 
-}
+}
\ No newline at end of file
diff --git a/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/package-info.java b/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/package-info.java
index 2bdad8118..74848f5bb 100644
--- a/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/package-info.java
+++ b/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/package-info.java
@@ -18,4 +18,7 @@
 /**
  * Implementations of session-related classes and interfaces.
  */
-package net.shibboleth.idp.session.impl;
\ No newline at end of file
+ at NonnullElements
+package net.shibboleth.idp.session.impl;
+
+import net.shibboleth.shared.annotation.constraint.NonnullElements;

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list