[java-identity-provider] branch master updated: Adjust annotations to match intent and clean up error paths.

Scott Cantor cantor.2 at osu.edu
Wed Dec 4 09:40:38 EST 2019


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

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

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

The following commit(s) were added to refs/heads/master by this push:
       new  5649c09   Adjust annotations to match intent and clean up error paths.
5649c09 is described below

commit 5649c093731ac7e34b243c99c0ca93fe0cf8a08b
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Wed Dec 4 09:40:33 2019 -0500

    Adjust annotations to match intent and clean up error paths.
---
 .../idp/saml/nameid/impl/BaseCryptoTransientDecoder.java   | 14 +++++++-------
 .../idp/saml/nameid/impl/CryptoTransientNameIDDecoder.java |  3 ++-
 .../nameid/impl/CryptoTransientNameIdentifierDecoder.java  |  4 +++-
 3 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/nameid/impl/BaseCryptoTransientDecoder.java b/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/nameid/impl/BaseCryptoTransientDecoder.java
index 103121b..87a91c6 100644
--- a/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/nameid/impl/BaseCryptoTransientDecoder.java
+++ b/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/nameid/impl/BaseCryptoTransientDecoder.java
@@ -80,8 +80,8 @@ public abstract class BaseCryptoTransientDecoder extends AbstractIdentifiableIni
      * @return the decoded entity.
      * @throws NameDecoderException if a decode error occurs.
      */
-    @Nullable protected String decode(@Nonnull final String transientId, @Nonnull @NotEmpty final String requesterId)
-            throws NameDecoderException {
+    @Nullable @NotEmpty protected String decode(@Nonnull final String transientId,
+            @Nonnull @NotEmpty final String requesterId) throws NameDecoderException {
         ComponentSupport.ifNotInitializedThrowUninitializedComponentException(this);
         
         if (null == transientId) {
@@ -96,13 +96,13 @@ public abstract class BaseCryptoTransientDecoder extends AbstractIdentifiableIni
         } catch (final DataExpiredException e) {
             throw new NameDecoderException(getLogPrefix() + " Principal identifier has expired");
         } catch (final DataSealerException e) {
-            log.debug("{} Caught exception unwrapping principal identifier", getLogPrefix(), e);
-            return null;
+            throw new NameDecoderException(getLogPrefix() + " Caught exception unwrapping sealed transient identifier",
+                    e);
         }
 
-        if (decodedId == null) {
-            throw new NameDecoderException(getLogPrefix() + " Unable to recover principal from transient identifier: "
-                    + transientId);
+        if (Strings.isNullOrEmpty(decodedId)) {
+            log.debug("{} Unable to recover principal from transient identifier: {}", getLogPrefix(), transientId);
+            return null;
         }
 
         // Split the identifier.
diff --git a/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/nameid/impl/CryptoTransientNameIDDecoder.java b/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/nameid/impl/CryptoTransientNameIDDecoder.java
index f603e64..139709d 100644
--- a/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/nameid/impl/CryptoTransientNameIDDecoder.java
+++ b/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/nameid/impl/CryptoTransientNameIDDecoder.java
@@ -18,6 +18,7 @@
 package net.shibboleth.idp.saml.nameid.impl;
 
 import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
 
 import net.shibboleth.idp.authn.context.SubjectCanonicalizationContext;
 import net.shibboleth.idp.saml.nameid.NameDecoderException;
@@ -36,7 +37,7 @@ public class CryptoTransientNameIDDecoder extends BaseCryptoTransientDecoder imp
 
     /** {@inheritDoc} */
     @Override
-    @Nonnull @NotEmpty public String decode(@Nonnull final SubjectCanonicalizationContext c14nContext,
+    @Nullable @NotEmpty public String decode(@Nonnull final SubjectCanonicalizationContext c14nContext,
             @Nonnull final NameID nameID) throws NameDecoderException {
 
         return super.decode(nameID.getValue(), c14nContext.getRequesterId());
diff --git a/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/nameid/impl/CryptoTransientNameIdentifierDecoder.java b/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/nameid/impl/CryptoTransientNameIdentifierDecoder.java
index c1e2fdf..ace8abb 100644
--- a/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/nameid/impl/CryptoTransientNameIdentifierDecoder.java
+++ b/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/nameid/impl/CryptoTransientNameIdentifierDecoder.java
@@ -18,10 +18,12 @@
 package net.shibboleth.idp.saml.nameid.impl;
 
 import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
 
 import net.shibboleth.idp.authn.context.SubjectCanonicalizationContext;
 import net.shibboleth.idp.saml.nameid.NameDecoderException;
 import net.shibboleth.idp.saml.nameid.NameIdentifierDecoder;
+import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
 
 import org.opensaml.saml.saml1.core.NameIdentifier;
 
@@ -34,7 +36,7 @@ public class CryptoTransientNameIdentifierDecoder extends BaseCryptoTransientDec
 
     /** {@inheritDoc} */
     @Override
-    @Nonnull public String decode(@Nonnull final SubjectCanonicalizationContext c14nContext,
+    @Nullable @NotEmpty public String decode(@Nonnull final SubjectCanonicalizationContext c14nContext,
             @Nonnull final NameIdentifier nameIdentifier) throws NameDecoderException {
 
         return super.decode(nameIdentifier.getValue(), c14nContext.getRequesterId());

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


More information about the commits mailing list