[java-shib-shared] branch main updated: Add a deprecated stub for HTMLEncoder for IdP compatibility.

Scott Cantor cantor.2 at osu.edu
Mon Sep 26 16:51:51 UTC 2022


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

scantor pushed a commit to branch main
in repository java-shib-shared.

View the commit online:
http://git.shibboleth.net/view/?p=java-shib-shared.git;a=commit;h=7903bc2121161f1826a1f12368d9e2cd38f152f9

The following commit(s) were added to refs/heads/main by this push:
     new 7903bc21 Add a deprecated stub for HTMLEncoder for IdP compatibility.
7903bc21 is described below

commit 7903bc2121161f1826a1f12368d9e2cd38f152f9
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Mon Sep 26 12:51:49 2022 -0400

    Add a deprecated stub for HTMLEncoder for IdP compatibility.
---
 .../utilities/java/support/codec/HTMLEncoder.java  | 93 ++++++++++++++++++++++
 .../utilities/java/support/codec/package-info.java | 21 +++++
 2 files changed, 114 insertions(+)

diff --git a/shib-support/src/main/java/net/shibboleth/utilities/java/support/codec/HTMLEncoder.java b/shib-support/src/main/java/net/shibboleth/utilities/java/support/codec/HTMLEncoder.java
new file mode 100644
index 00000000..bcad3576
--- /dev/null
+++ b/shib-support/src/main/java/net/shibboleth/utilities/java/support/codec/HTMLEncoder.java
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the University Corporation for Advanced Internet Development,
+ * Inc. (UCAID) under one or more contributor license agreements.  See the
+ * NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The UCAID licenses this file to You under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file except in
+ * compliance with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * OWASP Enterprise Security API (ESAPI)
+ * 
+ * This file is part of the Open Web Application Security Project (OWASP)
+ * Enterprise Security API (ESAPI) project. For details, please see
+ * <a href="http://www.owasp.org/index.php/ESAPI">http://www.owasp.org/index.php/ESAPI</a>.
+ *
+ * Copyright (c) 2007 - The OWASP Foundation
+ * 
+ * The ESAPI is published by OWASP under the BSD license. You should read and accept the
+ * LICENSE before you use, modify, and/or redistribute this software.
+ * 
+ * @author Jeff Williams <a href="http://www.aspectsecurity.com">Aspect Security</a>
+ * @created 2007
+ */
+
+package net.shibboleth.utilities.java.support.codec;
+
+import javax.annotation.Nullable;
+
+import net.shibboleth.utilities.java.support.primitive.DeprecationSupport;
+import net.shibboleth.utilities.java.support.primitive.DeprecationSupport.ObjectType;
+
+/**
+ * Legacy version of {@link net.shibboleth.shared.codec.HTMLEncoder}.
+ * 
+ * @deprecated
+ */
+ at Deprecated(since="9.0.0", forRemoval=true)
+public final class HTMLEncoder {
+
+    /** Constructor. */
+    private HTMLEncoder() {
+
+    }
+
+    /**
+     * Encode data for use in HTML using HTML entity encoding
+     * <p>
+     * Note that the following characters: 00-08, 0B-0C, 0E-1F, and 7F-9F
+     * <p>
+     * cannot be used in HTML.
+     * 
+     * @see <a href="http://en.wikipedia.org/wiki/Character_encodings_in_HTML">HTML Encodings [wikipedia.org]</a>
+     * @see <a href="http://www.w3.org/TR/html4/sgml/sgmldecl.html">SGML Specification [w3.org]</a>
+     * @see <a href="http://www.w3.org/TR/REC-xml/#charsets">XML Specification [w3.org]</a>
+     * 
+     * @param input the text to encode for HTML
+     * 
+     * @return input encoded for HTML
+     */
+    @Nullable public static String encodeForHTML(@Nullable final String input) {
+        DeprecationSupport.warn(ObjectType.CLASS, HTMLEncoder.class.getName(), null,
+                net.shibboleth.shared.codec.HTMLEncoder.class.getName());
+        
+        return net.shibboleth.shared.codec.HTMLEncoder.encodeForHTML(input);
+    }
+
+    /**
+     * Encode data for use in HTML attributes.
+     * 
+     * @param input the text to encode for an HTML attribute
+     * 
+     * @return input encoded for use as an HTML attribute
+     */
+    @Nullable public static String encodeForHTMLAttribute(@Nullable final String input) {
+        DeprecationSupport.warn(ObjectType.CLASS, HTMLEncoder.class.getName(), null,
+                net.shibboleth.shared.codec.HTMLEncoder.class.getName());
+
+        if (input == null) {
+            return null;
+        }
+        return net.shibboleth.shared.codec.HTMLEncoder.encodeForHTMLAttribute(input);
+    }
+
+}
\ No newline at end of file
diff --git a/shib-support/src/main/java/net/shibboleth/utilities/java/support/codec/package-info.java b/shib-support/src/main/java/net/shibboleth/utilities/java/support/codec/package-info.java
new file mode 100644
index 00000000..b01bf193
--- /dev/null
+++ b/shib-support/src/main/java/net/shibboleth/utilities/java/support/codec/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * Licensed to the University Corporation for Advanced Internet Development,
+ * Inc. (UCAID) under one or more contributor license agreements.  See the
+ * NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The UCAID licenses this file to You under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file except in
+ * compliance with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Legacy API stub for compatibility.
+ */
+package net.shibboleth.utilities.java.support.codec;
\ No newline at end of file

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


More information about the commits mailing list