[java-idp-oidc] branch master updated: JSPT-93 - Clean up API for BaseXXSupport decoders (ENCODE)

Phil Smart philip.smart at jisc.ac.uk
Fri Feb 7 12:16:07 EST 2020


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

philsmart pushed a commit to branch master
in repository java-idp-oidc.

View the commit online:
http://git.shibboleth.net/view/?p=java-idp-oidc.git;a=commit;h=993dde9e091f03d08c6ffe1ccb251313d2281007

The following commit(s) were added to refs/heads/master by this push:
       new  993dde9   JSPT-93 - Clean up API for BaseXXSupport decoders (ENCODE)
993dde9 is described below

commit 993dde9e091f03d08c6ffe1ccb251313d2281007
Author: Phil Smart <philip.smart at jisc.ac.uk>
AuthorDate: Fri Feb 7 17:15:47 2020 +0000

    JSPT-93 - Clean up API for BaseXXSupport decoders (ENCODE)
    
     -  Throw attribute encoding exception if the byte attribute transcoder can not
         Base64 encode any input IdP attribute values.
    
    https://issues.shibboleth.net/jira/browse/JSPT-93
---
 .../transcoding/impl/OIDCByteAttributeTranscoder.java          | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/idp-oidc-extension-impl/src/main/java/org/geant/idpextension/oidc/attribute/transcoding/impl/OIDCByteAttributeTranscoder.java b/idp-oidc-extension-impl/src/main/java/org/geant/idpextension/oidc/attribute/transcoding/impl/OIDCByteAttributeTranscoder.java
index 62598d0..fd5d538 100644
--- a/idp-oidc-extension-impl/src/main/java/org/geant/idpextension/oidc/attribute/transcoding/impl/OIDCByteAttributeTranscoder.java
+++ b/idp-oidc-extension-impl/src/main/java/org/geant/idpextension/oidc/attribute/transcoding/impl/OIDCByteAttributeTranscoder.java
@@ -34,6 +34,7 @@ import net.shibboleth.idp.attribute.IdPAttributeValue;
 import net.shibboleth.idp.attribute.transcoding.TranscodingRule;
 import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
 import net.shibboleth.utilities.java.support.codec.Base64Support;
+import net.shibboleth.utilities.java.support.codec.EncodingException;
 
 /**
  * Class encoding byte attributes to base64 encoded string json object. Name of the attribute will be set as the key.
@@ -69,8 +70,13 @@ public class OIDCByteAttributeTranscoder extends AbstractOIDCAttributeTranscoder
                     if (attributeString.length() > 0) {
                         attributeString += delimiter;
                     }
-                    attributeString +=
-                            Base64Support.encode(((ByteAttributeValue) value).getValue(), Base64Support.UNCHUNKED);
+                    try {
+                        attributeString +=
+                                Base64Support.encode(((ByteAttributeValue) value).getValue(), Base64Support.UNCHUNKED);
+                    } catch (final EncodingException e) {
+                        //convert exception and throw if any of the values can not be base64 encoded
+                        throw new AttributeEncodingException("Attribtue value could not be base64 encoded",e);
+                    }
                     if (asArray) {
                         array.add(attributeString.toString());
                         attributeString = "";

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


More information about the commits mailing list