EncryptedAuthCredentialStoreProvider class
Пакет: com.hypixel.hytale.server.core.auth
Файл: com/hypixel/hytale/server/core/auth/EncryptedAuthCredentialStoreProvider.java
implements: AuthCredentialStoreProvider
Поля (2)
| Модификаторы | Тип | Имя |
|---|---|---|
final |
String |
ID |
|
Path |
var1 |
Методы (2)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
abstract |
return new |
EncryptedAuthCredentialStorereturn new EncryptedAuthCredentialStore(var1) |
abstract |
throw new |
IllegalStateExceptionthrow new IllegalStateException("Auth credential store path must be within a trusted directory: " + this.path) |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.server.core.auth;
class="kw">import com.hypixel.hytale.codec.Codec;
class="kw">import com.hypixel.hytale.codec.KeyedCodec;
class="kw">import com.hypixel.hytale.codec.builder.BuilderCodec;
class="kw">import com.hypixel.hytale.common.util.PathUtil;
class="kw">import java.nio.file.Path;
class="kw">import javax.annotation.Nonnull;
class="kw">public class EncryptedAuthCredentialStoreProvider class="kw">implements AuthCredentialStoreProvider {
class="kw">public class="kw">static class="kw">final String ID = "Encrypted";
class="kw">public class="kw">static class="kw">final String DEFAULT_PATH = "auth.enc";
class="kw">public class="kw">static class="kw">final BuilderCodec<EncryptedAuthCredentialStoreProvider> CODEC = BuilderCodec.builder(
EncryptedAuthCredentialStoreProvider.class, EncryptedAuthCredentialStoreProvider::new
)
.append(new KeyedCodec<>("Path", Codec.STRING), (var0, var1) -> var0.path = var1, var0 -> var0.path)
.add()
.build();
class="kw">private String path = "auth.enc";
class="kw">public EncryptedAuthCredentialStoreProvider() {
}
@Nonnull
@Override
class="kw">public IAuthCredentialStore createStore() {
Path var1 = Path.of(this.path);
if (!PathUtil.isInTrustedRoot(var1)) {
throw new IllegalStateException("Auth credential store path must be within a trusted directory: " + this.path);
} else {
class="kw">return new EncryptedAuthCredentialStore(var1);
}
}
@Nonnull
@Override
class="kw">public String toString() {
class="kw">return "EncryptedAuthCredentialStoreProvider{path='" + this.path + "'}";
}
}