Skip to content

Commit 83236bc

Browse files
authored
feat(jwt): jWT 权限校验模块 (#13)
Close #10
1 parent e516f7a commit 83236bc

File tree

16 files changed

+287
-129
lines changed

16 files changed

+287
-129
lines changed

CHANGELOG.md

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,6 @@
1212

1313
* **tag:** tag相关 service和dao处理逻辑,及所有模块共有的字段回调 ([6ccfc9d](https://github.com/golang-minibear2333/gin-blog/commit/6ccfc9d40bf42aaae687c11902e6b06435f01cc2))
1414
* **tag:** 更新tag router 完成接口 ([a344bae](https://github.com/golang-minibear2333/gin-blog/commit/a344baee6c8a8a7d376f2abe8b6a3b8a0d7cfb91))
15-
* gin 分页处理 ([572c950](https://github.com/golang-minibear2333/gin-blog/commit/572c9501ae291dafe26c03fdb8d4544d43a09567))
16-
* mysql数据库gorm模块 ([a7ff87a](https://github.com/golang-minibear2333/gin-blog/commit/a7ff87a1174980f0d1beef9cb951689b4be1a6f1))
17-
* string 类型转换 ([597741e](https://github.com/golang-minibear2333/gin-blog/commit/597741e38e39c370bf084d2e1b7021ba7e45304e))
18-
* swagger 接口文档 ([4340349](https://github.com/golang-minibear2333/gin-blog/commit/43403498951748bfb19d845a0fa5ec5acdd068d9))
19-
* swagger 返回值带有interface类型的解决办法 ([fb4d862](https://github.com/golang-minibear2333/gin-blog/commit/fb4d8620e00917366b73fac3ae446bb8047ea994))
20-
* tcp 响应处理 ([56eac52](https://github.com/golang-minibear2333/gin-blog/commit/56eac52db57bdaf9a2de873cf30a459074f80fe6))
21-
* 创建数据库脚本与model ([9c23f23](https://github.com/golang-minibear2333/gin-blog/commit/9c23f238a89208d80f5a7e4892091b6baad846fb))
22-
* 初始化Http服务 ([2f64350](https://github.com/golang-minibear2333/gin-blog/commit/2f643506afac6af48d839fd306c15a4d5576a415))
23-
* 参数校验与国际化 ([510158a](https://github.com/golang-minibear2333/gin-blog/commit/510158ae84813c694182d32c32c6478b282d1852))
24-
* 新增router和controller ([9fc6162](https://github.com/golang-minibear2333/gin-blog/commit/9fc61621bde26e3181a0c64d87aa1f7c8f758a5c))
25-
* 日志模块 ([786a134](https://github.com/golang-minibear2333/gin-blog/commit/786a134d0ef028d4823e821a9fd2dc5bcd193fad))
26-
* 配置模块(配置文件,配置解析,全局变量初始化) ([a3a3112](https://github.com/golang-minibear2333/gin-blog/commit/a3a3112614a1f6438062b1f202b0d6901d69c745))
27-
* 错误码标准化 ([3e79e5a](https://github.com/golang-minibear2333/gin-blog/commit/3e79e5a48fe1c7985f299916aa26b7b5c23814de))
28-
2915

3016

3117
# (2021-06-13)

configs/config.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,12 @@ Database:
3333
Charset: utf8
3434
ParseTime: True
3535
MaxIdleConns: 10
36-
MaxOpenConns: 30
36+
MaxOpenConns: 30
37+
# JWT 身份认证
38+
JWT:
39+
# 密钥
40+
Secret: eddycjy
41+
# 签发者
42+
Issuer: blog-service
43+
# 超时时间
44+
Expire: 7200

global/setting.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ var (
99
ServerSetting *setting.ServerSettingS
1010
AppSetting *setting.AppSettingS
1111
DatabaseSetting *setting.DatabaseSettingS
12+
JWTSetting *setting.JWTSettingS
1213
)
1314

1415
var (

go.mod

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.14
44

55
require (
66
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751
7-
github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect
7+
github.com/dgrijalva/jwt-go v3.2.0+incompatible // indirect
88
github.com/fsnotify/fsnotify v1.4.9 // indirect
99
github.com/gin-gonic/gin v1.7.2
1010
github.com/go-openapi/jsonreference v0.19.6 // indirect
@@ -16,33 +16,24 @@ require (
1616
github.com/golang/protobuf v1.5.2 // indirect
1717
github.com/jinzhu/gorm v1.9.12
1818
github.com/json-iterator/go v1.1.11 // indirect
19-
github.com/kr/pty v1.1.5 // indirect
2019
github.com/leodido/go-urn v1.2.1 // indirect
2120
github.com/magiconair/properties v1.8.5 // indirect
2221
github.com/mailru/easyjson v0.7.7 // indirect
2322
github.com/mattn/go-isatty v0.0.13 // indirect
2423
github.com/mitchellh/mapstructure v1.4.1 // indirect
25-
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
26-
github.com/modern-go/reflect2 v1.0.1 // indirect
2724
github.com/pelletier/go-toml v1.9.2 // indirect
28-
github.com/russross/blackfriday/v2 v2.1.0 // indirect
29-
github.com/satori/go.uuid v1.2.0 // indirect
3025
github.com/spf13/afero v1.6.0 // indirect
3126
github.com/spf13/cast v1.3.1 // indirect
3227
github.com/spf13/jwalterweatherman v1.1.0 // indirect
3328
github.com/spf13/pflag v1.0.5 // indirect
3429
github.com/spf13/viper v1.4.0
35-
github.com/stretchr/objx v0.2.0 // indirect
36-
github.com/swaggo/files v0.0.0-20190704085106-630677cd5c14 // indirect
3730
github.com/swaggo/gin-swagger v1.2.0
3831
github.com/swaggo/swag v1.7.0
3932
github.com/ugorji/go v1.2.6 // indirect
40-
github.com/urfave/cli v1.22.5 // indirect
4133
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a // indirect
4234
golang.org/x/net v0.0.0-20210610132358-84b48f89b13b // indirect
4335
golang.org/x/sys v0.0.0-20210611083646-a4fc73990273 // indirect
44-
golang.org/x/text v0.3.6 // indirect
4536
golang.org/x/tools v0.1.3 // indirect
4637
gopkg.in/natefinch/lumberjack.v2 v2.0.0
47-
gopkg.in/yaml.v2 v2.4.0 // indirect
38+
4839
)

0 commit comments

Comments
 (0)