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

Phil Smart philip.smart at jisc.ac.uk
Fri Feb 7 13:42:41 EST 2020


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

philsmart pushed a commit to branch master
in repository idwsfconsumer.

View the commit online:
http://git.shibboleth.net/view/?p=idwsfconsumer.git;a=commit;h=d80e6f597765db608e31c5f673e48e04ac37f014

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

commit d80e6f597765db608e31c5f673e48e04ac37f014
Author: Phil Smart <philip.smart at jisc.ac.uk>
AuthorDate: Fri Feb 7 18:38:26 2020 +0000

    JSPT-93 - Clean up API for BaseXXSupport decoders (ENCODE)
    
     - Add appropriate error handling for the new EncodingException thrown by the
       Base64Support and Base32Support encode methods.
    
    https://issues.shibboleth.net/jira/browse/JSPT-93
---
 .../org/openliberty/wsc/AuthenticationService.java   | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/openliberty/wsc/AuthenticationService.java b/src/main/java/org/openliberty/wsc/AuthenticationService.java
index bb935c6..8ade9c9 100644
--- a/src/main/java/org/openliberty/wsc/AuthenticationService.java
+++ b/src/main/java/org/openliberty/wsc/AuthenticationService.java
@@ -7,6 +7,7 @@ import javax.crypto.SecretKey;
 import javax.crypto.spec.SecretKeySpec;
 
 import net.shibboleth.utilities.java.support.codec.Base64Support;
+import net.shibboleth.utilities.java.support.codec.EncodingException;
 import net.shibboleth.utilities.java.support.xml.XMLParserException;
 
 import org.apache.commons.codec.binary.Hex;
@@ -206,9 +207,15 @@ public class AuthenticationService extends BaseServiceClient
          *  along with the authcid and password as shown below.
          *  
          */
-        Data data = new DataBuilder().buildObject();
-        String base64AuthToken = Base64Support.encode(('\0'+username+'\0'+password).getBytes(), false);
-        data.setValue(base64AuthToken);
+        Data data = new DataBuilder().buildObject();        
+        try {
+            String base64AuthToken = Base64Support.encode(('\0'+username+'\0'+password).getBytes(), false);
+            data.setValue(base64AuthToken);
+        } catch (final EncodingException e) {
+            //unlikely to happen here
+            throw new WSCException(e);
+        }
+        
         request.setData(data);
 
         /**
@@ -362,7 +369,12 @@ public class AuthenticationService extends BaseServiceClient
         // add the encoded username/password string to a Data element
         Data data = new DataBuilder().buildObject();
 
-        data.setValue(Base64Support.encode(buff.toString().getBytes(), false));
+        try {
+            data.setValue(Base64Support.encode(buff.toString().getBytes(), false));
+        } catch (final EncodingException e) {
+            //unlikely to happen
+           throw new WSCException(e);
+        }
         
         SASLRequest stage2Request = requestBuilder.buildObject();
         stage2Request.setMechanism(AuthMechanism.CRAM_MD5.code);          

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


More information about the commits mailing list