From 971037f1608e81702e9914fcc0a7112e8ab0b13a Mon Sep 17 00:00:00 2001 From: zihluwang Date: Sat, 25 Jan 2025 19:53:04 +0800 Subject: [PATCH] chore: removed lombok and upgraded copyright --- build.gradle.kts | 4 - .../devkit/core/exceptions/package-info.java | 23 ----- .../onixbyte/devkit/core/package-info.java | 29 ------ .../com/onixbyte/devkit/package-info.java | 27 ------ .../com/onixbyte/devkit/utils/AesUtil.java | 6 +- .../com/onixbyte/devkit/utils/Base64Util.java | 5 + .../com/onixbyte/devkit/utils/BoolUtil.java | 5 + .../com/onixbyte/devkit/utils/BranchUtil.java | 5 + .../com/onixbyte/devkit/utils/HashUtil.java | 5 + .../com/onixbyte/devkit/utils/MapUtil.java | 12 +-- .../devkit/utils/ObjectMapAdapter.java | 4 +- .../com/onixbyte/devkit/utils/RangeUtil.java | 5 + .../onixbyte/devkit/utils/package-info.java | 27 ------ .../java/com/onixbyte/guid/GuidCreator.java | 6 +- .../guid/exceptions/package-info.java | 39 -------- .../guid/impl/SnowflakeGuidCreator.java | 4 + .../java/com/onixbyte/guid/package-info.java | 33 ------- .../java/com/onixbyte/security/KeyLoader.java | 14 +-- .../exception/KeyLoadingException.java | 18 ++-- .../devkit/utils/unsafe/ReflectMapUtil.java | 8 +- .../com/onixbyte/nums/ChainedCalcUtil.java | 19 +++- .../onixbyte/nums/PercentileCalculator.java | 7 +- .../onixbyte/nums/model/QuartileBounds.java | 2 +- .../autoconfiguration/PropertyGuard.java | 6 +- .../authzero/AuthzeroTokenResolver.java | 8 +- .../simplejwt/authzero/package-info.java | 45 --------- .../com/onixbyte/simplejwt/SecretCreator.java | 6 +- .../com/onixbyte/simplejwt/TokenPayload.java | 7 +- .../com/onixbyte/simplejwt/TokenResolver.java | 2 +- .../annotations/ExcludeFromPayload.java | 2 +- .../simplejwt/annotations/TokenEnum.java | 2 +- .../simplejwt/annotations/package-info.java | 27 ------ .../simplejwt/constants/PredefinedKeys.java | 2 +- .../simplejwt/constants/TokenAlgorithm.java | 5 +- .../simplejwt/constants/TokenDataType.java | 13 ++- .../simplejwt/constants/package-info.java | 26 ------ .../exceptions/IllegalKeyPairException.java | 2 +- .../exceptions/IllegalSecretException.java | 2 +- .../UnsupportedAlgorithmException.java | 2 +- .../exceptions/WeakSecretException.java | 2 +- .../simplejwt/exceptions/package-info.java | 39 -------- .../com/onixbyte/simplejwt/package-info.java | 40 -------- ...uthzeroTokenResolverAutoConfiguration.java | 6 +- .../GuidAutoConfiguration.java | 6 +- .../conditions/GuidCreatorCondition.java | 6 +- .../autoconfiguration/package-info.java | 38 -------- .../properties/SimpleJwtProperties.java | 91 ++++++++++++++++++- .../properties/package-info.java | 35 ------- 48 files changed, 220 insertions(+), 507 deletions(-) delete mode 100644 devkit-core/src/main/java/com/onixbyte/devkit/core/exceptions/package-info.java delete mode 100644 devkit-core/src/main/java/com/onixbyte/devkit/core/package-info.java delete mode 100644 devkit-core/src/main/java/com/onixbyte/devkit/package-info.java delete mode 100644 devkit-utils/src/main/java/com/onixbyte/devkit/utils/package-info.java delete mode 100644 guid/src/main/java/com/onixbyte/guid/exceptions/package-info.java delete mode 100644 guid/src/main/java/com/onixbyte/guid/package-info.java delete mode 100644 simple-jwt-authzero/src/main/java/com/onixbyte/simplejwt/authzero/package-info.java delete mode 100644 simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/annotations/package-info.java delete mode 100644 simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/constants/package-info.java delete mode 100644 simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/exceptions/package-info.java delete mode 100644 simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/package-info.java delete mode 100644 simple-jwt-spring-boot-starter/src/main/java/com/onixbyte/simplejwt/autoconfiguration/package-info.java delete mode 100644 simple-jwt-spring-boot-starter/src/main/java/com/onixbyte/simplejwt/autoconfiguration/properties/package-info.java diff --git a/build.gradle.kts b/build.gradle.kts index f43baac..266e688 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -43,16 +43,12 @@ subprojects { dependencies { compileOnly("org.slf4j:slf4j-api:$slf4jVersion") - compileOnly("org.projectlombok:lombok:$lombokVersion") implementation("ch.qos.logback:logback-classic:$logbackVersion") annotationProcessor("org.slf4j:slf4j-api:$slf4jVersion") - annotationProcessor("org.projectlombok:lombok:$lombokVersion") testCompileOnly("org.slf4j:slf4j-api:$slf4jVersion") - testCompileOnly("org.projectlombok:lombok:$lombokVersion") testImplementation("org.junit.jupiter:junit-jupiter:$junitVersion") testAnnotationProcessor("org.slf4j:slf4j-api:$slf4jVersion") - testAnnotationProcessor("org.projectlombok:lombok:$lombokVersion") } tasks.withType { diff --git a/devkit-core/src/main/java/com/onixbyte/devkit/core/exceptions/package-info.java b/devkit-core/src/main/java/com/onixbyte/devkit/core/exceptions/package-info.java deleted file mode 100644 index 78bd635..0000000 --- a/devkit-core/src/main/java/com/onixbyte/devkit/core/exceptions/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2024-2025 OnixByte. - * - * Licensed 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. - */ - -/** - * This package contains commonly used exceptions will be used in JDevKit. - * - * @since 1.0.0 - */ -package com.onixbyte.devkit.core.exceptions; \ No newline at end of file diff --git a/devkit-core/src/main/java/com/onixbyte/devkit/core/package-info.java b/devkit-core/src/main/java/com/onixbyte/devkit/core/package-info.java deleted file mode 100644 index 919ce2b..0000000 --- a/devkit-core/src/main/java/com/onixbyte/devkit/core/package-info.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2024-2025 OnixByte. - * - * Licensed 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. - */ - -/** - * This package is the core part of JDevKit, an open-source Java Development - * Kit that provides a set of convenient tools to streamline code development - * and enhance productivity. This package serves as the core package containing - * common exceptions that are used throughout the entire JDevKit project. - *

- * JDevKit is designed to be modular, and other specific feature modules within - * the library may rely on these exceptions from the core package. - * - * @since 1.0.0 - */ -package com.onixbyte.devkit.core; \ No newline at end of file diff --git a/devkit-core/src/main/java/com/onixbyte/devkit/package-info.java b/devkit-core/src/main/java/com/onixbyte/devkit/package-info.java deleted file mode 100644 index aa57a33..0000000 --- a/devkit-core/src/main/java/com/onixbyte/devkit/package-info.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (C) 2024-2025 OnixByte. - * - * Licensed 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. - */ - -/** - * This package is the main part of JDevKit, an open-source Java class library - * that provides a set of convenient tools to streamline code development and - * enhance productivity. This package serves as the root package for several - * modules, containing {@code devkit-core}, {@code guid} and {@code dev-utils} - * module. - * - * @since 1.0.0 - */ -package com.onixbyte.devkit; \ No newline at end of file diff --git a/devkit-utils/src/main/java/com/onixbyte/devkit/utils/AesUtil.java b/devkit-utils/src/main/java/com/onixbyte/devkit/utils/AesUtil.java index 561b55e..85bb220 100644 --- a/devkit-utils/src/main/java/com/onixbyte/devkit/utils/AesUtil.java +++ b/devkit-utils/src/main/java/com/onixbyte/devkit/utils/AesUtil.java @@ -17,7 +17,8 @@ package com.onixbyte.devkit.utils; -import lombok.extern.slf4j.Slf4j; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import javax.crypto.BadPaddingException; import javax.crypto.Cipher; @@ -68,9 +69,10 @@ import java.util.UUID; * @version 1.1.0 * @since 1.1.0 */ -@Slf4j public final class AesUtil { + private final static Logger log = LoggerFactory.getLogger(AesUtil.class); + /** * Encrypts the data using the AES algorithm with the given secret. * diff --git a/devkit-utils/src/main/java/com/onixbyte/devkit/utils/Base64Util.java b/devkit-utils/src/main/java/com/onixbyte/devkit/utils/Base64Util.java index 99c773e..9dc467d 100644 --- a/devkit-utils/src/main/java/com/onixbyte/devkit/utils/Base64Util.java +++ b/devkit-utils/src/main/java/com/onixbyte/devkit/utils/Base64Util.java @@ -17,6 +17,9 @@ package com.onixbyte.devkit.utils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.util.Base64; @@ -55,6 +58,8 @@ import java.util.Objects; */ public final class Base64Util { + private final static Logger log = LoggerFactory.getLogger(Base64Util.class); + /** * Ensure that there is only one Base64 Encoder. * diff --git a/devkit-utils/src/main/java/com/onixbyte/devkit/utils/BoolUtil.java b/devkit-utils/src/main/java/com/onixbyte/devkit/utils/BoolUtil.java index 57f214f..3d70220 100644 --- a/devkit-utils/src/main/java/com/onixbyte/devkit/utils/BoolUtil.java +++ b/devkit-utils/src/main/java/com/onixbyte/devkit/utils/BoolUtil.java @@ -17,6 +17,9 @@ package com.onixbyte.devkit.utils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.util.Arrays; import java.util.Objects; import java.util.function.BooleanSupplier; @@ -44,6 +47,8 @@ import java.util.function.BooleanSupplier; */ public final class BoolUtil { + private final static Logger log = LoggerFactory.getLogger(BoolUtil.class); + /** * Logical and calculation. * diff --git a/devkit-utils/src/main/java/com/onixbyte/devkit/utils/BranchUtil.java b/devkit-utils/src/main/java/com/onixbyte/devkit/utils/BranchUtil.java index 18fea8d..354d7b2 100644 --- a/devkit-utils/src/main/java/com/onixbyte/devkit/utils/BranchUtil.java +++ b/devkit-utils/src/main/java/com/onixbyte/devkit/utils/BranchUtil.java @@ -17,6 +17,9 @@ package com.onixbyte.devkit.utils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.util.Objects; import java.util.function.BooleanSupplier; import java.util.function.Supplier; @@ -73,6 +76,8 @@ import java.util.function.Supplier; */ public final class BranchUtil { + private final static Logger log = LoggerFactory.getLogger(BranchUtil.class); + /** * Create a {@code BranchUtil} instance. * diff --git a/devkit-utils/src/main/java/com/onixbyte/devkit/utils/HashUtil.java b/devkit-utils/src/main/java/com/onixbyte/devkit/utils/HashUtil.java index 42be1ba..1006a3d 100644 --- a/devkit-utils/src/main/java/com/onixbyte/devkit/utils/HashUtil.java +++ b/devkit-utils/src/main/java/com/onixbyte/devkit/utils/HashUtil.java @@ -17,6 +17,9 @@ package com.onixbyte.devkit.utils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.security.MessageDigest; @@ -67,6 +70,8 @@ import java.util.Optional; */ public final class HashUtil { + private final static Logger log = LoggerFactory.getLogger(HashUtil.class); + /** * Calculates the MD2 hash value of the specified string using the given charset. * diff --git a/devkit-utils/src/main/java/com/onixbyte/devkit/utils/MapUtil.java b/devkit-utils/src/main/java/com/onixbyte/devkit/utils/MapUtil.java index 2fe390b..57f5b11 100644 --- a/devkit-utils/src/main/java/com/onixbyte/devkit/utils/MapUtil.java +++ b/devkit-utils/src/main/java/com/onixbyte/devkit/utils/MapUtil.java @@ -17,18 +17,17 @@ package com.onixbyte.devkit.utils; -import lombok.extern.slf4j.Slf4j; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; -import java.util.HashMap; import java.util.Map; -import java.util.Optional; /** * The {@link MapUtil} class provides utility methods for converting between objects and maps. * This class leverages the {@link ObjectMapAdapter} interface to perform the conversions. *

- * The utility methods in this class are useful for scenarios where objects need to be represented as maps for - * serialization, deserialization, or other purposes. + * The utility methods in this class are useful for scenarios where objects need to be represented + * as maps for serialization, deserialization, or other purposes. *

* *

Example usage:

@@ -84,9 +83,10 @@ import java.util.Optional; * @version 1.7.0 * @since 1.0.0 */ -@Slf4j public final class MapUtil { + private final static Logger log = LoggerFactory.getLogger(MapUtil.class); + /** * Converts an object to a map by mapping the field names to their corresponding values. * diff --git a/devkit-utils/src/main/java/com/onixbyte/devkit/utils/ObjectMapAdapter.java b/devkit-utils/src/main/java/com/onixbyte/devkit/utils/ObjectMapAdapter.java index 97b63c8..9dde1ff 100644 --- a/devkit-utils/src/main/java/com/onixbyte/devkit/utils/ObjectMapAdapter.java +++ b/devkit-utils/src/main/java/com/onixbyte/devkit/utils/ObjectMapAdapter.java @@ -24,8 +24,8 @@ import java.util.Map; * This interface is useful for scenarios where objects need to be represented as maps for * serialization, deserialization, or other purposes. * - *

Implementations of this interface should provide the logic to convert an object of type {@code T} - * to a {@link Map} and vice versa.

+ *

Implementations of this interface should provide the logic to convert an object of type + * {@code T} to a {@link Map} and vice versa.

* *

Example usage:

*
diff --git a/devkit-utils/src/main/java/com/onixbyte/devkit/utils/RangeUtil.java b/devkit-utils/src/main/java/com/onixbyte/devkit/utils/RangeUtil.java
index 7a7dd6a..faf4925 100644
--- a/devkit-utils/src/main/java/com/onixbyte/devkit/utils/RangeUtil.java
+++ b/devkit-utils/src/main/java/com/onixbyte/devkit/utils/RangeUtil.java
@@ -17,6 +17,9 @@
 
 package com.onixbyte.devkit.utils;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import java.util.stream.IntStream;
 
 /**
@@ -31,6 +34,8 @@ import java.util.stream.IntStream;
  */
 public final class RangeUtil {
 
+    private final static Logger log = LoggerFactory.getLogger(RangeUtil.class);
+
     /**
      * Private constructor prevent class being instantiated.
      */
diff --git a/devkit-utils/src/main/java/com/onixbyte/devkit/utils/package-info.java b/devkit-utils/src/main/java/com/onixbyte/devkit/utils/package-info.java
deleted file mode 100644
index e596622..0000000
--- a/devkit-utils/src/main/java/com/onixbyte/devkit/utils/package-info.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (C) 2024-2025 OnixByte.
- *
- * Licensed 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.
- */
-
-/**
- * This package is part of JDevKit, an open-source Java Development Kit that
- * provides a set of convenient tools to streamline code development and
- * enhance productivity. This package serves as the root package for the module
- * dev-utils, which contains a collection of common utility classes commonly
- * used in all Java Application development.
- *
- * @since 1.0.0
- */
-package com.onixbyte.devkit.utils;
\ No newline at end of file
diff --git a/guid/src/main/java/com/onixbyte/guid/GuidCreator.java b/guid/src/main/java/com/onixbyte/guid/GuidCreator.java
index 093049b..266c85f 100644
--- a/guid/src/main/java/com/onixbyte/guid/GuidCreator.java
+++ b/guid/src/main/java/com/onixbyte/guid/GuidCreator.java
@@ -25,8 +25,7 @@ package com.onixbyte.guid;
  * 

* *

Example usage:

- *
- * {@code
+ * 
{@code
  * public class StringGuidCreator implements GuidCreator {
  *     private final AtomicLong counter = new AtomicLong();
  *
@@ -43,8 +42,7 @@ package com.onixbyte.guid;
  *         System.out.println("Generated GUID: " + guid);
  *     }
  * }
- * }
- * 
+ * }
* * @param this represents the type of the Global Unique Identifier * @author Zihlu Wang diff --git a/guid/src/main/java/com/onixbyte/guid/exceptions/package-info.java b/guid/src/main/java/com/onixbyte/guid/exceptions/package-info.java deleted file mode 100644 index 997125c..0000000 --- a/guid/src/main/java/com/onixbyte/guid/exceptions/package-info.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2024-2025 OnixByte. - * - * Licensed 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. - */ - -/** - * This package contains the custom exception classes related to GUID generation. These exceptions - * are thrown when there are issues or errors during the generation or processing of global unique - * identifiers (GUIDs). - *

- * The main exception class in this package is {@link com.onixbyte.guid.exceptions.TimingException}, - * which is a runtime exception and serves as the base exception for all other custom exceptions - * related to GUID generation. - *

- * Custom exceptions in this package provide specific information about the type of error that - * occurred during GUID generation, making it easier for developers to handle and respond to - * different scenarios when dealing with GUIDs. They are designed to enhance the robustness and - * reliability of the GUID generation process by providing clear and meaningful error messages to - * the developers. - *

- * Developers using the GUID generation module should be aware of the possible exceptions that can - * be thrown and handle them appropriately to ensure smooth operation and error handling in - * their applications. - * - * @since 1.0.0 - */ -package com.onixbyte.guid.exceptions; \ No newline at end of file diff --git a/guid/src/main/java/com/onixbyte/guid/impl/SnowflakeGuidCreator.java b/guid/src/main/java/com/onixbyte/guid/impl/SnowflakeGuidCreator.java index 4df7203..7fab071 100644 --- a/guid/src/main/java/com/onixbyte/guid/impl/SnowflakeGuidCreator.java +++ b/guid/src/main/java/com/onixbyte/guid/impl/SnowflakeGuidCreator.java @@ -19,6 +19,8 @@ package com.onixbyte.guid.impl; import com.onixbyte.guid.GuidCreator; import com.onixbyte.guid.exceptions.TimingException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.time.LocalDateTime; import java.time.ZoneId; @@ -47,6 +49,8 @@ import java.time.ZoneId; */ public final class SnowflakeGuidCreator implements GuidCreator { + private final static Logger log = LoggerFactory.getLogger(SnowflakeGuidCreator.class); + /** * Constructs a SnowflakeGuidGenerator with the default start epoch and custom worker ID, data * centre ID. diff --git a/guid/src/main/java/com/onixbyte/guid/package-info.java b/guid/src/main/java/com/onixbyte/guid/package-info.java deleted file mode 100644 index faaf075..0000000 --- a/guid/src/main/java/com/onixbyte/guid/package-info.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 2024-2025 OnixByte. - * - * Licensed 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. - */ - -/** - * The package provides a set of tools for generating globally unique identifiers (GUIDs). - *

- * The goal of this library is to provide an efficient, reliable way to generate globally unique - * identifiers without requiring any specific environment or configuration. - *

- * Key features include: - *

    - *
  • Efficient generation of globally unique identifiers
  • - *
  • High performance and quick response
  • - *
  • Easy to integrate
  • - *
- * - * @since 1.0.0 - */ -package com.onixbyte.guid; \ No newline at end of file diff --git a/key-pair-loader/src/main/java/com/onixbyte/security/KeyLoader.java b/key-pair-loader/src/main/java/com/onixbyte/security/KeyLoader.java index 9de2a05..b8fb3f1 100644 --- a/key-pair-loader/src/main/java/com/onixbyte/security/KeyLoader.java +++ b/key-pair-loader/src/main/java/com/onixbyte/security/KeyLoader.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024-2024 OnixByte. + * Copyright (C) 2024-2025 OnixByte. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,8 @@ package com.onixbyte.security; import com.onixbyte.security.exception.KeyLoadingException; -import lombok.extern.slf4j.Slf4j; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.security.KeyFactory; import java.security.NoSuchAlgorithmException; @@ -38,8 +39,7 @@ import java.util.Base64; *

* *

Example usage:

- *
- * {@code
+ * 
{@code
  * String pemPrivateKey = """
  *                        -----BEGIN PRIVATE KEY-----
  *                        ...
@@ -51,16 +51,16 @@ import java.util.Base64;
  *                       ...
  *                       -----END PUBLIC KEY-----""";
  * ECPublicKey publicKey = KeyLoader.loadEcdsaPublicKey(pemPublicKey);
- * }
- * 
+ * }
* * @author zihluwang * @version 1.6.0 * @since 1.6.0 */ -@Slf4j public class KeyLoader { + private final static Logger log = LoggerFactory.getLogger(KeyLoader.class); + /** * Private constructor prevents from being initialised. */ diff --git a/key-pair-loader/src/main/java/com/onixbyte/security/exception/KeyLoadingException.java b/key-pair-loader/src/main/java/com/onixbyte/security/exception/KeyLoadingException.java index 49715d8..853f203 100644 --- a/key-pair-loader/src/main/java/com/onixbyte/security/exception/KeyLoadingException.java +++ b/key-pair-loader/src/main/java/com/onixbyte/security/exception/KeyLoadingException.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024-2024 OnixByte. + * Copyright (C) 2024-2025 OnixByte. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,25 +18,23 @@ package com.onixbyte.security.exception; /** - * The {@code KeyLoadingException} class represents an exception that is thrown when there is an error - * loading cryptographic keys. This exception can be used to indicate various issues such as invalid key - * specifications, unsupported key algorithms, or other key loading errors. + * The {@code KeyLoadingException} class represents an exception that is thrown when there is an + * error loading cryptographic keys. This exception can be used to indicate various issues such as + * invalid key specifications, unsupported key algorithms, or other key loading errors. *

- * This class extends {@link RuntimeException}, allowing it to be thrown without being declared in a method's - * {@code throws} clause. + * This class extends {@link RuntimeException}, allowing it to be thrown without being declared in + * a method's {@code throws} clause. *

* *

Example usage:

- *
- * {@code
+ * 
{@code
  * try {
  *     ECPrivateKey privateKey = KeyLoader.loadEcdsaPrivateKey(pemPrivateKey);
  * } catch (KeyLoadingException e) {
  *     // Handle the exception
  *     e.printStackTrace();
  * }
- * }
- * 
+ * }
* * @author zihluwang * @version 1.6.0 diff --git a/map-util-unsafe/src/main/java/com/onixbyte/devkit/utils/unsafe/ReflectMapUtil.java b/map-util-unsafe/src/main/java/com/onixbyte/devkit/utils/unsafe/ReflectMapUtil.java index 48dc048..74f8464 100644 --- a/map-util-unsafe/src/main/java/com/onixbyte/devkit/utils/unsafe/ReflectMapUtil.java +++ b/map-util-unsafe/src/main/java/com/onixbyte/devkit/utils/unsafe/ReflectMapUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 OnixByte. + * Copyright (C) 2024-2025 OnixByte. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,8 @@ package com.onixbyte.devkit.utils.unsafe; -import lombok.extern.slf4j.Slf4j; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.lang.reflect.InvocationTargetException; import java.util.HashMap; @@ -66,9 +67,10 @@ import java.util.Map; * @version 1.4.2 * @since 1.4.2 */ -@Slf4j public final class ReflectMapUtil { + private final static Logger log = LoggerFactory.getLogger(ReflectMapUtil.class); + /** * Converts an object to a map by mapping the field names to their corresponding values. * diff --git a/num4j/src/main/java/com/onixbyte/nums/ChainedCalcUtil.java b/num4j/src/main/java/com/onixbyte/nums/ChainedCalcUtil.java index 27242c9..62a7f61 100644 --- a/num4j/src/main/java/com/onixbyte/nums/ChainedCalcUtil.java +++ b/num4j/src/main/java/com/onixbyte/nums/ChainedCalcUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024-2024 OnixByte. + * Copyright (C) 2024-2025 OnixByte. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,8 @@ package com.onixbyte.nums; -import lombok.Getter; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.math.BigDecimal; import java.math.RoundingMode; @@ -90,9 +91,10 @@ import java.util.function.Function; * @see BigDecimal * @since 1.0.0 */ -@Getter public final class ChainedCalcUtil { + private final static Logger log = LoggerFactory.getLogger(ChainedCalcUtil.class); + /** * Creates a {@code ChainedCalcUtil} instance with the specified initial value. * @@ -235,6 +237,15 @@ public final class ChainedCalcUtil { return value.setScale(scale, RoundingMode.HALF_UP); } + /** + * Returns the current value as a {@link BigDecimal}. + * + * @return the current value as a {@link BigDecimal} + */ + public BigDecimal getValue() { + return value; + } + /** * Returns the current value as a {@link Double}. * @@ -297,7 +308,7 @@ public final class ChainedCalcUtil { Object other, Integer beforeOperateScale) { return baseOperator((otherValue) -> - operator.apply(this.value, otherValue), + operator.apply(this.value, otherValue), other, beforeOperateScale); } diff --git a/num4j/src/main/java/com/onixbyte/nums/PercentileCalculator.java b/num4j/src/main/java/com/onixbyte/nums/PercentileCalculator.java index b28f397..e351e5a 100644 --- a/num4j/src/main/java/com/onixbyte/nums/PercentileCalculator.java +++ b/num4j/src/main/java/com/onixbyte/nums/PercentileCalculator.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 OnixByte. + * Copyright (C) 2024-2025 OnixByte. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,9 +14,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.onixbyte.nums; import com.onixbyte.nums.model.QuartileBounds; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.List; @@ -48,6 +51,8 @@ import java.util.List; */ public final class PercentileCalculator { + private final static Logger log = LoggerFactory.getLogger(PercentileCalculator.class); + /** * Private constructor prevents from being initialised. */ diff --git a/num4j/src/main/java/com/onixbyte/nums/model/QuartileBounds.java b/num4j/src/main/java/com/onixbyte/nums/model/QuartileBounds.java index fa5c85f..5daf4f8 100644 --- a/num4j/src/main/java/com/onixbyte/nums/model/QuartileBounds.java +++ b/num4j/src/main/java/com/onixbyte/nums/model/QuartileBounds.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024-2024 OnixByte. + * Copyright (C) 2024-2025 OnixByte. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/property-guard-spring-boot-starter/src/main/java/com/onixbyte/propertyguard/autoconfiguration/PropertyGuard.java b/property-guard-spring-boot-starter/src/main/java/com/onixbyte/propertyguard/autoconfiguration/PropertyGuard.java index ee779a3..8ed227a 100644 --- a/property-guard-spring-boot-starter/src/main/java/com/onixbyte/propertyguard/autoconfiguration/PropertyGuard.java +++ b/property-guard-spring-boot-starter/src/main/java/com/onixbyte/propertyguard/autoconfiguration/PropertyGuard.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024-2024 OnixByte. + * Copyright (C) 2024-2025 OnixByte. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,8 @@ package com.onixbyte.propertyguard.autoconfiguration; import com.onixbyte.devkit.utils.AesUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.boot.SpringApplication; import org.springframework.boot.env.EnvironmentPostProcessor; import org.springframework.boot.env.OriginTrackedMapPropertySource; @@ -65,6 +67,8 @@ import java.util.Optional; */ public class PropertyGuard implements EnvironmentPostProcessor { + private final static Logger log = LoggerFactory.getLogger(PropertyGuard.class); + /** * Create a {@link PropertyGuard} instance. */ diff --git a/simple-jwt-authzero/src/main/java/com/onixbyte/simplejwt/authzero/AuthzeroTokenResolver.java b/simple-jwt-authzero/src/main/java/com/onixbyte/simplejwt/authzero/AuthzeroTokenResolver.java index 8e6b308..51e0267 100644 --- a/simple-jwt-authzero/src/main/java/com/onixbyte/simplejwt/authzero/AuthzeroTokenResolver.java +++ b/simple-jwt-authzero/src/main/java/com/onixbyte/simplejwt/authzero/AuthzeroTokenResolver.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024-2024 OnixByte. + * Copyright (C) 2024-2025 OnixByte. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,7 +38,8 @@ import com.fasterxml.jackson.databind.node.ObjectNode; import com.onixbyte.simplejwt.exceptions.IllegalKeyPairException; import com.onixbyte.simplejwt.exceptions.IllegalSecretException; import com.onixbyte.simplejwt.exceptions.UnsupportedAlgorithmException; -import lombok.extern.slf4j.Slf4j; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.lang.reflect.InvocationTargetException; import java.security.interfaces.ECPrivateKey; @@ -98,9 +99,10 @@ import java.util.function.Function; * @see JWTCreator.Builder * @since 1.0.0 */ -@Slf4j public class AuthzeroTokenResolver implements TokenResolver { + private final static Logger log = LoggerFactory.getLogger(AuthzeroTokenResolver.class); + /** * Create a builder of {@link AuthzeroTokenResolver}. * diff --git a/simple-jwt-authzero/src/main/java/com/onixbyte/simplejwt/authzero/package-info.java b/simple-jwt-authzero/src/main/java/com/onixbyte/simplejwt/authzero/package-info.java deleted file mode 100644 index d9832ff..0000000 --- a/simple-jwt-authzero/src/main/java/com/onixbyte/simplejwt/authzero/package-info.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2024-2024 OnixByte. - * - * Licensed 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. - */ - -/** - * This package contains classes related to the integration of the {@code com.auth0:java-jwt} - * library in the Simple JWT project. {@code com.auth0:java-jwt} is a powerful and widely-used - * identity as a Service (IDaaS) platform that provides secure authentication and authorisation - * solutions for web and mobile applications. The classes in this package provide the necessary - * functionality to handle JSON Web Tokens (JWTs) using the {@code com.auth0:java-jwt} library. - *

- * The main class in this package is the {@link - * com.onixbyte.simplejwt.authzero.AuthzeroTokenResolver}, which implements the - * {@link com.onixbyte.simplejwt.TokenResolver} interface and uses the {@code com.auth0:java-jwt} - * library to handle JWT operations. It provides the functionality to create, validate, and extract - * JWTs using the {@code com.auth0:java-jwt} library. Developers can use this class as the main - * token resolver in the Simple JWT project when integrating {@code com.auth0:java-jwt} as the - * JWT management library. - *

- * The {@link com.onixbyte.simplejwt.authzero.AuthzeroTokenResolver} relies on the - * {@code com.auth0:java-jwt} library to handle the underlying JWT operations, including token - * creation, validation, and extraction. It utilizes the {@code com.auth0:java-jwt} - * {@link com.auth0.jwt.algorithms.Algorithm} class to define and use different algorithms for - * JWT signing and verification. - *

- * Developers using the {@code com.auth0:java-jwt} integration should be familiar with the concepts - * and usage of the {@code com.auth0:java-jwt} library and follow the official - * {@code com.auth0:java-jwt} documentation for best practices and security considerations. - * - * @since 1.0.0 - */ -package com.onixbyte.simplejwt.authzero; \ No newline at end of file diff --git a/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/SecretCreator.java b/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/SecretCreator.java index 0734540..831bc88 100644 --- a/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/SecretCreator.java +++ b/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/SecretCreator.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024-2024 OnixByte. + * Copyright (C) 2024-2025 OnixByte. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,8 @@ package com.onixbyte.simplejwt; import com.onixbyte.simplejwt.exceptions.WeakSecretException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.Random; @@ -32,6 +34,8 @@ import java.util.Random; */ public final class SecretCreator { + private final static Logger log = LoggerFactory.getLogger(SecretCreator.class); + /** * Generates a secure secret with the specified length and character sets. * diff --git a/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/TokenPayload.java b/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/TokenPayload.java index cecc74a..1234c6c 100644 --- a/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/TokenPayload.java +++ b/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/TokenPayload.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024-2024 OnixByte. + * Copyright (C) 2024-2025 OnixByte. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,8 +17,6 @@ package com.onixbyte.simplejwt; -import java.util.Map; - /** * {@code TokenPayload} interface is used to mark a data class as suitable * for being used as the payload in a JSON Web Token (JWT). Any class @@ -44,7 +42,4 @@ import java.util.Map; * @since 1.0.0 */ public interface TokenPayload { - - // Marker interface for JWT payload data classes - } diff --git a/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/TokenResolver.java b/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/TokenResolver.java index c0d51f5..c2ea124 100644 --- a/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/TokenResolver.java +++ b/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/TokenResolver.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024-2024 OnixByte. + * Copyright (C) 2024-2025 OnixByte. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/annotations/ExcludeFromPayload.java b/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/annotations/ExcludeFromPayload.java index 2bda34a..0253755 100644 --- a/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/annotations/ExcludeFromPayload.java +++ b/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/annotations/ExcludeFromPayload.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024-2024 OnixByte. + * Copyright (C) 2024-2025 OnixByte. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/annotations/TokenEnum.java b/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/annotations/TokenEnum.java index d0823c9..ffb5e2f 100644 --- a/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/annotations/TokenEnum.java +++ b/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/annotations/TokenEnum.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024-2024 OnixByte. + * Copyright (C) 2024-2025 OnixByte. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/annotations/package-info.java b/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/annotations/package-info.java deleted file mode 100644 index 16bf17d..0000000 --- a/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/annotations/package-info.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (C) 2024-2024 OnixByte. - * - * Licensed 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. - */ - -/** - * This package contains annotation classes that are used to prevent annotated - * properties from being automatically injected into the JSON Web Token (JWT) - * payload during token generation. These annotations can be applied to - * properties of a data class to exclude them from being included as part - * of the JWT payload. - * - * @since 1.0.0 - */ -package com.onixbyte.simplejwt.annotations; \ No newline at end of file diff --git a/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/constants/PredefinedKeys.java b/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/constants/PredefinedKeys.java index c531d56..9dc480a 100644 --- a/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/constants/PredefinedKeys.java +++ b/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/constants/PredefinedKeys.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024-2024 OnixByte. + * Copyright (C) 2024-2025 OnixByte. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/constants/TokenAlgorithm.java b/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/constants/TokenAlgorithm.java index a0dc86b..21d34c2 100644 --- a/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/constants/TokenAlgorithm.java +++ b/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/constants/TokenAlgorithm.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024-2024 OnixByte. + * Copyright (C) 2024-2025 OnixByte. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,8 +17,6 @@ package com.onixbyte.simplejwt.constants; -import lombok.Getter; - import java.util.List; /** @@ -45,7 +43,6 @@ import java.util.List; * @version 1.1.0 * @since 1.0.0 */ -@Getter public enum TokenAlgorithm { /** diff --git a/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/constants/TokenDataType.java b/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/constants/TokenDataType.java index f86edc5..187b2e9 100644 --- a/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/constants/TokenDataType.java +++ b/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/constants/TokenDataType.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024-2024 OnixByte. + * Copyright (C) 2024-2025 OnixByte. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,14 +17,11 @@ package com.onixbyte.simplejwt.constants; -import lombok.Getter; - /** * The base data types used to process enum data. * * @author Zihlu Wang */ -@Getter public enum TokenDataType { /** @@ -70,4 +67,12 @@ public enum TokenDataType { this.mappedClass = mappedClass; } + /** + * Return the target mapped class. + * + * @return mapped class + */ + public Class getMappedClass() { + return mappedClass; + } } diff --git a/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/constants/package-info.java b/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/constants/package-info.java deleted file mode 100644 index b1f1aed..0000000 --- a/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/constants/package-info.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2024-2024 OnixByte. - * - * Licensed 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. - */ - -/** - * This package contains constant values related to JSON Web Token (JWT) - * processing. These constants define various aspects of JWT, such as the - * algorithms being used for token signing and verification, and other - * configuration parameters. - * - * @since 1.0.0 - */ -package com.onixbyte.simplejwt.constants; \ No newline at end of file diff --git a/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/exceptions/IllegalKeyPairException.java b/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/exceptions/IllegalKeyPairException.java index 0b725dd..55959ce 100644 --- a/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/exceptions/IllegalKeyPairException.java +++ b/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/exceptions/IllegalKeyPairException.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024-2024 OnixByte. + * Copyright (C) 2024-2025 OnixByte. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/exceptions/IllegalSecretException.java b/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/exceptions/IllegalSecretException.java index 6722ebd..3ade2f2 100644 --- a/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/exceptions/IllegalSecretException.java +++ b/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/exceptions/IllegalSecretException.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024-2024 OnixByte. + * Copyright (C) 2024-2025 OnixByte. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/exceptions/UnsupportedAlgorithmException.java b/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/exceptions/UnsupportedAlgorithmException.java index 940d3ae..c626e40 100644 --- a/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/exceptions/UnsupportedAlgorithmException.java +++ b/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/exceptions/UnsupportedAlgorithmException.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024-2024 OnixByte. + * Copyright (C) 2024-2025 OnixByte. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/exceptions/WeakSecretException.java b/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/exceptions/WeakSecretException.java index e1f678e..a7a57e7 100644 --- a/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/exceptions/WeakSecretException.java +++ b/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/exceptions/WeakSecretException.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024-2024 OnixByte. + * Copyright (C) 2024-2025 OnixByte. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/exceptions/package-info.java b/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/exceptions/package-info.java deleted file mode 100644 index 8bfa97b..0000000 --- a/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/exceptions/package-info.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2024-2024 OnixByte. - * - * Licensed 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. - */ - -/** - * The {@code cn.org.codecrafters.simplejwt.exceptions} package contains - * custom exception classes related to the - * {@code cn.org.codecrafters:simple-jwt-facade} library. These exceptions are - * thrown when there are issues or errors during the generation , validation, - * or processing of JSON Web Tokens (JWTs) in Java applications. - *

- * Custom exception classes in this package are designed to enhance the - * robustness and reliability of the JWT handling process by providing clear - * and meaningful error messages to the developers. They help developers - * identify and troubleshoot issues related to JWT generation, validation, or - * extraction and ensure smooth operation and error handling in - * their applications. - *

- * Developers using the {@code cn.org.codecrafters:simple-jwt-facade} library - * should be aware of the possible exceptions that can be thrown and handle - * them appropriately to ensure secure and reliable JWT handling in their - * Java applications. - * - * @since 1.0.0 - */ -package com.onixbyte.simplejwt.exceptions; \ No newline at end of file diff --git a/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/package-info.java b/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/package-info.java deleted file mode 100644 index 2d203b3..0000000 --- a/simple-jwt-facade/src/main/java/com/onixbyte/simplejwt/package-info.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2024-2024 OnixByte. - * - * Licensed 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. - */ - -/** - * The {@code cn.org.codecrafters.simplejwt} package is the core package of the - * Simple JWT project, which provides a lightweight and easy-to-use - * library for working with JSON Web Tokens (JWTs) in Java applications. JWT is - * a widely-used standard for representing claims between two parties, - * typically used to secure web and mobile applications. This library aims to - * simplify the JWT handling process and provide convenient abstractions for - * JWT generation, validation, and extraction. - *

- * The Simple JWT library is designed to be flexible and customisable, - * allowing developers to use different algorithms, token resolvers, and token - * payload classes based on their specific application requirements. It aims to - * simplify the JWT handling process while maintaining security and best - * practices for working with JWTs. - *

- * Developers should refer to the official documentation and examples for the - * Simple JWT project to understand how to use the library effectively - * and securely in their Java applications. - * - * - * @since 1.0.0 - */ -package com.onixbyte.simplejwt; \ No newline at end of file diff --git a/simple-jwt-spring-boot-starter/src/main/java/com/onixbyte/simplejwt/autoconfiguration/AuthzeroTokenResolverAutoConfiguration.java b/simple-jwt-spring-boot-starter/src/main/java/com/onixbyte/simplejwt/autoconfiguration/AuthzeroTokenResolverAutoConfiguration.java index 9d93d5b..dd30bde 100644 --- a/simple-jwt-spring-boot-starter/src/main/java/com/onixbyte/simplejwt/autoconfiguration/AuthzeroTokenResolverAutoConfiguration.java +++ b/simple-jwt-spring-boot-starter/src/main/java/com/onixbyte/simplejwt/autoconfiguration/AuthzeroTokenResolverAutoConfiguration.java @@ -24,7 +24,8 @@ import com.onixbyte.simplejwt.autoconfiguration.properties.SimpleJwtProperties; import com.auth0.jwt.interfaces.DecodedJWT; import com.fasterxml.jackson.databind.ObjectMapper; import com.onixbyte.simplejwt.constants.TokenAlgorithm; -import lombok.extern.slf4j.Slf4j; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.autoconfigure.AutoConfiguration; @@ -55,7 +56,6 @@ import org.springframework.context.annotation.Bean; * @version 1.6.0 * @since 1.0.0 */ -@Slf4j @AutoConfiguration @EnableConfigurationProperties(value = {SimpleJwtProperties.class}) @ConditionalOnClass({DecodedJWT.class, AuthzeroTokenResolver.class}) @@ -64,6 +64,8 @@ import org.springframework.context.annotation.Bean; @AutoConfigureAfter(value = GuidAutoConfiguration.class) public class AuthzeroTokenResolverAutoConfiguration { + private final static Logger log = LoggerFactory.getLogger(AuthzeroTokenResolverAutoConfiguration.class); + /** * Constructs a new {@code SimpleJwtAutoConfiguration} instance with the * provided SimpleJwtProperties. diff --git a/simple-jwt-spring-boot-starter/src/main/java/com/onixbyte/simplejwt/autoconfiguration/GuidAutoConfiguration.java b/simple-jwt-spring-boot-starter/src/main/java/com/onixbyte/simplejwt/autoconfiguration/GuidAutoConfiguration.java index 01691a0..149aabf 100644 --- a/simple-jwt-spring-boot-starter/src/main/java/com/onixbyte/simplejwt/autoconfiguration/GuidAutoConfiguration.java +++ b/simple-jwt-spring-boot-starter/src/main/java/com/onixbyte/simplejwt/autoconfiguration/GuidAutoConfiguration.java @@ -19,7 +19,8 @@ package com.onixbyte.simplejwt.autoconfiguration; import com.onixbyte.guid.GuidCreator; import com.onixbyte.simplejwt.autoconfiguration.conditions.GuidCreatorCondition; -import lombok.extern.slf4j.Slf4j; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Conditional; @@ -33,10 +34,11 @@ import java.util.UUID; * @version 1.1.0 * @since 1.0.0 */ -@Slf4j @AutoConfiguration public class GuidAutoConfiguration { + private final static Logger log = LoggerFactory.getLogger(GuidAutoConfiguration.class); + /** * Default constructor. */ diff --git a/simple-jwt-spring-boot-starter/src/main/java/com/onixbyte/simplejwt/autoconfiguration/conditions/GuidCreatorCondition.java b/simple-jwt-spring-boot-starter/src/main/java/com/onixbyte/simplejwt/autoconfiguration/conditions/GuidCreatorCondition.java index 3e548be..ff0410a 100644 --- a/simple-jwt-spring-boot-starter/src/main/java/com/onixbyte/simplejwt/autoconfiguration/conditions/GuidCreatorCondition.java +++ b/simple-jwt-spring-boot-starter/src/main/java/com/onixbyte/simplejwt/autoconfiguration/conditions/GuidCreatorCondition.java @@ -18,7 +18,8 @@ package com.onixbyte.simplejwt.autoconfiguration.conditions; import com.onixbyte.guid.GuidCreator; -import lombok.extern.slf4j.Slf4j; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.context.annotation.Condition; import org.springframework.context.annotation.ConditionContext; import org.springframework.core.type.AnnotatedTypeMetadata; @@ -32,9 +33,10 @@ import java.util.Objects; * @version 1.1.0 * @since 1.0.0 */ -@Slf4j public class GuidCreatorCondition implements Condition { + private final static Logger log = LoggerFactory.getLogger(GuidCreatorCondition.class); + /** * Default constructor. */ diff --git a/simple-jwt-spring-boot-starter/src/main/java/com/onixbyte/simplejwt/autoconfiguration/package-info.java b/simple-jwt-spring-boot-starter/src/main/java/com/onixbyte/simplejwt/autoconfiguration/package-info.java deleted file mode 100644 index 72e757c..0000000 --- a/simple-jwt-spring-boot-starter/src/main/java/com/onixbyte/simplejwt/autoconfiguration/package-info.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2024-2025 OnixByte. - * - * Licensed 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. - */ - -/** - *

- * The classes in this package are responsible for automatically configuring - * the Simple JWT library when it is used in a Spring Boot application. They - * provide default settings and configurations to ensure that the library works - * smoothly and seamlessly without requiring developers to manually configure - * it. - * - * - *

- * Developers using the Simple JWT library with Spring Boot do not need to - * explicitly configure the library, as the auto-configuration classes take - * care of setting up the necessary components and configurations - * automatically. However, developers still have the flexibility to customize - * the behavior of the library by providing their own configurations and - * properties. - * - * - * @since 1.0.0 - */ -package com.onixbyte.simplejwt.autoconfiguration; \ No newline at end of file diff --git a/simple-jwt-spring-boot-starter/src/main/java/com/onixbyte/simplejwt/autoconfiguration/properties/SimpleJwtProperties.java b/simple-jwt-spring-boot-starter/src/main/java/com/onixbyte/simplejwt/autoconfiguration/properties/SimpleJwtProperties.java index be23582..826d108 100644 --- a/simple-jwt-spring-boot-starter/src/main/java/com/onixbyte/simplejwt/autoconfiguration/properties/SimpleJwtProperties.java +++ b/simple-jwt-spring-boot-starter/src/main/java/com/onixbyte/simplejwt/autoconfiguration/properties/SimpleJwtProperties.java @@ -20,7 +20,6 @@ package com.onixbyte.simplejwt.autoconfiguration.properties; import com.onixbyte.simplejwt.SecretCreator; import com.onixbyte.simplejwt.autoconfiguration.AuthzeroTokenResolverAutoConfiguration; import com.onixbyte.simplejwt.constants.TokenAlgorithm; -import lombok.Data; import org.springframework.boot.context.properties.ConfigurationProperties; /** @@ -42,7 +41,6 @@ import org.springframework.boot.context.properties.ConfigurationProperties; * @version 1.1.0 * @since 1.0.0 */ -@Data @ConfigurationProperties(prefix = "onixbyte.simple-jwt") public class SimpleJwtProperties { @@ -79,5 +77,94 @@ public class SimpleJwtProperties { */ private String publicKey; + /** + * Algorithm getter. + * + * @return algorithm + */ + public TokenAlgorithm getAlgorithm() { + return algorithm; + } + + /** + * Algorithm setter. + * + * @param algorithm the algorithm + */ + public void setAlgorithm(TokenAlgorithm algorithm) { + this.algorithm = algorithm; + } + + /** + * Issuer getter. + * + * @return issuer + */ + public String getIssuer() { + return issuer; + } + + /** + * Issuer setter. + * + * @param issuer the issuer + */ + public void setIssuer(String issuer) { + this.issuer = issuer; + } + + /** + * Secret setter. + * + * @return secret + */ + public String getSecret() { + return secret; + } + + /** + * Secret setter. + * + * @param secret the secret + */ + public void setSecret(String secret) { + this.secret = secret; + } + + /** + * Private key getter. + * + * @return private key + */ + public String getPrivateKey() { + return privateKey; + } + + /** + * Private key setter. + * + * @param privateKey private key + */ + public void setPrivateKey(String privateKey) { + this.privateKey = privateKey; + } + + /** + * Public key getter. + * + * @return public key + */ + public String getPublicKey() { + return publicKey; + } + + /** + * Public key setter. + * + * @param publicKey public key + */ + public void setPublicKey(String publicKey) { + this.publicKey = publicKey; + } } diff --git a/simple-jwt-spring-boot-starter/src/main/java/com/onixbyte/simplejwt/autoconfiguration/properties/package-info.java b/simple-jwt-spring-boot-starter/src/main/java/com/onixbyte/simplejwt/autoconfiguration/properties/package-info.java deleted file mode 100644 index ff0f7ca..0000000 --- a/simple-jwt-spring-boot-starter/src/main/java/com/onixbyte/simplejwt/autoconfiguration/properties/package-info.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2024-2025 OnixByte. - * - * Licensed 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. - */ - -/** - * The "cn.org.codecrafters.simplejwt.autoconfiguration.properties" package - * contains configuration properties classes used for Simple JWT library - * autoconfiguration. These classes define the properties that can be - * configured in the application's properties file (e.g., - * application.properties) to customize the behavior and settings of the Simple - * JWT library. - *

- * Developers can customize the JWT algorithm, issuer, and secret by setting - * the corresponding properties in the application's properties file with the - * prefix "code-crafters.simple-jwt". The SimpleJwtAutoConfiguration class - * reads these properties and uses them to create the {@link - * com.onixbyte.simplejwt.TokenResolver} bean with the desired - * configuration. - * - * @since 1.0.0 - */ -package com.onixbyte.simplejwt.autoconfiguration.properties; \ No newline at end of file