Commit c0d63735 authored by 赵啸非's avatar 赵啸非

修改token鉴权方式

parent 26d7cb82
......@@ -11,6 +11,8 @@ import com.mortals.xhx.base.framework.annotation.Operlog;
import com.mortals.xhx.base.system.user.model.UserEntity;
import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.common.code.UserStatus;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -20,6 +22,7 @@ import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Base64;
import java.util.HashMap;
import java.util.Map;
......@@ -116,5 +119,23 @@ public class UserController extends BaseCRUDJsonMappingController<UserService, U
}
public static void main(String[] args) {
String token="eyJhbGciOiJIUzI1NiJ9.eyJsb2dpbl91c2VyX2tleSI6IjU4NjI3YTc3MjE0ZDQ4Nzg4NzU4YTNhZDlhZmMyMDNiIn0.DrEdCHAGcxGv-irMkTxXJ4Wz4bdsAIRDKnn9JJlL80A";
String secret="abcd1234";
Claims claims = Jwts.parser()
.setSigningKey(secret.getBytes())
.parseClaimsJws(token)
.getBody();
String uuid = (String)claims.get("login_user_key");
System.out.println(uuid);
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment