[java-shib-shared] branch main updated: Add more deprecated stubs for compatibility.
Scott Cantor
cantor.2 at osu.edu
Fri Jul 21 18:23:56 UTC 2023
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=5d2883c891ac1eee5718577b45661e9d4c525951
The following commit(s) were added to refs/heads/main by this push:
new 5d2883c8 Add more deprecated stubs for compatibility.
5d2883c8 is described below
commit 5d2883c891ac1eee5718577b45661e9d4c525951
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Fri Jul 21 14:23:29 2023 -0400
Add more deprecated stubs for compatibility.
---
.../shibboleth/shared/codec/StringDigester.java | 2 +-
.../java/support/codec/Base32Support.java | 72 ++++++++++++++
.../java/support/codec/Base64Support.java | 109 +++++++++++++++++++++
.../java/support/codec/StringDigester.java | 72 ++++++++++++++
4 files changed, 254 insertions(+), 1 deletion(-)
diff --git a/shib-support/src/main/java/net/shibboleth/shared/codec/StringDigester.java b/shib-support/src/main/java/net/shibboleth/shared/codec/StringDigester.java
index db373bd5..bb1edf5d 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/codec/StringDigester.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/codec/StringDigester.java
@@ -40,7 +40,7 @@ import org.slf4j.Logger;
* and then returns the output in a specified format: Base32/64-encoded or hexadecimal with with lower or upper
* case characters.
*/
-public final class StringDigester implements Function<String,String> {
+public class StringDigester implements Function<String,String> {
/** The output format determining how the the digested byte[] is converted to the output String. */
public enum OutputFormat {
diff --git a/shib-support/src/main/java/net/shibboleth/utilities/java/support/codec/Base32Support.java b/shib-support/src/main/java/net/shibboleth/utilities/java/support/codec/Base32Support.java
new file mode 100644
index 00000000..c6179490
--- /dev/null
+++ b/shib-support/src/main/java/net/shibboleth/utilities/java/support/codec/Base32Support.java
@@ -0,0 +1,72 @@
+/*
+ * 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.
+ */
+
+package net.shibboleth.utilities.java.support.codec;
+
+import javax.annotation.Nonnull;
+
+import net.shibboleth.shared.codec.DecodingException;
+import net.shibboleth.shared.codec.EncodingException;
+import net.shibboleth.shared.primitive.DeprecationSupport;
+import net.shibboleth.shared.primitive.DeprecationSupport.ObjectType;
+
+/**
+ * Stub for deprecation.
+ *
+ * @deprecated
+ */
+ at Deprecated(since="9.0.0", forRemoval=true)
+public final class Base32Support {
+
+ /** Constructor. */
+ private Base32Support() {
+
+ }
+
+ /**
+ * Base32 encodes the given binary data.
+ *
+ * @param data data to encode
+ * @param chunked whether the encoded data should be chunked or not
+ *
+ * @return the base32 encoded data
+ * @throws EncodingException when any {@link Exception} is thrown from the underlying encoder,
+ * or the output is null.
+ */
+ @Nonnull public static String encode(@Nonnull final byte[] data, final boolean chunked) throws EncodingException {
+ DeprecationSupport.warn(ObjectType.CLASS, Base32Support.class.getName(), null,
+ net.shibboleth.shared.codec.Base32Support.class.getName());
+ return net.shibboleth.shared.codec.Base32Support.encode(data, chunked);
+ }
+
+ /**
+ * Decodes (un)chunked Base32 encoded data.
+ *
+ * @param data Base32 encoded data
+ *
+ * @return the decoded data
+ *
+ * @throws DecodingException when an {@link Exception} is thrown from
+ * the underlying decoder, or the output is null.
+ */
+ @Nonnull public static byte[] decode(@Nonnull final String data) throws DecodingException {
+ DeprecationSupport.warn(ObjectType.CLASS, Base32Support.class.getName(), null,
+ net.shibboleth.shared.codec.Base32Support.class.getName());
+ return net.shibboleth.shared.codec.Base32Support.decode(data);
+ }
+
+}
\ No newline at end of file
diff --git a/shib-support/src/main/java/net/shibboleth/utilities/java/support/codec/Base64Support.java b/shib-support/src/main/java/net/shibboleth/utilities/java/support/codec/Base64Support.java
new file mode 100644
index 00000000..03949a18
--- /dev/null
+++ b/shib-support/src/main/java/net/shibboleth/utilities/java/support/codec/Base64Support.java
@@ -0,0 +1,109 @@
+/*
+ * 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.
+ */
+
+package net.shibboleth.utilities.java.support.codec;
+
+import javax.annotation.Nonnull;
+
+import net.shibboleth.shared.codec.DecodingException;
+import net.shibboleth.shared.codec.EncodingException;
+import net.shibboleth.shared.primitive.DeprecationSupport;
+import net.shibboleth.shared.primitive.DeprecationSupport.ObjectType;
+
+/**
+ * Deprecated stub.
+ *
+ * @deprecated
+ */
+ at Deprecated(since="9.0.0", forRemoval=true)
+public final class Base64Support {
+
+ /** Constructor. */
+ private Base64Support() {
+
+ }
+
+ /**
+ * Base64 encodes the given binary data.
+ *
+ * @param data data to encode
+ * @param chunked whether the encoded data should be chunked or not
+ *
+ * @return the base64 encoded data
+ * @throws EncodingException when any {@link Exception} is thrown from the underlying encoder,
+ * or the output is null.
+ */
+ @Nonnull public static String encode(@Nonnull final byte[] data, final boolean chunked) throws EncodingException{
+ DeprecationSupport.warn(ObjectType.CLASS, Base64Support.class.getName(), null,
+ net.shibboleth.shared.codec.Base64Support.class.getName());
+ return net.shibboleth.shared.codec.Base64Support.encode(data, chunked);
+ }
+
+ /**
+ * Decodes (un)chunked Base64 encoded data.
+ *
+ * @param data Base64 encoded data
+ *
+ * @return the decoded data
+ *
+ * @throws DecodingException when any {@link Exception} is thrown from
+ * the underlying decoder, or the output is null.
+ */
+ @Nonnull public static byte[] decode(@Nonnull final String data) throws DecodingException{
+ DeprecationSupport.warn(ObjectType.CLASS, Base64Support.class.getName(), null,
+ net.shibboleth.shared.codec.Base64Support.class.getName());
+ return net.shibboleth.shared.codec.Base64Support.decode(data);
+ }
+
+ /**
+ * Base64URL encodes the given binary data.
+ *
+ * <p>
+ * This is compliant with RFC 4648, Section 5: "Base 64 Encoding with URL and Filename Safe Alphabet".
+ * </p>
+ *
+ * @param data data to encode
+ *
+ * @return the base64url encoded data
+ * @throws EncodingException if the input data can not be encoded as a base64 string.
+ */
+ @Nonnull public static String encodeURLSafe(@Nonnull final byte[] data) throws EncodingException {
+ DeprecationSupport.warn(ObjectType.CLASS, Base64Support.class.getName(), null,
+ net.shibboleth.shared.codec.Base64Support.class.getName());
+ return net.shibboleth.shared.codec.Base64Support.encodeURLSafe(data);
+ }
+
+ /**
+ * Decodes (un)chunked Base64URL encoded data.
+ *
+ * <p>
+ * This is compliant with RFC 4648, Section 5: "Base 64 Encoding with URL and Filename Safe Alphabet".
+ * </p>
+ *
+ * @param data Base64URL encoded data
+ *
+ * @return the decoded data
+ *
+ * @throws DecodingException if unable to decode the input data.
+ */
+ @Nonnull public static byte[] decodeURLSafe(@Nonnull final String data) throws DecodingException {
+ DeprecationSupport.warn(ObjectType.CLASS, Base64Support.class.getName(), null,
+ net.shibboleth.shared.codec.Base64Support.class.getName());
+ return net.shibboleth.shared.codec.Base64Support.decodeURLSafe(data);
+ }
+
+}
\ No newline at end of file
diff --git a/shib-support/src/main/java/net/shibboleth/utilities/java/support/codec/StringDigester.java b/shib-support/src/main/java/net/shibboleth/utilities/java/support/codec/StringDigester.java
new file mode 100644
index 00000000..ad4802a2
--- /dev/null
+++ b/shib-support/src/main/java/net/shibboleth/utilities/java/support/codec/StringDigester.java
@@ -0,0 +1,72 @@
+/*
+ * 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.
+ */
+
+package net.shibboleth.utilities.java.support.codec;
+
+import java.nio.charset.Charset;
+import java.security.NoSuchAlgorithmException;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+import net.shibboleth.shared.annotation.ParameterName;
+import net.shibboleth.shared.annotation.constraint.NotEmpty;
+import net.shibboleth.shared.primitive.DeprecationSupport;
+import net.shibboleth.shared.primitive.DeprecationSupport.ObjectType;
+
+/**
+ * Deprecated stub.
+ *
+ * @deprecated
+ */
+ at Deprecated(since="9.0.0", forRemoval=true)
+public final class StringDigester extends net.shibboleth.shared.codec.StringDigester {
+
+ /**
+ * Constructor.
+ *
+ * <p>The input character set will be UTF-8.</p>
+ *
+ * @param algorithm the JCA digest algorithm identifier
+ * @param format the output format used to convert the digested[] to the output string
+ * @throws NoSuchAlgorithmException thrown if the digestAlgorithm is not invalid or unsupported
+ */
+ public StringDigester(@Nonnull @NotEmpty @ParameterName(name="algorithm") final String algorithm,
+ @Nonnull @ParameterName(name="format") final OutputFormat format)
+ throws NoSuchAlgorithmException {
+ super(algorithm, format);
+ DeprecationSupport.warn(ObjectType.CLASS, getClass().getName(), null,
+ net.shibboleth.shared.codec.StringDigester.class.getName());
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param algorithm the JCA digest algorithm identifier
+ * @param format the output format used to convert the digested[] to the output string
+ * @param charset the character set to use in converting the input string to a byte[] prior to digesting
+ * @throws NoSuchAlgorithmException thrown if the digestAlgorithm is not invalid or unsupported
+ */
+ public StringDigester(@Nonnull @NotEmpty @ParameterName(name="algorithm") final String algorithm,
+ @Nonnull @ParameterName(name="format") final OutputFormat format,
+ @Nullable @ParameterName(name="charset") final Charset charset) throws NoSuchAlgorithmException {
+ super(algorithm, format, charset);
+ DeprecationSupport.warn(ObjectType.CLASS, getClass().getName(), null,
+ net.shibboleth.shared.codec.StringDigester.class.getName());
+ }
+
+}
\ 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