Skip to content

Commit

Permalink
fix: 修复 jwt 空值的问题。
Browse files Browse the repository at this point in the history
  • Loading branch information
lanyulei committed Nov 18, 2024
1 parent c14ca0d commit 626f169
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions pkg/jwtauth/jwtauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"crypto/rsa"
"errors"
config2 "ferry/tools/config"
"io/ioutil"
"net/http"
"os"
"strings"
"time"

Expand Down Expand Up @@ -234,7 +234,7 @@ func (mw *GinJWTMiddleware) readKeys() error {
}

func (mw *GinJWTMiddleware) privateKey() error {
keyData, err := ioutil.ReadFile(mw.PrivKeyFile)
keyData, err := os.ReadFile(mw.PrivKeyFile)
if err != nil {
return ErrNoPrivKeyFile
}
Expand All @@ -247,7 +247,7 @@ func (mw *GinJWTMiddleware) privateKey() error {
}

func (mw *GinJWTMiddleware) publicKey() error {
keyData, err := ioutil.ReadFile(mw.PubKeyFile)
keyData, err := os.ReadFile(mw.PubKeyFile)
if err != nil {
return ErrNoPubKeyFile
}
Expand Down
4 changes: 2 additions & 2 deletions tools/config/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func InitApplication(cfg *viper.Viper) *Application {
Host: cfg.GetString("host"),
Port: portDefault(cfg),
Name: cfg.GetString("name"),
JwtSecret: cfg.GetString("jwtSecret"),
JwtSecret: viper.GetString("settings.jwt.secret"),
Mode: cfg.GetString("mode"),
DemoMsg: cfg.GetString("demoMsg"),
Domain: cfg.GetString("domain"),
Expand All @@ -41,7 +41,7 @@ func portDefault(cfg *viper.Viper) string {
}

func isHttpsDefault(cfg *viper.Viper) bool {
if cfg.GetString("ishttps") == "" || cfg.GetBool("ishttps") == false{
if cfg.GetString("ishttps") == "" || cfg.GetBool("ishttps") == false {
return false
} else {
return true
Expand Down

0 comments on commit 626f169

Please sign in to comment.