doc(simple-jwt): Optimised Javadocs.

This commit is contained in:
Zihlu Wang
2023-09-20 10:25:42 +08:00
parent eb3b3b1015
commit a670d9718b
5 changed files with 26 additions and 34 deletions
@@ -45,11 +45,6 @@ import java.util.*;
* resolver provides functionality to create, extract, verify, and renew JWT * resolver provides functionality to create, extract, verify, and renew JWT
* tokens using various algorithms and custom payload data. * tokens using various algorithms and custom payload data.
* <p> * <p>
* <b>Dependencies:</b>
* This implementation relies on the {@code com.auth0:java-jwt} library. Please
* ensure you have added this library as a dependency to your project before
* using this resolver.
* <p>
* <b>Usage:</b> * <b>Usage:</b>
* To use the {@code AuthzeroTokenResolver}, first, create an instance of this * To use the {@code AuthzeroTokenResolver}, first, create an instance of this
* class: * class:
@@ -87,7 +82,7 @@ import java.util.*;
* correctly configured in your project's dependencies. * correctly configured in your project's dependencies.
* *
* @author Zihlu Wang * @author Zihlu Wang
* @version 1.1.0 * @version 1.1.1
* @see GuidCreator * @see GuidCreator
* @see Algorithm * @see Algorithm
* @see JWTVerifier * @see JWTVerifier
@@ -279,7 +274,7 @@ public class AuthzeroTokenResolver implements TokenResolver<DecodedJWT> {
builder.withClaim(name, v); builder.withClaim(name, v);
} else { } else {
log.warn(""" log.warn("""
Unable to determine the type of field {}, converting it to a string now.""", name); Unable to determine the type of field {}, we will handle it as a String.""", name);
builder.withClaim(name, value.toString()); builder.withClaim(name, value.toString());
} }
} else { } else {
@@ -35,19 +35,20 @@ import java.util.function.Function;
* the {@link AuthzeroTokenResolver}. * the {@link AuthzeroTokenResolver}.
* <p> * <p>
* This configuration is used to establish the mapping between the standard * This configuration is used to establish the mapping between the standard
* {@link TokenAlgorithm} defined within the {@link AuthzeroTokenResolver} * {@link TokenAlgorithm} defined in the
* facade and the specific algorithms used by the {@code com.auth0:java-jwt} * {@code cn.org.codecrafters:simple-jwt-facade} and the specific algorithms
* library, which is the underlying library used by {@link * used by the {@code com.auth0:java-jwt} library, which is the underlying
* AuthzeroTokenResolver} to handle JSON Web Tokens (JWTs). * library used by {@link AuthzeroTokenResolver} to handle JSON Web Tokens
* (JWTs).
* <p> * <p>
* <b>Algorithm Mapping:</b> * <b>Algorithm Mapping:</b>
* The {@code AuthzeroTokenResolverConfig} allows specifying the relationship * The {@code AuthzeroTokenResolverConfig} allows specifying the relationships
* between the standard {@link TokenAlgorithm} instances supported by * between the standard {@link TokenAlgorithm} instances supported by
* {@link AuthzeroTokenResolver} and the corresponding algorithms used by the * {@link AuthzeroTokenResolver} and the corresponding algorithms used by the
* {@code com.auth0:java-jwt} library. The mapping is achieved using a Map, * {@code com.auth0:java-jwt} library. The mapping is achieved using a Map,
* where the keys are the standard TokenAlgorithm instances, and the values * where the keys are the standard {@link TokenAlgorithm} instances, and the
* represent the algorithm functions used by Auth0 Java JWT library for each * values represent the algorithm functions used by {@code com.auth0:java-jwt}
* corresponding key. * library for each corresponding key.
* <p> * <p>
* <b>Note:</b> * <b>Note:</b>
* The provided algorithm mapping should be consistent with the actual * The provided algorithm mapping should be consistent with the actual
@@ -56,7 +57,7 @@ import java.util.function.Function;
* validation and processing within the {@link AuthzeroTokenResolver}. * validation and processing within the {@link AuthzeroTokenResolver}.
* *
* @author Zihlu Wang * @author Zihlu Wang
* @version 1.1.0 * @version 1.1.1
* @since 1.0.0 * @since 1.0.0
*/ */
public final class AuthzeroTokenResolverConfig implements TokenResolverConfig<Function<String, Algorithm>> { public final class AuthzeroTokenResolverConfig implements TokenResolverConfig<Function<String, Algorithm>> {
@@ -21,8 +21,8 @@ import cn.org.codecrafters.simplejwt.TokenResolver;
import cn.org.codecrafters.simplejwt.constants.TokenAlgorithm; import cn.org.codecrafters.simplejwt.constants.TokenAlgorithm;
/** /**
* The {@code TokenResolverConfig} provides a mechanism to configure a * The {@code TokenResolverConfig} provides a mechanism to configure an
* {@link TokenResolver} with algorithm functions. * implementation of {@link TokenResolver} with algorithm functions.
* <p> * <p>
* This generic interface is used to define the configuration details for a * This generic interface is used to define the configuration details for a
* {@link TokenResolver} that utilizes algorithm functions. The interface * {@link TokenResolver} that utilizes algorithm functions. The interface
@@ -49,11 +49,6 @@ import java.util.UUID;
* This resolver provides functionality to create, extract, verify, and renew * This resolver provides functionality to create, extract, verify, and renew
* JWT tokens using various algorithms and custom payload data. * JWT tokens using various algorithms and custom payload data.
* <p> * <p>
* <b>Dependencies:</b>
* This implementation relies on the {@code io.jsonwebtoken:jjwt} library. Please
* ensure you have added this library as a dependency to your project before
* using this resolver.
* <p>
* <b>Usage:</b> * <b>Usage:</b>
* To use the {@code JjwtTokenResolver}, first, create an instance of this * To use the {@code JjwtTokenResolver}, first, create an instance of this
* class: * class:
@@ -28,19 +28,20 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
/** /**
* The {@code JjwtTokenResolverConfig} class provides the configuration for the * The {@code JjwtTokenResolverConfig} class provides the configuration for
* {@link JjwtTokenResolver}. * the {@link JjwtTokenResolver}.
* <p> * <p>
* This configuration class is used to establish the mapping between the * This configuration is used to establish the mapping between the standard
* standard {@link TokenAlgorithm} defined within the * {@link TokenAlgorithm} defined in the
* {@code JjwtTokenResolverConfig} and the specific algorithms used by the * {@code cn.org.codecrafters:simple-jwt-facade} and the specific algorithms
* {@code io.jsonwebtoken:jjwt} library, which is the underlying library used * used by the {@code io.jsonwebtoken:jjwt} library, which is the underlying
* by {@code JjwtTokenResolver} to handle JSON Web Tokens (JWTs). * library used by {@link JjwtTokenResolver} to handle JSON Web Tokens
* (JWTs).
* <p> * <p>
* <b>Algorithm Mapping:</b> * <b>Algorithm Mapping:</b>
* The {@code JjwtTokenResolverConfig} allows specifying the relationship * The {@code JjwtTokenResolverConfig} allows specifying the relationships
* between the standard {@link TokenAlgorithm} instances supported by {@link * between the standard {@link TokenAlgorithm} instances supported by
* JjwtTokenResolver} and the corresponding algorithms used by the * {@link JjwtTokenResolver} and the corresponding algorithms used by the
* {@code io.jsonwebtoken:jjwt} library. The mapping is achieved using a Map, * {@code io.jsonwebtoken:jjwt} library. The mapping is achieved using a Map,
* where the keys are the standard {@link TokenAlgorithm} instances, and the * where the keys are the standard {@link TokenAlgorithm} instances, and the
* values represent the algorithm functions used by * values represent the algorithm functions used by
@@ -53,7 +54,7 @@ import java.util.Map;
* validation and processing within the {@link JjwtTokenResolver}. * validation and processing within the {@link JjwtTokenResolver}.
* *
* @author Zihlu Wang * @author Zihlu Wang
* @version 1.1.0 * @version 1.1.1
* @since 1.0.0 * @since 1.0.0
*/ */
public final class JjwtTokenResolverConfig implements TokenResolverConfig<SignatureAlgorithm> { public final class JjwtTokenResolverConfig implements TokenResolverConfig<SignatureAlgorithm> {