-
Notifications
You must be signed in to change notification settings - Fork 277
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
Showing
6 changed files
with
43 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.wang.config; | ||
|
||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.web.servlet.config.annotation.CorsRegistry; | ||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; | ||
|
||
/** | ||
* 登录接口跨域放开 | ||
* | ||
* @author wliduo[[email protected]] | ||
* @date 2019/11/26 14:29 | ||
*/ | ||
@Configuration | ||
public class WebMvcConfig extends WebMvcConfigurerAdapter { | ||
@Override | ||
public void addCorsMappings(CorsRegistry registry) { | ||
registry.addMapping("/user/login").allowedOrigins("*") | ||
.allowedMethods("GET", "HEAD", "POST", "PUT", "DELETE", "OPTIONS") | ||
.allowCredentials(false).maxAge(3600); | ||
} | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,8 @@ | |
|
||
/** | ||
* 获取当前登录用户工具类 | ||
* @author Wang926454 | ||
* | ||
* @author wliduo[[email protected]] | ||
* @date 2019/3/15 11:45 | ||
*/ | ||
@Component | ||
|
@@ -25,9 +26,10 @@ public UserUtil(UserMapper userMapper) { | |
|
||
/** | ||
* 获取当前登录用户 | ||
* | ||
* @param | ||
* @return com.wang.model.UserDto | ||
* @author Wang926454 | ||
* @author wliduo[[email protected]] | ||
* @date 2019/3/15 11:48 | ||
*/ | ||
public UserDto getUser() { | ||
|
@@ -46,9 +48,10 @@ public UserDto getUser() { | |
|
||
/** | ||
* 获取当前登录用户Id | ||
* | ||
* @param | ||
* @return com.wang.model.UserDto | ||
* @author Wang926454 | ||
* @author wliduo[[email protected]] | ||
* @date 2019/3/15 11:48 | ||
*/ | ||
public Integer getUserId() { | ||
|
@@ -57,9 +60,10 @@ public Integer getUserId() { | |
|
||
/** | ||
* 获取当前登录用户Token | ||
* | ||
* @param | ||
* @return com.wang.model.UserDto | ||
* @author Wang926454 | ||
* @author wliduo[[email protected]] | ||
* @date 2019/3/15 11:48 | ||
*/ | ||
public String getToken() { | ||
|
@@ -68,9 +72,10 @@ public String getToken() { | |
|
||
/** | ||
* 获取当前登录用户Account | ||
* | ||
* @param | ||
* @return com.wang.model.UserDto | ||
* @author Wang926454 | ||
* @author wliduo[[email protected]] | ||
* @date 2019/3/15 11:48 | ||
*/ | ||
public String getAccount() { | ||
|