improved authentication check

This commit is contained in:
2021-09-24 15:49:51 +02:00
parent ed932e3c92
commit f59f3183f2
4 changed files with 27 additions and 32 deletions

View File

@@ -101,7 +101,7 @@ func InitHttp(resolveContext context.Context, schema graphql.Schema, address str
}
func httpGetFile(ctx context.Context, rw http.ResponseWriter, r *http.Request) {
if is, _ := helper.IsAuth(r.Context()); !is {
if helper.IsAuthenticated(r.Context()) {
rw.WriteHeader(http.StatusUnauthorized)
return
}
@@ -145,7 +145,7 @@ func httpGetFile(ctx context.Context, rw http.ResponseWriter, r *http.Request) {
}
func httpPostFile(ctx context.Context, rw http.ResponseWriter, r *http.Request) {
if is, _ := helper.IsAuth(r.Context()); !is {
if helper.IsAuthenticated(r.Context()) {
rw.WriteHeader(http.StatusUnauthorized)
return
}
@@ -244,7 +244,7 @@ func logout(rw http.ResponseWriter, r *http.Request) {
}
func refreshToken(rw http.ResponseWriter, r *http.Request) {
if is, _ := helper.IsAuth(r.Context()); !is {
if helper.IsAuthenticated(r.Context()) {
rw.WriteHeader(http.StatusUnauthorized)
return
}