Commit 46cebff5c38be397fbd7d42332fbd4d381cb10e9

Authored by jiangjiazhi
1 parent 1a2bfb3132
Exists in master

增加token

Showing 2 changed files with 1 additions and 66 deletions

parent/hospital.mac/src/main/java/com/lyms/hospital/service/token/impl/TokenService.java View file @ 46cebff
1   -package com.lyms.hospital.service.token;
2   -/**
3   - * Created by riecard on 15/9/22.
4   - */
5   -public interface TokenService
6   -{
7   -
8   - /**
9   - * 创建token
10   - *
11   - * @return
12   - */
13   - String createToken(Integer userId);
14   -
15   - /**
16   - * 创建token
17   - *
18   - * @return
19   - */
20   - String createToken(Integer userId, Integer second);
21   -
22   - /**
23   - * 重置token有效时间(默认重置为7天)
24   - *
25   - * @param token
26   - * @return
27   - */
28   - boolean resetToken(String token);
29   -
30   - /**
31   - * 检查token是否存在
32   - *
33   - * @param token
34   - * @return
35   - */
36   - boolean validToken(String token);
37   -
38   - /**
39   - * 检查token是否存在
40   - *
41   - * @param token
42   - * @return
43   - */
44   - boolean validToken(String token, Integer second);
45   -
46   - /**
47   - * 根据token取userId,失败返回null
48   - *
49   - * @param token
50   - * @return
51   - */
52   - Integer getUserId(String token);
53   -
54   - void deleteAllToken(Integer userId);
55   -
56   - void deleteAllToken(Integer userId, String prefix);
57   -
58   - /**
59   - * 销毁token
60   - *
61   - * @param token
62   - */
63   - void deleteToken(String token);
64   -
65   -}
parent/hospital.mac/src/main/java/com/lyms/hospital/service/token/impl/TokenServiceImpl.java View file @ 46cebff
... ... @@ -22,7 +22,7 @@
22 22  
23 23 static final Integer seconds = 7 * 24 * 60 * 60;
24 24 static final Integer ams_seconds = 60 * 60;
25   - @Value("${}")
  25 + @Value("${token.prefix}")
26 26 private String tokenPrefix;
27 27  
28 28 @Autowired