remove unused code

This commit is contained in:
yusing
2024-11-02 03:04:15 +08:00
parent 9889b5a8d3
commit 67b6e40f85
10 changed files with 8 additions and 78 deletions

View File

@@ -32,8 +32,6 @@ var (
const tokenExpiration = 24 * time.Hour
const jwtClaimKeyUsername = "username"
func validatePassword(cred *Credentials) error {
if cred.Username != common.APIUser {
return ErrInvalidUsername.Subject(cred.Username)
@@ -114,7 +112,7 @@ func checkToken(w http.ResponseWriter, r *http.Request) (ok bool) {
var claims Claims
token, err := jwt.ParseWithClaims(tokenCookie.Value, &claims, func(t *jwt.Token) (interface{}, error) {
if _, ok := t.Method.(*jwt.SigningMethodHMAC); !ok {
return nil, fmt.Errorf("Unexpected signing method: %v", t.Header["alg"])
return nil, fmt.Errorf("unexpected signing method: %v", t.Header["alg"])
}
return common.APIJWTSecret, nil
})