updated and added some packages
This commit is contained in:
1 parent
cf3b619b20
commit
6375fc028e
16 files changed
+443
-334
No files matched your search
@@ -0,0 +1,22 @@
|
||||
package auth
|
||||
|
||||
import (
|
||||
"auth_service/api/jwt"
|
||||
"auth_service/model"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func VerifyToken(w http.ResponseWriter, req *http.Request) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
var request model.Token
|
||||
decoder := json.NewDecoder(req.Body)
|
||||
decoder.Decode(&request)
|
||||
_, e := jwt.VerifyJWT(request.Token, jwt.Defaultsecretkey)
|
||||
if e != nil {
|
||||
fmt.Fprintf(w, "{\"status\":403}")
|
||||
return
|
||||
}
|
||||
fmt.Fprintf(w, "{\"status\":200}")
|
||||
}
|
||||
Reference in new issue
Block a user