Skip to content

Commit

Permalink
修改sso登录界面
Browse files Browse the repository at this point in the history
  • Loading branch information
smn322 committed Dec 18, 2019
1 parent dc3fca3 commit c446704
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import org.springframework.context.annotation.Configuration;
import redis.clients.jedis.HostAndPort;
import redis.clients.jedis.JedisCluster;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;
import redis.clients.jedis.params.SetParams;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class LogController {
@Autowired
private LogServices logServices;
@PostMapping("/log")
public JSONObject log(@RequestBody UserInfoVO userInfoVO){
public JSONObject log( @RequestBody UserInfoVO userInfoVO){
return logServices.login(userInfoVO);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ public class LogServicesImpl implements LogServices {
@Override
public JSONObject login(UserInfoVO userInfoVO) {
String uid = null;
String token= null;
if((uid=logDao.login(userInfoVO))!= null)
{
String token = TokenUtils.getToken(userInfoVO.getUserAccount());
boolean absent = redisConfig.putTokenIfAbsent(token, uid, TokenUtils.DEAFAULT_TOKEN_EXPIRED_TIME);
token = TokenUtils.getToken(userInfoVO.getUserAccount());
boolean absent = redisConfig.putTokenIfAbsent(uid, token, TokenUtils.DEAFAULT_TOKEN_EXPIRED_TIME);
if(absent)
{
JSONObject data = new JSONObject();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ public class TokenUtils {
public static final long DEAFAULT_TOKEN_EXPIRED_TIME=300000;

public static String getToken(String userAccount){
return TOKEN_PREFIX+userAccount;
return TOKEN_PREFIX+userAccount+System.currentTimeMillis();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.smn.it.taotaomall.sso.web.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

@Configuration
public class WebMvcConfig extends WebMvcConfigurationSupport {

@Override
protected void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/static/*").
addResourceLocations("classpath:/static/*");
super.addResourceHandlers(registry);
}
}

0 comments on commit c446704

Please sign in to comment.