Gets the Base64 encoded message from the request and decodes it.

@param transport inbound message transport

@return decoded message

@throws MessageDecodingException thrown if the message does not contain a base64 encoded SAML message
172131
protected InputStream getBase64DecodedMessage(HTTPInTransport transport) throws MessageDecodingException {
        log.debug("Getting Base64 encoded message from request");
        String encodedMessage = transport.getParameterValue("assertion");


        if (DatatypeHelper.isEmpty(encodedMessage)) {
            log.error("Request did not contain either a SAMLRequest or "
                          + "SAMLResponse paramter.  Invalid request for SAML 2 HTTP POST binding.");
            throw new MessageDecodingException("No SAML message present in request");
        }

        log.trace("Base64 decoding SAML message:\n{}", encodedMessage);
        byte[] decodedBytes = org.apache.commons.codec.binary.Base64.decodeBase64(encodedMessage.getBytes(StandardCharsets.UTF_8));
        if(decodedBytes == null){
            log.error("Unable to Base64 decode SAML message");
            throw new MessageDecodingException("Unable to Base64 decode SAML message");
        }

        log.trace("Decoded SAML message:\n{}", new String(decodedBytes));
        return new ByteArrayInputStream(decodedBytes);
    }
448391
public static Payload decode(String base64) {
    JsonObject json = decodeToJson(base64);
    Payload payload = new Payload();
    json.keySet().forEach(key -> {
      switch (key) {
        case "iss":
          payload.issuer = json.getString(key);
          break;
        case "sub":
          payload.subject = json.getString(key);
          break;
        case "aud":
          payload.audience = json.getString(key);
          break;
        case "exp":
          payload.expires = new Long(json.get(key).toString());
          break;
        case "nbf":
          payload.notBefore = new Long(json.get(key).toString());
          break;
        case "iat":
          payload.issuedAt = new Long(json.get(key).toString());
          break;
        case "jti":
          payload.jwtId = json.getString(key);
          break;
        default:
          payload.add(key, json.getString(key));
      }
    });
    return payload;
  }
317621
private static JsJmsMessage decodeTextBody(String body) throws MessageDecodeFailedException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "decodeTextBody");
        JsJmsTextMessage result = new JsJmsTextMessageImpl(MfpConstants.CONSTRUCTOR_NO_OP);
        if (body != null) {
            result.setText(URLDecode(body));
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "decodeTextBody");
        return result;
    }
672328
public static ByteBuffer rfc6455Encode(WsMessage message, int maskValue) {
        final boolean mask = true;

        boolean fin = true;   // TODO continued frames?

        ByteBuffer buf = message.getBytes();
        
        int remaining = buf.remaining();

        int offset = 2 + (mask ? 4 : 0) + calculateLengthSize(remaining);
        
        ByteBuffer b = ByteBuffer.allocate(offset + remaining);

        int start = b.position();

        byte b1 = (byte) (fin ? 0x80 : 0x00);
        byte b2 = (byte) (mask ? 0x80 : 0x00);

        b1 = doEncodeOpcode(b1, message);
        b2 |= lenBits(remaining);

        b.put(b1).put(b2);

        doEncodeLength(b, remaining);

        if (mask) {
            b.putInt(maskValue);
        }
        //put message data
        b.put(buf);
        
           if ( mask ) {
               b.position(offset);
            mask(b, maskValue);
        }
        
          b.limit(b.position());
           b.position(start);
           return b;
    }
1312169
@Override
    protected URI getEndpointURL(MessageContext<SAMLObject> messageContext) throws MessageEncodingException {
        try {
            return SAMLBindingSupport.getEndpointURL(messageContext);
        } catch (BindingException e) {
            throw new MessageEncodingException("Could not obtain message endpoint URL", e);
        }
    }
