File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,9 @@ func RegisterRoutes(mux *http.ServeMux) {
1313
1414 /* for monitoring the state of overall server and laclm backend */
1515 mux .Handle ("GET /health" , http .HandlerFunc (
16- middleware .LoggingMiddleware (health .HealthHandler ),
16+ middleware .LoggingMiddleware (
17+ middleware .AuthenticationMiddleware (health .HealthHandler ),
18+ ),
1719 ))
1820
1921 /* for logging into the backend and creating a session */
Original file line number Diff line number Diff line change @@ -33,11 +33,11 @@ func ValidateJWT(tokenString string) (jwt.MapClaims, error) {
3333 if _ , ok := token .Method .(* jwt.SigningMethodHMAC ); ! ok {
3434 return nil , fmt .Errorf ("unexpected signing method" )
3535 }
36- return config .BackendConfig .BackendSecurity .JWTTokenSecret , nil
36+ return [] byte ( config .BackendConfig .BackendSecurity .JWTTokenSecret ) , nil
3737 })
3838
3939 if err != nil {
40- return nil , err
40+ return nil , fmt . Errorf ( "JWT parsing error: %w" , err )
4141 }
4242
4343 if claims , ok := token .Claims .(jwt.MapClaims ); ok && token .Valid {
@@ -53,7 +53,7 @@ func GetUsernameFromJWT(tokenString string) (string, error) {
5353 /* get claims from JWT Token */
5454 claims , err := ValidateJWT (tokenString )
5555 if err != nil {
56- return "" , err
56+ return "" , fmt . Errorf ( "JWT validation error: %w" , err )
5757 }
5858
5959 /* extract username from JWT Token */
You can’t perform that action at this time.
0 commit comments