-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Johnny Miller (锺俊)
committed
Dec 22, 2020
1 parent
9d7e759
commit fe3f211
Showing
8 changed files
with
123 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 15 additions & 2 deletions
17
auth-center/src/main/java/com/jmsoftware/maf/authcenter/user/controller/UserController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,33 @@ | ||
package com.jmsoftware.maf.authcenter.user.controller; | ||
|
||
import com.jmsoftware.maf.authcenter.user.service.UserService; | ||
import com.jmsoftware.maf.common.bean.ResponseBodyBean; | ||
import com.jmsoftware.maf.common.domain.authcenter.user.LoginPayload; | ||
import com.jmsoftware.maf.common.domain.authcenter.user.LoginResponse; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.validation.annotation.Validated; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
/** | ||
import javax.validation.Valid; | ||
|
||
/** | ||
* <h1>UserController</h1> | ||
* <p> | ||
* Controller implementation of UserPersistence.(UserPersistence) | ||
* | ||
* @author Johnny Miller (锺俊) | ||
* @date 2020-05-10 12:08:28 | ||
*/ | ||
@Validated | ||
@RestController | ||
@RequiredArgsConstructor | ||
public class UserController { | ||
private final UserService userService; | ||
|
||
@PostMapping("/users/login") | ||
public ResponseBodyBean<LoginResponse> login(@Valid @RequestBody LoginPayload payload) { | ||
return ResponseBodyBean.ofSuccess(userService.login(payload)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
common/src/main/java/com/jmsoftware/maf/common/domain/authcenter/user/LoginPayload.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.jmsoftware.maf.common.domain.authcenter.user; | ||
|
||
import lombok.Data; | ||
import org.hibernate.validator.constraints.Length; | ||
|
||
import javax.validation.constraints.NotEmpty; | ||
import javax.validation.constraints.NotNull; | ||
|
||
/** | ||
* Description: LoginPayload, change description here. | ||
* | ||
* @author 钟俊(zhongjun), email: zhongjun@toguide.cn, date: 12/22/2020 6:26 PM | ||
**/ | ||
@Data | ||
public class LoginPayload { | ||
/** | ||
* The Login token: username / email | ||
*/ | ||
@NotEmpty | ||
@Length(max = 100) | ||
private String loginToken; | ||
/** | ||
* The Password. | ||
*/ | ||
@NotEmpty | ||
@Length(max = 60) | ||
private String password; | ||
/** | ||
* Remember me | ||
*/ | ||
@NotNull | ||
private Boolean rememberMe; | ||
} |
13 changes: 13 additions & 0 deletions
13
common/src/main/java/com/jmsoftware/maf/common/domain/authcenter/user/LoginResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.jmsoftware.maf.common.domain.authcenter.user; | ||
|
||
import lombok.Data; | ||
|
||
/** | ||
* Description: LoginResponse, change description here. | ||
* | ||
* @author 钟俊(zhongjun), email: zhongjun@toguide.cn, date: 12/22/2020 6:27 PM | ||
**/ | ||
@Data | ||
public class LoginResponse { | ||
private String jwt; | ||
} |
33 changes: 33 additions & 0 deletions
33
common/src/main/java/com/jmsoftware/maf/common/domain/authcenter/user/SignupPayload.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.jmsoftware.maf.common.domain.authcenter.user; | ||
|
||
import lombok.Data; | ||
import org.hibernate.validator.constraints.Length; | ||
|
||
import javax.validation.constraints.NotEmpty; | ||
|
||
/** | ||
* Description: RegisterPayload, change description here. | ||
* | ||
* @author 钟俊(zhongjun), email: zhongjun@toguide.cn, date: 12/22/2020 6:27 PM | ||
**/ | ||
@Data | ||
public class SignupPayload { | ||
/** | ||
* Username (Unique) | ||
*/ | ||
@NotEmpty | ||
@Length(min = 4, max = 50) | ||
private String username; | ||
/** | ||
* Email (Unique) | ||
*/ | ||
@NotEmpty | ||
@Length(max = 100) | ||
private String email; | ||
/** | ||
* Password | ||
*/ | ||
@NotEmpty | ||
@Length(min = 8, max = 30) | ||
private String password; | ||
} |