docs: Fix all docs from one <p> represents for a paragraph

This commit is contained in:
Zihlu Wang
2023-07-31 22:53:09 +08:00
parent 715ae6db3a
commit 748e474a82
34 changed files with 220 additions and 184 deletions
@@ -0,0 +1,45 @@
/*
* Copyright (C) 2023 CodeCraftersCN.
*
* 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.
*/
package cn.org.codecrafters.simplejwt.autoconfiguration;
import cn.org.codecrafters.guid.GuidCreator;
import cn.org.codecrafters.simplejwt.autoconfiguration.properties.SimpleJwtProperties;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import java.util.UUID;
/**
* GuidAutoConfiguration
*
* @author Zihlu Wang
*/
@Slf4j
@AutoConfiguration
@ConditionalOnMissingBean(value = GuidCreator.class, name = "jtiCreator")
public class GuidAutoConfiguration {
@Bean
public GuidCreator<UUID> jtiCreator() {
return UUID::randomUUID;
}
}
@@ -24,6 +24,7 @@ import cn.org.codecrafters.simplejwt.autoconfiguration.properties.SimpleJwtPrope
import com.auth0.jwt.interfaces.DecodedJWT;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
@@ -39,14 +40,14 @@ import java.util.UUID;
* Simple JWT library when used in a Spring Boot application. It provides
* default settings and configurations to ensure that the library works
* smoothly without requiring manual configuration.
* </p>
*
*
* <p>
* This auto-configuration class sets up the necessary beans and components
* required for JWT generation and validation. It automatically creates and
* configures the {@link TokenResolver} bean based on the available options and
* properties.
* </p>
*
*
* <p>
* Developers using the Simple JWT library with Spring Boot do not need to
@@ -54,31 +55,21 @@ import java.util.UUID;
* 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.
* </p>
*
*
* @author Zihlu Wang
* @version 1.0.0
* @since 1.0.0
*/
@Slf4j
@Configuration
@AutoConfiguration
@EnableConfigurationProperties(value = {SimpleJwtProperties.class})
public class SimpleJwtAutoConfiguration {
/**
* The GuidCreator instance to be used for generating JWT IDs (JTI).
*/
private GuidCreator<?> jtiCreator;
/**
* Sets the GuidCreator instance to be used for generating JWT IDs (JTI).
*
* @param jtiCreator the {@code GuidCreator} instance
*/
@Autowired
public void setJtiCreator(GuidCreator<?> jtiCreator) {
this.jtiCreator = jtiCreator;
}
private final GuidCreator<?> jtiCreator;
/**
* The {@code SimpleJwtProperties} instance containing the configuration
@@ -93,23 +84,11 @@ public class SimpleJwtAutoConfiguration {
* @param simpleJwtProperties the SimpleJwtProperties instance
*/
@Autowired
public SimpleJwtAutoConfiguration(SimpleJwtProperties simpleJwtProperties) {
public SimpleJwtAutoConfiguration(SimpleJwtProperties simpleJwtProperties, GuidCreator<?> jtiCreator) {
this.jtiCreator = jtiCreator;
this.simpleJwtProperties = simpleJwtProperties;
}
/**
* Creates a new {@code GuidCreator} bean if no existing bean with the name
* "jtiCreator" is found. The created {@code GuidCreator} is used for
* generating JWT IDs (JTI).
*
* @return the GuidCreator instance
*/
@Bean
@ConditionalOnMissingBean(value = GuidCreator.class, name = "jtiCreator")
public GuidCreator<?> jtiCreator() {
return (GuidCreator<UUID>) UUID::randomUUID;
}
/**
* Creates a new {@link TokenResolver} bean using {@link
* AuthzeroTokenResolver} if no existing {@link TokenResolver} bean is
@@ -22,7 +22,7 @@
* provide default settings and configurations to ensure that the library works
* smoothly and seamlessly without requiring developers to manually configure
* it.
* </p>
*
*
* <p>
* Developers using the Simple JWT library with Spring Boot do not need to
@@ -31,7 +31,7 @@
* automatically. However, developers still have the flexibility to customize
* the behavior of the library by providing their own configurations and
* properties.
* </p>
*
*
* @since 1.0.0
*/
@@ -27,7 +27,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
* store the properties related to Simple JWT library configuration. These
* properties can be configured in the application's properties file (e.g.,
* application.properties) with the prefix "code-crafters.simple-jwt".
* </p>
*
*
* <p>
* SimpleJwtProperties provides configuration options for the JWT algorithm,
@@ -35,14 +35,14 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
* cn.org.codecrafters.simplejwt.autoconfiguration.SimpleJwtAutoConfiguration}
* class to set up the necessary configurations for JWT generation and
* validation.
* </p>
*
*
* <p>
* Developers can customize the JWT algorithm, issuer, and secret by setting
* the corresponding properties in the application's properties file. The
* SimpleJwtAutoConfiguration class reads these properties and uses them to
* create the TokenResolver bean with the desired configuration.
* </p>
*
*
* @since 1.0.0
*/
@@ -23,7 +23,7 @@
* configured in the application's properties file (e.g.,
* application.properties) to customize the behavior and settings of the Simple
* JWT library.
* </p>
*
*
* <p>
* Developers can customize the JWT algorithm, issuer, and secret by setting
@@ -32,7 +32,6 @@
* reads these properties and uses them to create the {@link
* cn.org.codecrafters.simplejwt.TokenResolver} bean with the desired
* configuration.
* </p>
*
* @since 1.0.0
*/