feat: Moved package name from cn.org.codecrafters to com.onixbyte

This commit is contained in:
Zihlu Wang
2024-04-26 01:50:46 +08:00
parent 65287d0b24
commit 8dd0dad8d9
66 changed files with 180 additions and 188 deletions
@@ -15,34 +15,29 @@
* limitations under the License.
*/
package cn.org.codecrafters.simplejwt.authzero;
package com.onixbyte.simplejwt.authzero;
import cn.org.codecrafters.devkit.utils.Base64Util;
import cn.org.codecrafters.guid.GuidCreator;
import cn.org.codecrafters.simplejwt.SecretCreator;
import cn.org.codecrafters.simplejwt.TokenPayload;
import cn.org.codecrafters.simplejwt.TokenResolver;
import cn.org.codecrafters.simplejwt.annotations.ExcludeFromPayload;
import cn.org.codecrafters.simplejwt.annotations.TokenEnum;
import cn.org.codecrafters.simplejwt.authzero.config.AuthzeroTokenResolverConfig;
import cn.org.codecrafters.simplejwt.config.TokenResolverConfig;
import cn.org.codecrafters.simplejwt.constants.PredefinedKeys;
import cn.org.codecrafters.simplejwt.constants.TokenAlgorithm;
import com.onixbyte.devkit.utils.Base64Util;
import com.onixbyte.guid.GuidCreator;
import com.onixbyte.simplejwt.SecretCreator;
import com.onixbyte.simplejwt.TokenPayload;
import com.onixbyte.simplejwt.TokenResolver;
import com.onixbyte.simplejwt.annotations.ExcludeFromPayload;
import com.onixbyte.simplejwt.annotations.TokenEnum;
import com.onixbyte.simplejwt.authzero.config.AuthzeroTokenResolverConfig;
import com.onixbyte.simplejwt.constants.PredefinedKeys;
import com.onixbyte.simplejwt.constants.TokenAlgorithm;
import com.auth0.jwt.JWT;
import com.auth0.jwt.JWTCreator;
import com.auth0.jwt.algorithms.Algorithm;
import com.auth0.jwt.interfaces.Claim;
import com.auth0.jwt.interfaces.DecodedJWT;
import com.auth0.jwt.interfaces.JWTVerifier;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import lombok.extern.slf4j.Slf4j;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.time.Duration;
import java.time.LocalDateTime;
@@ -51,7 +46,7 @@ import java.util.*;
/**
* The {@code AuthzeroTokenResolver} class is an implementation of the {@link
* cn.org.codecrafters.simplejwt.TokenResolver} interface. It uses the {@code
* TokenResolver} interface. It uses the {@code
* com.auth0:java-jwt} library to handle JSON Web Token (JWT) resolution. This
* resolver provides functionality to create, extract, verify, and renew JWT
* tokens using various algorithms and custom payload data.
@@ -15,13 +15,13 @@
* limitations under the License.
*/
package cn.org.codecrafters.simplejwt.authzero.config;
package com.onixbyte.simplejwt.authzero.config;
import cn.org.codecrafters.simplejwt.TokenResolver;
import cn.org.codecrafters.simplejwt.authzero.AuthzeroTokenResolver;
import cn.org.codecrafters.simplejwt.config.TokenResolverConfig;
import cn.org.codecrafters.simplejwt.constants.TokenAlgorithm;
import cn.org.codecrafters.simplejwt.exceptions.UnsupportedAlgorithmException;
import com.onixbyte.simplejwt.TokenResolver;
import com.onixbyte.simplejwt.authzero.AuthzeroTokenResolver;
import com.onixbyte.simplejwt.config.TokenResolverConfig;
import com.onixbyte.simplejwt.constants.TokenAlgorithm;
import com.onixbyte.simplejwt.exceptions.UnsupportedAlgorithmException;
import com.auth0.jwt.algorithms.Algorithm;
import java.util.HashMap;
@@ -18,37 +18,37 @@
/**
* The package {@code cn.org.codecrafters.simplejwt.authzero.config} contains
* configuration classes related to the {@link
* cn.org.codecrafters.simplejwt.authzero.AuthzeroTokenResolver}
* com.onixbyte.simplejwt.authzero.AuthzeroTokenResolver}
* implementation.
* <p>
* The classes in this package provide configuration options and settings for
* the {@link cn.org.codecrafters.simplejwt.authzero.AuthzeroTokenResolver},
* the {@link com.onixbyte.simplejwt.authzero.AuthzeroTokenResolver},
* which is used for resolving JSON Web Tokens (JWT) using the Auth0 library.
* <p>
* The {@link
* cn.org.codecrafters.simplejwt.authzero.config.AuthzeroTokenResolverConfig}
* com.onixbyte.simplejwt.authzero.config.AuthzeroTokenResolverConfig}
* class is a configuration class that defines the mapping between standard
* {@link cn.org.codecrafters.simplejwt.constants.TokenAlgorithm} and the
* {@link com.onixbyte.simplejwt.constants.TokenAlgorithm} and the
* corresponding function implementation used by {@link
* cn.org.codecrafters.simplejwt.authzero.AuthzeroTokenResolver} for handling
* com.onixbyte.simplejwt.authzero.AuthzeroTokenResolver} for handling
* JWT algorithms. It enables developers to specify and customize the
* algorithm functions according to the chosen JWT algorithm and the library
* being used.
* <p>
* The configuration options in this package help developers integrate and
* configure the {@link
* cn.org.codecrafters.simplejwt.authzero.AuthzeroTokenResolver} seamlessly
* com.onixbyte.simplejwt.authzero.AuthzeroTokenResolver} seamlessly
* into their Spring Boot applications. Developers can fine-tune the token
* resolution process and customize algorithm handling to align with their
* specific requirements and desired level of security.
* <p>
* It is recommended to explore the classes in this package to understand how
* to configure and use the {@link
* cn.org.codecrafters.simplejwt.authzero.AuthzeroTokenResolver} effectively
* com.onixbyte.simplejwt.authzero.AuthzeroTokenResolver} effectively
* in the Spring Boot environment to handle JWT authentication and
* authorisation securely and efficiently.
*
* @since 1.0.0
*/
package cn.org.codecrafters.simplejwt.authzero.config;
package com.onixbyte.simplejwt.authzero.config;
@@ -25,15 +25,15 @@
* the {@code com.auth0:java-jwt} library.
* <p>
* The main class in this package is the {@link
* cn.org.codecrafters.simplejwt.authzero.AuthzeroTokenResolver}, which
* implements the {@link cn.org.codecrafters.simplejwt.TokenResolver} interface
* 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.
* <p>
* The {@link cn.org.codecrafters.simplejwt.authzero.AuthzeroTokenResolver}
* 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
@@ -41,12 +41,12 @@
* algorithms for JWT signing and verification.
* <p>
* To use the {@link
* cn.org.codecrafters.simplejwt.authzero.AuthzeroTokenResolver}, developers
* com.onixbyte.simplejwt.authzero.AuthzeroTokenResolver}, developers
* must provide the necessary configurations and dependencies, such as the
* {@link cn.org.codecrafters.guid.GuidCreator} for generating unique JWT IDs
* {@link com.onixbyte.guid.GuidCreator} for generating unique JWT IDs
* (JTI), the supported algorithm function, the issuer name, and the secret key
* used for token signing and validation. The {@link
* cn.org.codecrafters.simplejwt.authzero.config.AuthzeroTokenResolverConfig}
* com.onixbyte.simplejwt.authzero.config.AuthzeroTokenResolverConfig}
* class provides a convenient way to configure these dependencies.
* <p>
* Developers using the {@code com.auth0:java-jwt} integration should be
@@ -56,4 +56,4 @@
*
* @since 1.0.0
*/
package cn.org.codecrafters.simplejwt.authzero;
package com.onixbyte.simplejwt.authzero;
@@ -15,10 +15,10 @@
* limitations under the License.
*/
package cn.org.codecrafters.simplejwt.authzero.test;
package com.onixbyte.simplejwt.authzero.test;
import cn.org.codecrafters.simplejwt.authzero.AuthzeroTokenResolver;
import cn.org.codecrafters.simplejwt.constants.TokenAlgorithm;
import com.onixbyte.simplejwt.authzero.AuthzeroTokenResolver;
import com.onixbyte.simplejwt.constants.TokenAlgorithm;
import org.junit.jupiter.api.Test;
import java.time.Duration;