Add authentication #1
19
pom.xml
19
pom.xml
@@ -158,16 +158,6 @@
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mapstruct</groupId>
|
||||
<artifactId>mapstruct</artifactId>
|
||||
<version>1.5.5.Final</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mapstruct</groupId>
|
||||
<artifactId>mapstruct-processor</artifactId>
|
||||
<version>1.5.5.Final</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
@@ -181,14 +171,6 @@
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
@@ -226,5 +208,4 @@
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
package top.fatweb.api.converter
|
||||
|
||||
import org.mapstruct.Mapper
|
||||
import org.mapstruct.Mapping
|
||||
import org.mapstruct.Mappings
|
||||
import org.springframework.stereotype.Component
|
||||
import top.fatweb.api.entity.permission.User
|
||||
import top.fatweb.api.param.LoginParam
|
||||
|
||||
@Mapper(componentModel = "spring")
|
||||
interface UserConverter {
|
||||
@Mappings(Mapping(source = "username", target = "username"), Mapping(source = "password", target = "password"))
|
||||
fun loginParamToUser(loginParam: LoginParam): User
|
||||
|
||||
@Component
|
||||
object UserConverter {
|
||||
fun loginParamToUser(loginParam: LoginParam): User {
|
||||
val user = User().apply {
|
||||
username = loginParam.username
|
||||
password = loginParam.password
|
||||
}
|
||||
|
||||
return user
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user