weird auth debug shit help me god please mongo is weird

This commit is contained in:
GoXLR 2022-10-19 18:34:50 +02:00
parent c46583060d
commit 28213c703e
No known key found for this signature in database
GPG Key ID: 5B163CA341BAA2EA
4 changed files with 9 additions and 6 deletions

View File

@ -1,4 +1,4 @@
mongoUri: mongodb://localhost:27017/VeltAPI mongoUri: mongodb://localhost:27017/HQAPI
redisUri: redis://localhost:6379 redisUri: redis://localhost:6379
network: network:

View File

@ -3,6 +3,7 @@ package net.frozenorb.apiv3.config;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.GsonBuilder; import com.google.gson.GsonBuilder;
import com.google.gson.LongSerializationPolicy;
import net.frozenorb.apiv3.serialization.gson.FollowAnnotationExclusionStrategy; import net.frozenorb.apiv3.serialization.gson.FollowAnnotationExclusionStrategy;
import net.frozenorb.apiv3.serialization.gson.InstantTypeAdapter; import net.frozenorb.apiv3.serialization.gson.InstantTypeAdapter;
@ -17,6 +18,7 @@ public class GsonConfig {
@Bean @Bean
public Gson gson() { public Gson gson() {
return new GsonBuilder() return new GsonBuilder()
.setLongSerializationPolicy(LongSerializationPolicy.STRING)
.registerTypeAdapter(Instant.class, new InstantTypeAdapter()) .registerTypeAdapter(Instant.class, new InstantTypeAdapter())
.setExclusionStrategies(new FollowAnnotationExclusionStrategy()) .setExclusionStrategies(new FollowAnnotationExclusionStrategy())
.create(); .create();

View File

@ -39,7 +39,7 @@ public final class AuthenticationFilter implements Handler<RoutingContext> {
} }
if (accessToken == null) { if (accessToken == null) {
ErrorUtils.respondOther(ctx, 403, "Failed to authorize.", "failedToAuthorizeUnknownKey", ImmutableMap.of()); ErrorUtils.respondOther(ctx, 403, "Failed to authorize. (accessToken is null)", "failedToAuthorizeUnknownKey", ImmutableMap.of());
return; return;
} }
@ -47,7 +47,7 @@ public final class AuthenticationFilter implements Handler<RoutingContext> {
boolean allowed = accessToken.getLockedIps().contains(ctx.request().remoteAddress().host()); boolean allowed = accessToken.getLockedIps().contains(ctx.request().remoteAddress().host());
if (!allowed) { if (!allowed) {
ErrorUtils.respondOther(ctx, 403, "Failed to authorize.", "failedToAuthorizeNoIpWhitelist", ImmutableMap.of()); ErrorUtils.respondOther(ctx, 403, "Failed to authorize. (not allowed)", "failedToAuthorizeNoIpWhitelist", ImmutableMap.of());
return; return;
} }
} }

View File

@ -17,11 +17,12 @@ public final class AuthorizationFilter implements Handler<RoutingContext> {
public void handle(RoutingContext ctx) { public void handle(RoutingContext ctx) {
Actor actor = ctx.get("actor"); Actor actor = ctx.get("actor");
if (actor.isAuthorized()) {
ctx.next(); ctx.next();
/*if (actor.isAuthorized()) {
} else { } else {
ErrorUtils.respondOther(ctx, 403, "Failed to authorize as an approved actor.", "failedToAuthorizeNotApprovedActor", ImmutableMap.of()); ErrorUtils.respondOther(ctx, 403, "Failed to authorize as an approved actor.", "failedToAuthorizeNotApprovedActor", ImmutableMap.of());
} }*/
} }
} }