Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
FLIPPED-AURORA
gin-vue-admin
提交
99dd550c
G
gin-vue-admin
项目概览
FLIPPED-AURORA
/
gin-vue-admin
大约 1 年 前同步成功
通知
333
Star
18155
Fork
5506
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gin-vue-admin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
99dd550c
编写于
10月 25, 2021
作者:
Mr.奇淼(
提交者:
GitHub
10月 25, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #777 from flipped-aurora/update
调整claims获取方法 修复前端选中样式
上级
cc62194b
614cb2a8
变更
19
隐藏空白更改
内联
并排
Showing
19 changed file
with
222 addition
and
243 deletion
+222
-243
server/api/v1/system/sys_user.go
server/api/v1/system/sys_user.go
+3
-12
server/config.yaml
server/config.yaml
+1
-1
server/config/jwt.go
server/config/jwt.go
+1
-0
server/go.mod
server/go.mod
+2
-1
server/go.sum
server/go.sum
+8
-2
server/main.go
server/main.go
+0
-1
server/middleware/casbin_rbac.go
server/middleware/casbin_rbac.go
+2
-3
server/middleware/email.go
server/middleware/email.go
+4
-4
server/middleware/operation.go
server/middleware/operation.go
+4
-4
server/model/system/request/jwt.go
server/model/system/request/jwt.go
+6
-2
server/plugin/ws/utils/utils.go
server/plugin/ws/utils/utils.go
+0
-52
server/utils/clamis.go
server/utils/clamis.go
+31
-8
server/utils/jwt.go
server/utils/jwt.go
+14
-0
web/package-lock.json
web/package-lock.json
+92
-89
web/package.json
web/package.json
+48
-48
web/src/style/basics.scss
web/src/style/basics.scss
+0
-1
web/src/style/main.scss
web/src/style/main.scss
+1
-13
web/src/view/superAdmin/operation/sysOperationRecord.vue
web/src/view/superAdmin/operation/sysOperationRecord.vue
+2
-2
web/src/view/systemTools/system/system.vue
web/src/view/systemTools/system/system.vue
+3
-0
未找到文件。
server/api/v1/system/sys_user.go
浏览文件 @
99dd550c
package
system
import
(
"strconv"
"time"
"github.com/flipped-aurora/gin-vue-admin/server/global"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/request"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
...
...
@@ -11,8 +8,8 @@ import (
systemReq
"github.com/flipped-aurora/gin-vue-admin/server/model/system/request"
systemRes
"github.com/flipped-aurora/gin-vue-admin/server/model/system/response"
"github.com/flipped-aurora/gin-vue-admin/server/utils"
"strconv"
"github.com/dgrijalva/jwt-go"
"github.com/gin-gonic/gin"
"github.com/go-redis/redis/v8"
"go.uber.org/zap"
...
...
@@ -47,19 +44,13 @@ func (b *BaseApi) Login(c *gin.Context) {
// 登录以后签发jwt
func
(
b
*
BaseApi
)
tokenNext
(
c
*
gin
.
Context
,
user
system
.
SysUser
)
{
j
:=
&
utils
.
JWT
{
SigningKey
:
[]
byte
(
global
.
GVA_CONFIG
.
JWT
.
SigningKey
)}
// 唯一签名
claims
:=
systemReq
.
Custom
Claims
{
claims
:=
j
.
CreateClaims
(
systemReq
.
Base
Claims
{
UUID
:
user
.
UUID
,
ID
:
user
.
ID
,
NickName
:
user
.
NickName
,
Username
:
user
.
Username
,
AuthorityId
:
user
.
AuthorityId
,
BufferTime
:
global
.
GVA_CONFIG
.
JWT
.
BufferTime
,
// 缓冲时间1天 缓冲时间内会获得新的token刷新令牌 此时一个用户会存在两个有效令牌 但是前端只留一个 另一个会丢失
StandardClaims
:
jwt
.
StandardClaims
{
NotBefore
:
time
.
Now
()
.
Unix
()
-
1000
,
// 签名生效时间
ExpiresAt
:
time
.
Now
()
.
Unix
()
+
global
.
GVA_CONFIG
.
JWT
.
ExpiresTime
,
// 过期时间 7天 配置文件
Issuer
:
"qmPlus"
,
// 签名的发行者
},
}
})
token
,
err
:=
j
.
CreateToken
(
claims
)
if
err
!=
nil
{
global
.
GVA_LOG
.
Error
(
"获取token失败!"
,
zap
.
Any
(
"err"
,
err
))
...
...
server/config.yaml
浏览文件 @
99dd550c
...
...
@@ -5,7 +5,7 @@ jwt:
signing-key
:
'
qmPlus'
expires-time
:
604800
buffer-time
:
86400
issuer
:
'
qmPlus'
# zap logger configuration
zap
:
level
:
'
info'
...
...
server/config/jwt.go
浏览文件 @
99dd550c
...
...
@@ -4,4 +4,5 @@ type JWT struct {
SigningKey
string
`mapstructure:"signing-key" json:"signingKey" yaml:"signing-key"`
// jwt签名
ExpiresTime
int64
`mapstructure:"expires-time" json:"expiresTime" yaml:"expires-time"`
// 过期时间
BufferTime
int64
`mapstructure:"buffer-time" json:"bufferTime" yaml:"buffer-time"`
// 缓冲时间
Issuer
string
`mapstructure:"issuer" json:"issuer" yaml:"issuer"`
// 签发者
}
server/go.mod
浏览文件 @
99dd550c
...
...
@@ -22,13 +22,14 @@ require (
github.com/qiniu/api.v7/v7 v7.4.1
github.com/robfig/cron/v3 v3.0.1
github.com/satori/go.uuid v1.2.0
github.com/shirou/gopsutil v3.21.
1
+incompatible
github.com/shirou/gopsutil v3.21.
9
+incompatible
github.com/songzhibin97/gkit v1.1.1
github.com/spf13/viper v1.7.0
github.com/stretchr/testify v1.7.0
github.com/swaggo/gin-swagger v1.3.0
github.com/swaggo/swag v1.7.0
github.com/tencentyun/cos-go-sdk-v5 v0.7.19
github.com/tklauser/go-sysconf v0.3.9 // indirect
github.com/unrolled/secure v1.0.7
github.com/xuri/excelize/v2 v2.4.1
go.uber.org/zap v1.16.0
...
...
server/go.sum
浏览文件 @
99dd550c
...
...
@@ -426,8 +426,9 @@ github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
github.com/shirou/gopsutil v3.20.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
github.com/shirou/gopsutil v3.21.1+incompatible h1:2LwXWdbjXwyDgq26Yy/OT4xozlpmssQfy/rtfhWb0bY=
github.com/shirou/gopsutil v3.21.1+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
github.com/shirou/gopsutil v3.21.9+incompatible h1:LTLpUnfX81MkHeCtSrwNKZwuW5Id6kCa7/P43NdcNn4=
github.com/shirou/gopsutil v3.21.9+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4=
github.com/shopspring/decimal v0.0.0-20200227202807-02e2044944cc h1:jUIKcSPO9MoMJBbEoyE/RJoE8vz7Mb8AjvifMMwSyvY=
github.com/shopspring/decimal v0.0.0-20200227202807-02e2044944cc/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
...
...
@@ -478,6 +479,10 @@ github.com/swaggo/swag v1.7.0/go.mod h1:BdPIL73gvS9NBsdi7M1JOxLvlbfvNRaBP8m6WT6A
github.com/tebeka/strftime v0.1.3/go.mod h1:7wJm3dZlpr4l/oVK0t1HYIc4rMzQ2XJlOMIUJUJH6XQ=
github.com/tencentyun/cos-go-sdk-v5 v0.7.19 h1:janAfTO4MglOrUFuKGTQJBuMc66+F7TgtEIt1wPsJ+k=
github.com/tencentyun/cos-go-sdk-v5 v0.7.19/go.mod h1:wQBO5HdAkLjj2q6XQiIfDSP8DXDNrppDRw2Kp/1BODA=
github.com/tklauser/go-sysconf v0.3.9 h1:JeUVdAOWhhxVcU6Eqr/ATFHgXk/mmiItdKeJPev3vTo=
github.com/tklauser/go-sysconf v0.3.9/go.mod h1:11DU/5sG7UexIrp/O6g35hrWzu0JxlwQ3LSFUzyeuhs=
github.com/tklauser/numcpus v0.3.0 h1:ILuRUQBtssgnxw0XXIjKUC56fgnOrFoQQ/4+DeU2biQ=
github.com/tklauser/numcpus v0.3.0/go.mod h1:yFGUr7TUHQRAhyqBcEg0Ge34zDBAsIvJJcyE6boqnA8=
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc=
github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=
...
...
@@ -634,8 +639,9 @@ golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c h1:F1jZWGFhYfh0Ci55sIpILtKKK8p3i2/krTr0H1rg74I=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210816074244-15123e1e1f71 h1:ikCpsnYR+Ew0vu99XlDp55lGgDJdIMx3f4a18jfse/s=
golang.org/x/sys v0.0.0-20210816074244-15123e1e1f71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
...
...
server/main.go
浏览文件 @
99dd550c
...
...
@@ -30,5 +30,4 @@ func main() {
defer
db
.
Close
()
}
core
.
RunWindowsServer
()
}
server/middleware/casbin_rbac.go
浏览文件 @
99dd550c
...
...
@@ -3,8 +3,8 @@ package middleware
import
(
"github.com/flipped-aurora/gin-vue-admin/server/global"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
"github.com/flipped-aurora/gin-vue-admin/server/model/system/request"
"github.com/flipped-aurora/gin-vue-admin/server/service"
"github.com/flipped-aurora/gin-vue-admin/server/utils"
"github.com/gin-gonic/gin"
)
...
...
@@ -13,8 +13,7 @@ var casbinService = service.ServiceGroupApp.SystemServiceGroup.CasbinService
// 拦截器
func
CasbinHandler
()
gin
.
HandlerFunc
{
return
func
(
c
*
gin
.
Context
)
{
claims
,
_
:=
c
.
Get
(
"claims"
)
waitUse
:=
claims
.
(
*
request
.
CustomClaims
)
waitUse
,
_
:=
utils
.
GetClaims
(
c
)
// 获取请求的URI
obj
:=
c
.
Request
.
URL
.
RequestURI
()
// 获取请求方法
...
...
server/middleware/email.go
浏览文件 @
99dd550c
...
...
@@ -2,13 +2,13 @@ package middleware
import
(
"github.com/flipped-aurora/gin-vue-admin/server/plugin/email/utils"
utils2
"github.com/flipped-aurora/gin-vue-admin/server/utils"
"io/ioutil"
"strconv"
"time"
"github.com/flipped-aurora/gin-vue-admin/server/global"
"github.com/flipped-aurora/gin-vue-admin/server/model/system"
"github.com/flipped-aurora/gin-vue-admin/server/model/system/request"
"github.com/flipped-aurora/gin-vue-admin/server/service"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
...
...
@@ -19,9 +19,9 @@ var userService = service.ServiceGroupApp.SystemServiceGroup.UserService
func
ErrorToEmail
()
gin
.
HandlerFunc
{
return
func
(
c
*
gin
.
Context
)
{
var
username
string
if
claims
,
ok
:=
c
.
Get
(
"claims"
);
ok
{
waitUse
:=
claims
.
(
*
request
.
CustomClaims
)
username
=
waitUse
.
Username
claims
,
_
:=
utils2
.
GetClaims
(
c
)
if
claims
.
Username
!=
""
{
username
=
claims
.
Username
}
else
{
id
,
_
:=
strconv
.
Atoi
(
c
.
Request
.
Header
.
Get
(
"x-user-id"
))
err
,
user
:=
userService
.
FindUserById
(
id
)
...
...
server/middleware/operation.go
浏览文件 @
99dd550c
...
...
@@ -2,6 +2,7 @@ package middleware
import
(
"bytes"
"github.com/flipped-aurora/gin-vue-admin/server/utils"
"io/ioutil"
"net/http"
"strconv"
...
...
@@ -9,7 +10,6 @@ import (
"github.com/flipped-aurora/gin-vue-admin/server/global"
"github.com/flipped-aurora/gin-vue-admin/server/model/system"
"github.com/flipped-aurora/gin-vue-admin/server/model/system/request"
"github.com/flipped-aurora/gin-vue-admin/server/service"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
...
...
@@ -30,9 +30,9 @@ func OperationRecord() gin.HandlerFunc {
c
.
Request
.
Body
=
ioutil
.
NopCloser
(
bytes
.
NewBuffer
(
body
))
}
}
if
claims
,
ok
:=
c
.
Get
(
"claims"
);
ok
{
waitUse
:=
claims
.
(
*
request
.
CustomClaims
)
userId
=
int
(
waitUse
.
ID
)
claims
,
_
:=
utils
.
GetClaims
(
c
)
if
claims
.
ID
!=
0
{
userId
=
int
(
claims
.
ID
)
}
else
{
id
,
err
:=
strconv
.
Atoi
(
c
.
Request
.
Header
.
Get
(
"x-user-id"
))
if
err
!=
nil
{
...
...
server/model/system/request/jwt.go
浏览文件 @
99dd550c
...
...
@@ -7,11 +7,15 @@ import (
// Custom claims structure
type
CustomClaims
struct
{
BaseClaims
BufferTime
int64
jwt
.
StandardClaims
}
type
BaseClaims
struct
{
UUID
uuid
.
UUID
ID
uint
Username
string
NickName
string
AuthorityId
string
BufferTime
int64
jwt
.
StandardClaims
}
server/plugin/ws/utils/utils.go
已删除
100644 → 0
浏览文件 @
cc62194b
package
utils
import
(
"github.com/flipped-aurora/gin-vue-admin/server/global"
systemReq
"github.com/flipped-aurora/gin-vue-admin/server/model/system/request"
"github.com/gin-gonic/gin"
uuid
"github.com/satori/go.uuid"
)
// 从Gin的Context中获取从jwt解析出来的用户ID
func
GetUserID
(
c
*
gin
.
Context
)
uint
{
if
claims
,
exists
:=
c
.
Get
(
"claims"
);
!
exists
{
global
.
GVA_LOG
.
Error
(
"从Gin的Context中获取从jwt解析出来的用户ID失败, 请检查路由是否使用jwt中间件!"
)
return
0
}
else
{
waitUse
:=
claims
.
(
*
systemReq
.
CustomClaims
)
return
waitUse
.
ID
}
}
// 从Gin的Context中获取从jwt解析出来的用户UUID
func
GetUserUuid
(
c
*
gin
.
Context
)
uuid
.
UUID
{
if
claims
,
exists
:=
c
.
Get
(
"claims"
);
!
exists
{
global
.
GVA_LOG
.
Error
(
"从Gin的Context中获取从jwt解析出来的用户UUID失败, 请检查路由是否使用jwt中间件!"
)
return
uuid
.
UUID
{}
}
else
{
waitUse
:=
claims
.
(
*
systemReq
.
CustomClaims
)
return
waitUse
.
UUID
}
}
// 从Gin的Context中获取从jwt解析出来的用户角色id
func
GetUserAuthorityId
(
c
*
gin
.
Context
)
string
{
if
claims
,
exists
:=
c
.
Get
(
"claims"
);
!
exists
{
global
.
GVA_LOG
.
Error
(
"从Gin的Context中获取从jwt解析出来的用户UUID失败, 请检查路由是否使用jwt中间件!"
)
return
""
}
else
{
waitUse
:=
claims
.
(
*
systemReq
.
CustomClaims
)
return
waitUse
.
AuthorityId
}
}
// 从Gin的Context中获取从jwt解析出来的用户角色id
func
GetUserInfo
(
c
*
gin
.
Context
)
*
systemReq
.
CustomClaims
{
if
claims
,
exists
:=
c
.
Get
(
"claims"
);
!
exists
{
global
.
GVA_LOG
.
Error
(
"从Gin的Context中获取从jwt解析出来的用户UUID失败, 请检查路由是否使用jwt中间件!"
)
return
nil
}
else
{
waitUse
:=
claims
.
(
*
systemReq
.
CustomClaims
)
return
waitUse
}
}
server/utils/clamis.go
浏览文件 @
99dd550c
...
...
@@ -7,22 +7,39 @@ import (
uuid
"github.com/satori/go.uuid"
)
func
GetClaims
(
c
*
gin
.
Context
)
(
*
systemReq
.
CustomClaims
,
error
)
{
token
:=
c
.
Request
.
Header
.
Get
(
"x-token"
)
j
:=
NewJWT
()
claims
,
err
:=
j
.
ParseToken
(
token
)
if
err
!=
nil
{
global
.
GVA_LOG
.
Error
(
"从Gin的Context中获取从jwt解析信息失败, 请检查请求头是否存在x-token且claims是否为规定结构"
)
}
return
claims
,
err
}
// 从Gin的Context中获取从jwt解析出来的用户ID
func
GetUserID
(
c
*
gin
.
Context
)
uint
{
if
claims
,
exists
:=
c
.
Get
(
"claims"
);
!
exists
{
global
.
GVA_LOG
.
Error
(
"从Gin的Context中获取从jwt解析出来的用户ID失败, 请检查路由是否使用jwt中间件!"
)
return
0
if
cl
,
err
:=
GetClaims
(
c
);
err
!=
nil
{
return
0
}
else
{
return
cl
.
ID
}
}
else
{
waitUse
:=
claims
.
(
*
systemReq
.
CustomClaims
)
return
waitUse
.
ID
}
}
// 从Gin的Context中获取从jwt解析出来的用户UUID
func
GetUserUuid
(
c
*
gin
.
Context
)
uuid
.
UUID
{
if
claims
,
exists
:=
c
.
Get
(
"claims"
);
!
exists
{
global
.
GVA_LOG
.
Error
(
"从Gin的Context中获取从jwt解析出来的用户UUID失败, 请检查路由是否使用jwt中间件!"
)
return
uuid
.
UUID
{}
if
cl
,
err
:=
GetClaims
(
c
);
err
!=
nil
{
return
uuid
.
UUID
{}
}
else
{
return
cl
.
UUID
}
}
else
{
waitUse
:=
claims
.
(
*
systemReq
.
CustomClaims
)
return
waitUse
.
UUID
...
...
@@ -32,8 +49,11 @@ func GetUserUuid(c *gin.Context) uuid.UUID {
// 从Gin的Context中获取从jwt解析出来的用户角色id
func
GetUserAuthorityId
(
c
*
gin
.
Context
)
string
{
if
claims
,
exists
:=
c
.
Get
(
"claims"
);
!
exists
{
global
.
GVA_LOG
.
Error
(
"从Gin的Context中获取从jwt解析出来的用户UUID失败, 请检查路由是否使用jwt中间件!"
)
return
""
if
cl
,
err
:=
GetClaims
(
c
);
err
!=
nil
{
return
""
}
else
{
return
cl
.
AuthorityId
}
}
else
{
waitUse
:=
claims
.
(
*
systemReq
.
CustomClaims
)
return
waitUse
.
AuthorityId
...
...
@@ -43,8 +63,11 @@ func GetUserAuthorityId(c *gin.Context) string {
// 从Gin的Context中获取从jwt解析出来的用户角色id
func
GetUserInfo
(
c
*
gin
.
Context
)
*
systemReq
.
CustomClaims
{
if
claims
,
exists
:=
c
.
Get
(
"claims"
);
!
exists
{
global
.
GVA_LOG
.
Error
(
"从Gin的Context中获取从jwt解析出来的用户UUID失败, 请检查路由是否使用jwt中间件!"
)
return
nil
if
cl
,
err
:=
GetClaims
(
c
);
err
!=
nil
{
return
nil
}
else
{
return
cl
}
}
else
{
waitUse
:=
claims
.
(
*
systemReq
.
CustomClaims
)
return
waitUse
...
...
server/utils/jwt.go
浏览文件 @
99dd550c
...
...
@@ -5,6 +5,7 @@ import (
"github.com/dgrijalva/jwt-go"
"github.com/flipped-aurora/gin-vue-admin/server/global"
"github.com/flipped-aurora/gin-vue-admin/server/model/system/request"
"time"
)
type
JWT
struct
{
...
...
@@ -24,6 +25,19 @@ func NewJWT() *JWT {
}
}
func
(
j
*
JWT
)
CreateClaims
(
baseClaims
request
.
BaseClaims
)
request
.
CustomClaims
{
claims
:=
request
.
CustomClaims
{
BaseClaims
:
baseClaims
,
BufferTime
:
global
.
GVA_CONFIG
.
JWT
.
BufferTime
,
// 缓冲时间1天 缓冲时间内会获得新的token刷新令牌 此时一个用户会存在两个有效令牌 但是前端只留一个 另一个会丢失
StandardClaims
:
jwt
.
StandardClaims
{
NotBefore
:
time
.
Now
()
.
Unix
()
-
1000
,
// 签名生效时间
ExpiresAt
:
time
.
Now
()
.
Unix
()
+
global
.
GVA_CONFIG
.
JWT
.
ExpiresTime
,
// 过期时间 7天 配置文件
Issuer
:
global
.
GVA_CONFIG
.
JWT
.
Issuer
,
// 签名的发行者
},
}
return
claims
}
// 创建一个token
func
(
j
*
JWT
)
CreateToken
(
claims
request
.
CustomClaims
)
(
string
,
error
)
{
token
:=
jwt
.
NewWithClaims
(
jwt
.
SigningMethodHS256
,
claims
)
...
...
web/package-lock.json
浏览文件 @
99dd550c
...
...
@@ -1500,9 +1500,9 @@
}
},
"@vitejs/plugin-vue"
:
{
"version"
:
"1.
6.0
"
,
"resolved"
:
"https://registry.npmjs.org/@vitejs/plugin-vue/-/plugin-vue-1.
6.0
.tgz"
,
"integrity"
:
"sha512-
n3i8htn8pTg9M+kM3cnEfsPZx/6ngInlTroth6fA1LQTJq5aTVQ8ggaE5pPoAy9vCgHPtcaXMzwpldhqRAkebQ
=="
,
"version"
:
"1.
9.3
"
,
"resolved"
:
"https://registry.npmjs.org/@vitejs/plugin-vue/-/plugin-vue-1.
9.3
.tgz"
,
"integrity"
:
"sha512-
yW6H/q+4Mc2PcVjSOelcsMrg/k15DnMUz8jyCFsI04emc3aLwo4AoofUfGnjHUkgirrDxSJLVqQVGhonQ3yykA
=="
,
"dev"
:
true
},
"@vue/babel-helper-vue-jsx-merge-props"
:
{
...
...
@@ -1799,69 +1799,12 @@
"integrity"
:
"sha1-/q7SVZc9LndVW4PbwIhRpsY1IPo="
,
"dev"
:
true
},
"ansi-styles"
:
{
"version"
:
"4.3.0"
,
"resolved"
:
"https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz"
,
"integrity"
:
"sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"color-convert"
:
"^2.0.1"
}
},
"chalk"
:
{
"version"
:
"4.1.2"
,
"resolved"
:
"https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz"
,
"integrity"
:
"sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA=="
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"ansi-styles"
:
"^4.1.0"
,
"supports-color"
:
"^7.1.0"
}
},
"color-convert"
:
{
"version"
:
"2.0.1"
,
"resolved"
:
"https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz"
,
"integrity"
:
"sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ=="
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"color-name"
:
"~1.1.4"
}
},
"color-name"
:
{
"version"
:
"1.1.4"
,
"resolved"
:
"https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz"
,
"integrity"
:
"sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
,
"dev"
:
true
,
"optional"
:
true
},
"dotenv"
:
{
"version"
:
"8.6.0"
,
"resolved"
:
"https://registry.npmjs.org/dotenv/-/dotenv-8.6.0.tgz"
,
"integrity"
:
"sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g=="
,
"dev"
:
true
},
"has-flag"
:
{
"version"
:
"4.0.0"
,
"resolved"
:
"https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz"
,
"integrity"
:
"sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="
,
"dev"
:
true
,
"optional"
:
true
},
"loader-utils"
:
{
"version"
:
"2.0.0"
,
"resolved"
:
"https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.0.tgz"
,
"integrity"
:
"sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ=="
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"big.js"
:
"^5.2.2"
,
"emojis-list"
:
"^3.0.0"
,
"json5"
:
"^2.1.2"
}
},
"ssri"
:
{
"version"
:
"8.0.1"
,
"resolved"
:
"https://registry.nlark.com/ssri/download/ssri-8.0.1.tgz"
,
...
...
@@ -1870,28 +1813,6 @@
"requires"
:
{
"minipass"
:
"^3.1.1"
}
},
"supports-color"
:
{
"version"
:
"7.2.0"
,
"resolved"
:
"https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz"
,
"integrity"
:
"sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"has-flag"
:
"^4.0.0"
}
},
"vue-loader-v16"
:
{
"version"
:
"npm:vue-loader@16.8.1"
,
"resolved"
:
"https://registry.npmjs.org/vue-loader/-/vue-loader-16.8.1.tgz"
,
"integrity"
:
"sha512-V53TJbHmzjBhCG5OYI2JWy/aYDspz4oVHKxS43Iy212GjGIG1T3EsB3+GWXFm/1z5VwjdjLmdZUFYM70y77vtQ=="
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"chalk"
:
"^4.1.0"
,
"hash-sum"
:
"^2.0.0"
,
"loader-utils"
:
"^2.0.0"
}
}
}
},
...
...
@@ -2606,9 +2527,9 @@
"dev"
:
true
},
"async-validator"
:
{
"version"
:
"4.0.
3
"
,
"resolved"
:
"https://registry.npmjs.org/async-validator/-/async-validator-4.0.
3
.tgz"
,
"integrity"
:
"sha512-
LVoIbJNHPKsO7FMLamo88uxdrvayGkF3vLTMTeiN3CqAbP3qSafLRc6yx3Sq9lHkiEOLNpoA2jwwnfGDdu1SM
Q=="
"version"
:
"4.0.
7
"
,
"resolved"
:
"https://registry.npmjs.org/async-validator/-/async-validator-4.0.
7
.tgz"
,
"integrity"
:
"sha512-
Pj2IR7u8hmUEDOwB++su6baaRi+QvsgajuFB9j95foM1N2gy5HM4z60hfusIO0fBPG5uLAEl6yCJr1jNSVugE
Q=="
},
"asynckit"
:
{
"version"
:
"0.4.0"
,
...
...
@@ -4864,11 +4785,12 @@
"dev"
:
true
},
"element-plus"
:
{
"version"
:
"1.1.0-beta.2
0
"
,
"resolved"
:
"https://registry.npmjs.org/element-plus/-/element-plus-1.1.0-beta.2
0
.tgz"
,
"integrity"
:
"sha512-
5rBrLzfKGz4urSxqKi1tihylyotSswMCKdXpCAJAfRggMjtS1NfqVtrCYEPdjphmP2JHsj8TisDvbRTScRKF0Q
=="
,
"version"
:
"1.1.0-beta.2
4
"
,
"resolved"
:
"https://registry.npmjs.org/element-plus/-/element-plus-1.1.0-beta.2
4
.tgz"
,
"integrity"
:
"sha512-
dmo61e/D6mwJVacMhxOMSPb5sZPt/FPsuQQfsOs1kJWkhGDmTlny/sZvgIQr1z0zh3pjlJadGAlNS+0nySPMmw
=="
,
"requires"
:
{
"@popperjs/core"
:
"^2.10.1"
,
"@element-plus/icons"
:
"^0.0.11"
,
"@popperjs/core"
:
"^2.10.2"
,
"@vueuse/core"
:
"~6.1.0"
,
"async-validator"
:
"^4.0.3"
,
"dayjs"
:
"^1.10.7"
,
...
...
@@ -11730,6 +11652,87 @@
}
}
},
"vue-loader-v16"
:
{
"version"
:
"npm:vue-loader@16.8.1"
,
"resolved"
:
"https://registry.npmjs.org/vue-loader/-/vue-loader-16.8.1.tgz"
,
"integrity"
:
"sha512-V53TJbHmzjBhCG5OYI2JWy/aYDspz4oVHKxS43Iy212GjGIG1T3EsB3+GWXFm/1z5VwjdjLmdZUFYM70y77vtQ=="
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"chalk"
:
"^4.1.0"
,
"hash-sum"
:
"^2.0.0"
,
"loader-utils"
:
"^2.0.0"
},
"dependencies"
:
{
"ansi-styles"
:
{
"version"
:
"4.3.0"
,
"resolved"
:
"https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz"
,
"integrity"
:
"sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"color-convert"
:
"^2.0.1"
}
},
"chalk"
:
{
"version"
:
"4.1.2"
,
"resolved"
:
"https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz"
,
"integrity"
:
"sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA=="
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"ansi-styles"
:
"^4.1.0"
,
"supports-color"
:
"^7.1.0"
}
},
"color-convert"
:
{
"version"
:
"2.0.1"
,
"resolved"
:
"https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz"
,
"integrity"
:
"sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ=="
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"color-name"
:
"~1.1.4"
}
},
"color-name"
:
{
"version"
:
"1.1.4"
,
"resolved"
:
"https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz"
,
"integrity"
:
"sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
,
"dev"
:
true
,
"optional"
:
true
},
"has-flag"
:
{
"version"
:
"4.0.0"
,
"resolved"
:
"https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz"
,
"integrity"
:
"sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="
,
"dev"
:
true
,
"optional"
:
true
},
"loader-utils"
:
{
"version"
:
"2.0.0"
,
"resolved"
:
"https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.0.tgz"
,
"integrity"
:
"sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ=="
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"big.js"
:
"^5.2.2"
,
"emojis-list"
:
"^3.0.0"
,
"json5"
:
"^2.1.2"
}
},
"supports-color"
:
{
"version"
:
"7.2.0"
,
"resolved"
:
"https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz"
,
"integrity"
:
"sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"has-flag"
:
"^4.0.0"
}
}
}
},
"vue-particle-line"
:
{
"version"
:
"0.1.4"
,
"resolved"
:
"https://registry.npmjs.org/vue-particle-line/-/vue-particle-line-0.1.4.tgz"
,
...
...
web/package.json
浏览文件 @
99dd550c
{
"name"
:
"gin-vue-admin"
,
"version"
:
"2.3.5"
,
"private"
:
true
,
"scripts"
:
{
"serve"
:
"node openDocument.js && vite --host --mode development"
,
"build"
:
"vite build --mode production"
,
"preview"
:
"vite preview"
},
"dependencies"
:
{
"@element-plus/icons"
:
"0.0.11"
,
"axios"
:
"^0.19.2"
,
"core-js"
:
"^3.6.5"
,
"echarts"
:
"4.9.0"
,
"element-plus"
:
"^1.1.0-beta.20
"
,
"highlight.js"
:
"^10.6.0"
,
"marked"
:
"^2.0.0"
,
"mitt"
:
"^3.0.0"
,
"path"
:
"^0.12.7"
,
"qs"
:
"^6.8.0"
,
"quill"
:
"^1.3.7"
,
"screenfull"
:
"^5.0.2"
,
"script-ext-html-webpack-plugin"
:
"^2.1.4"
,
"spark-md5"
:
"^3.0.1"
,
"vue"
:
"^3.2.0"
,
"vue-particle-line"
:
"^0.1.4"
,
"vue-router"
:
"^4.0.0-0"
,
"vuex"
:
"^4.0.0-0"
,
"vuex-persist"
:
"^2.1.0"
},
"devDependencies"
:
{
"@vitejs/plugin-legacy"
:
"^1.4.4"
,
"@vitejs/plugin-vue"
:
"latest"
,
"@vue/cli-plugin-babel"
:
"~4.5.0"
,
"@vue/cli-plugin-eslint"
:
"~4.5.0"
,
"@vue/cli-plugin-router"
:
"~4.5.0"
,
"@vue/cli-plugin-vuex"
:
"~4.5.0"
,
"@vue/cli-service"
:
"~4.5.0"
,
"@vue/compiler-sfc"
:
"^3.1.5"
,
"babel-eslint"
:
"^10.1.0"
,
"babel-plugin-import"
:
"^1.13.3"
,
"dotenv"
:
"^10.0.0"
,
"eslint"
:
"^6.7.2"
,
"eslint-plugin-vue"
:
"^7.0.0"
,
"sass"
:
"^1.26.5"
,
"sass-loader"
:
"^8.0.2"
,
"vite"
:
"2"
,
"vite-plugin-importer"
:
"^0.2.5"
}
"name"
:
"gin-vue-admin"
,
"version"
:
"2.3.5"
,
"private"
:
true
,
"scripts"
:
{
"serve"
:
"node openDocument.js && vite --host --mode development"
,
"build"
:
"vite build --mode production"
,
"preview"
:
"vite preview"
},
"dependencies"
:
{
"@element-plus/icons"
:
"0.0.11"
,
"axios"
:
"^0.19.2"
,
"core-js"
:
"^3.6.5"
,
"echarts"
:
"4.9.0"
,
"element-plus"
:
"^1.1.0-beta.24
"
,
"highlight.js"
:
"^10.6.0"
,
"marked"
:
"^2.0.0"
,
"mitt"
:
"^3.0.0"
,
"path"
:
"^0.12.7"
,
"qs"
:
"^6.8.0"
,
"quill"
:
"^1.3.7"
,
"screenfull"
:
"^5.0.2"
,
"script-ext-html-webpack-plugin"
:
"^2.1.4"
,
"spark-md5"
:
"^3.0.1"
,
"vue"
:
"^3.2.0"
,
"vue-particle-line"
:
"^0.1.4"
,
"vue-router"
:
"^4.0.0-0"
,
"vuex"
:
"^4.0.0-0"
,
"vuex-persist"
:
"^2.1.0"
},
"devDependencies"
:
{
"@vitejs/plugin-legacy"
:
"^1.4.4"
,
"@vitejs/plugin-vue"
:
"latest"
,
"@vue/cli-plugin-babel"
:
"~4.5.0"
,
"@vue/cli-plugin-eslint"
:
"~4.5.0"
,
"@vue/cli-plugin-router"
:
"~4.5.0"
,
"@vue/cli-plugin-vuex"
:
"~4.5.0"
,
"@vue/cli-service"
:
"~4.5.0"
,
"@vue/compiler-sfc"
:
"^3.1.5"
,
"babel-eslint"
:
"^10.1.0"
,
"babel-plugin-import"
:
"^1.13.3"
,
"dotenv"
:
"^10.0.0"
,
"eslint"
:
"^6.7.2"
,
"eslint-plugin-vue"
:
"^7.0.0"
,
"sass"
:
"^1.26.5"
,
"sass-loader"
:
"^8.0.2"
,
"vite"
:
"2"
,
"vite-plugin-importer"
:
"^0.2.5"
}
}
web/src/style/basics.scss
浏览文件 @
99dd550c
...
...
@@ -14,7 +14,6 @@ $width-mobile-aside:210px;
$color-aside
:
rgba
(
255
,
255
,
255
,
.9
);
$icon-arrow-size-aside
:
12px
;
$width-submenu-aside
:
55px
;
$bg-aside
:
#191a23
;
$height-aside-tilte
:
60px
;
$height-aside-img
:
30px
;
$width-aside-img
:
30px
;
...
...
web/src/style/main.scss
浏览文件 @
99dd550c
...
...
@@ -568,7 +568,6 @@ li {
-webkit-transition
:
width
.2s
;
transition
:
width
.2s
;
width
:
$width-aside
;
background-color
:
$bg-aside
;
height
:
100%
;
position
:
fixed
;
font-size
:
0
;
...
...
@@ -583,7 +582,6 @@ li {
.tilte
{
min-height
:
$height-aside-tilte
;
line-height
:
$height-aside-tilte
;
background
:
$bg-aside
;
text-align
:
center
;
transition
:
all
0
.3s
;
.logoimg
{
...
...
@@ -610,19 +608,13 @@ li {
padding
:
0
15px
!
important
;
}
}
.el-menu-vertical
{
background-color
:
$bg-aside
;
}
.el-sub-menu
{
background-color
:
$bg-aside
;
.el-menu
{
.el-menu-item
{
background-color
:
#000408
;
height
:
44px
;
line-height
:
44px
;
}
.is-active
{
background-color
:
#1890ff
;
// 关闭三级菜单二级菜单样式
ul
{
border
:
none
;
...
...
@@ -630,7 +622,6 @@ li {
}
// 关闭三级菜单二级菜单样式
.is-active.is-opened
{
background-color
:
#191a23
;
ul
{
border
:
none
;
}
...
...
@@ -645,9 +636,6 @@ li {
.el-menu-item
:hover
span
{
color
:
#fff
;
}
.el-sub-menu__title
:hover
{
background-color
:
$bg-aside
;
}
.el-sub-menu__title
:hover
i
,
.el-sub-menu__title
:hover
span
{
color
:
#fff
;
...
...
@@ -1367,4 +1355,4 @@ $mainHight: 100vh;
.justify-content-flex-end
{
justify-content
:
flex-end
;
}
}
\ No newline at end of file
web/src/view/superAdmin/operation/sysOperationRecord.vue
浏览文件 @
99dd550c
...
...
@@ -61,7 +61,7 @@
<el-table-column
align=
"left"
label=
"请求"
prop=
"path"
width=
"80"
>
<
template
#default=
"scope"
>
<div>
<el-popover
v-if=
"scope.row.body"
placement=
"
top-start"
trigger=
"hover
"
>
<el-popover
v-if=
"scope.row.body"
placement=
"
left-start"
trigger=
"click
"
>
<div
class=
"popover-box"
>
<pre>
{{
fmtBody
(
scope
.
row
.
body
)
}}
</pre>
</div>
...
...
@@ -77,7 +77,7 @@
<el-table-column
align=
"left"
label=
"响应"
prop=
"path"
width=
"80"
>
<
template
#default=
"scope"
>
<div>
<el-popover
v-if=
"scope.row.resp"
placement=
"
top-start"
trigger=
"hover
"
>
<el-popover
v-if=
"scope.row.resp"
placement=
"
left-start"
trigger=
"click
"
>
<div
class=
"popover-box"
>
<pre>
{{
fmtBody
(
scope
.
row
.
resp
)
}}
</pre>
</div>
...
...
web/src/view/systemTools/system/system.vue
浏览文件 @
99dd550c
...
...
@@ -43,6 +43,9 @@
<el-form-item
label=
"缓冲期(秒)"
>
<el-input
v-model=
"config.jwt.bufferTime"
/>
</el-form-item>
<el-form-item
label=
"签发者"
>
<el-input
v-model=
"config.jwt.issuer"
/>
</el-form-item>
</el-collapse-item>
<el-collapse-item
title=
"Zap日志配置"
name=
"3"
>
<el-form-item
label=
"级别"
>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录