1173823
public IoBuffer encode(Object message) throws Exception {
        if (message != null) {
            try {
                return encodePacket((Packet) message);
            } catch (Exception e) {
                log.error("Error encoding", e);
            }
        } else if (log.isDebugEnabled()) {
            try {
                String callingMethod = Thread.currentThread().getStackTrace()[4].getMethodName();
                log.debug("Message is null at encode, expecting a Packet from: {}", callingMethod);
            } catch (Throwable t) {
                log.warn("Problem getting current calling method from stacktrace", t);
            }
        }
        return null;
    }
617101
@Deprecated
	public static FileMessage decode(String encodedMessage) throws IOException {
		return decode(
			encodedMessage.isEmpty()
			? ByteArray.EMPTY_BYTE_ARRAY
			: new ByteArray(
				Base64Coder.decode(
					encodedMessage
				)
			)
		);
	}
37710
public static byte[] decodeBase64(String base64) {
    if (base64 == null)
      throw new NullPointerException("Parameter 'base64' cannot be null.");

    String fixedBase64 = padBase64(base64);
    return Base64.getDecoder().decode(fixedBase64);
  }
1109152
@Nonnull
  public String getContentAsBase64EncodedString ()
  {
    // Add Base64 encoded String
    final byte [] aEncoded = Base64.encodeBytesToBytes (m_aContent);
    // Print the string in the specified charset
    return new String (aEncoded, m_aCharset);
  }
1029118
public void receiveRequest(byte[] bytes, Transport transport) throws IOException, WsonrpcException {
        JsonRpcResponse resp;
        try {
            JsonRpcMessage msg = receive(bytes);
            if (msg instanceof JsonRpcRequest) {
                JsonRpcRequest req = (JsonRpcRequest) msg;
                resp = execute(req);
            } else {
                resp = new JsonRpcResponse(null, JsonRpcError.invalidRequestError(null));
            }
        } catch (JsonException e) {
            resp = new JsonRpcResponse(null, JsonRpcError.parseError(e));
        } catch (IOException e) {
            resp = new JsonRpcResponse(null, JsonRpcError.internalError(e));
        }
        transmit(transport, resp);
    }
202246
private void encodeBytesBody(StringBuffer result, JsJmsBytesMessage msg) {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "encodeBytesBody");
    byte[] body = msg.getBytes();
    if (body != null) {
      result.append('~');
      HexString.binToHex(body, 0, body.length, result);
    }
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "encodeBytesBody");
  }
320912
protected StringEntity serialiseRequestMessage(Object requestMessage) throws UnsupportedEncodingException {
        StringEntity result = null;

        // Add the request message if there is one
        if (requestMessage != null) {
            // Send the message
            String message = Serialiser.serialise(requestMessage);
            result = new StringEntity(message);
        }

        return result;
    }
683799
public static JWSHeader fromBase64String(String base64) throws IOException {
        String json = MessageSecurityHelper.base64UrltoString(base64);
        ObjectMapper mapper = new ObjectMapper();
        return mapper.readValue(json, JWSHeader.class);
    }
1194329
@Override
	public String encodeAsString() {
		if(message.size == 0) return "";

		return new String(Base64Coder.encode(message.array, message.size));
	}
60635
public static ByteArrayMessage decode(String encodedMessage) {
		if(encodedMessage.isEmpty()) return EMPTY_BYTE_ARRAY_MESSAGE;

		return new ByteArrayMessage(Base64Coder.decode(encodedMessage));
	}
804079
byte[] encodeToBytes(EncodingLevel encodingLevel) throws JMSException {

        // If we haven't already got the encoding cached, encode & cache it now.
        if (cachedEncoding[encodingLevel.ordinal()] == null) {
            cachedEncoding[encodingLevel.ordinal()] = destEncoder.getMessageRepresentationFromDest(this, encodingLevel);
        }
        return cachedEncoding[encodingLevel.ordinal()];
    }
298211
static ResourceAddress getLowestTransportLayer(ResourceAddress transport) {
        if (transport.getTransport() != null) {
            return getLowestTransportLayer(transport.getTransport());
        }
        return transport;
    }