Rename some classes to fit Google's Java standards
This commit is contained in:
parent
63b1e7b2c3
commit
a92dee1e6f
@ -4,7 +4,7 @@ import com.google.common.collect.ImmutableMap;
|
||||
import com.mongodb.Block;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.frozenorb.apiv3.model.User;
|
||||
import net.frozenorb.apiv3.util.UUIDUtils;
|
||||
import net.frozenorb.apiv3.util.UuidUtils;
|
||||
import org.bson.Document;
|
||||
import org.bson.types.ObjectId;
|
||||
|
||||
@ -30,7 +30,7 @@ public final class UserConverter implements Block<Document> {
|
||||
|
||||
UUID uuid = UUID.fromString(uuidString.replaceFirst("([0-9a-fA-F]{8})([0-9a-fA-F]{4})([0-9a-fA-F]{4})([0-9a-fA-F]{4})([0-9a-fA-F]+)", "$1-$2-$3-$4-$5"));
|
||||
|
||||
if (!UUIDUtils.isAcceptableUUID(uuid)) {
|
||||
if (!UuidUtils.isAcceptableUuid(uuid)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ import com.fasterxml.jackson.databind.JsonDeserializer;
|
||||
import java.io.IOException;
|
||||
import java.util.UUID;
|
||||
|
||||
public class UUIDJsonDeserializer extends JsonDeserializer<UUID> {
|
||||
public final class UuidJsonDeserializer extends JsonDeserializer<UUID> {
|
||||
|
||||
@Override
|
||||
public UUID deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
|
||||
|
@ -8,7 +8,7 @@ import com.fasterxml.jackson.databind.SerializerProvider;
|
||||
import java.io.IOException;
|
||||
import java.util.UUID;
|
||||
|
||||
public final class UUIDJsonSerializer extends JsonSerializer<UUID> {
|
||||
public final class UuidJsonSerializer extends JsonSerializer<UUID> {
|
||||
|
||||
@Override
|
||||
public void serialize(UUID uuid, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException, JsonProcessingException {
|
||||
|
@ -8,7 +8,7 @@ import org.bson.codecs.EncoderContext;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public final class UUIDCodec implements Codec<UUID> {
|
||||
public final class UuidCodec implements Codec<UUID> {
|
||||
|
||||
@Override
|
||||
public UUID decode(BsonReader bsonReader, DecoderContext decoderContext) {
|
||||
|
@ -6,11 +6,11 @@ import org.bson.codecs.configuration.CodecRegistry;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public final class UUIDCodecProvider implements CodecProvider {
|
||||
public final class UuidCodecProvider implements CodecProvider {
|
||||
|
||||
public <T> Codec<T> get(Class<T> clazz, CodecRegistry codecRegistry) {
|
||||
if (clazz == UUID.class) {
|
||||
return (Codec<T>) new UUIDCodec();
|
||||
return (Codec<T>) new UuidCodec();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import com.bugsnag.Logger;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
public class BugsnagSLF4JLogger extends Logger {
|
||||
public class BugsnagSlf4jLogger extends Logger {
|
||||
|
||||
public void debug(String message) {
|
||||
log.debug(message);
|
||||
|
@ -12,11 +12,11 @@ import net.frozenorb.apiv3.model.User;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@UtilityClass
|
||||
public class TOTPUtils {
|
||||
public class TotpUtils {
|
||||
|
||||
private static GoogleAuthenticator googleAuthenticator = new GoogleAuthenticator(new GoogleAuthenticatorConfig.GoogleAuthenticatorConfigBuilder().setWindowSize(10).build());
|
||||
|
||||
public static GoogleAuthenticatorKey generateTOTPSecret() {
|
||||
public static GoogleAuthenticatorKey generateTotpSecret() {
|
||||
return googleAuthenticator.createCredentials();
|
||||
}
|
||||
|
||||
@ -24,7 +24,7 @@ public class TOTPUtils {
|
||||
return googleAuthenticator.authorize(user.getTotpSecret(), code);
|
||||
}
|
||||
|
||||
public static String getQRCodeURL(User user, GoogleAuthenticatorKey secret) {
|
||||
public static String getQrCodeUrl(User user, GoogleAuthenticatorKey secret) {
|
||||
return GoogleAuthenticatorQRGenerator.getOtpAuthURL(
|
||||
"MineHQ Network",
|
||||
user.getLastUsername(),
|
||||
|
@ -5,9 +5,9 @@ import lombok.experimental.UtilityClass;
|
||||
import java.util.UUID;
|
||||
|
||||
@UtilityClass
|
||||
public class UUIDUtils {
|
||||
public class UuidUtils {
|
||||
|
||||
public static boolean isAcceptableUUID(UUID uuid) {
|
||||
public static boolean isAcceptableUuid(UUID uuid) {
|
||||
return uuid.version() == 4;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user