|  |  |  | 
|---|
|  |  |  | public static final String HEADER_KEY = "token"; | 
|---|
|  |  |  | //取值名称 | 
|---|
|  |  |  | public static final String UserId_Name = "AppUserId"; | 
|---|
|  |  |  | //取值名称 | 
|---|
|  |  |  | public static final String MEMBER = "MEMBER"; | 
|---|
|  |  |  | //加密密钥 | 
|---|
|  |  |  | private final static String jwtSecret = "MhAjU9poLf8ko54K25XBDtonaL33vtt1"; | 
|---|
|  |  |  | //过期时间(s) 86400L=1天 604800L=7天 | 
|---|
|  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 生成token,根据userId和过期时间 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public static String generateToken(Integer userId, Date exppiredDate, Map<String, Object> claims) { | 
|---|
|  |  |  | public static String generateToken(String userId, Date exppiredDate, Map<String, Object> claims) { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | final Date createdDate = new Date(); | 
|---|
|  |  |  | String secret = getJwtSecret(); | 
|---|