mirror of
https://github.com/ViaVersion/VIAaaS.git
synced 2025-01-25 22:11:20 +01:00
jwt NotBefore, use OpenAuthMod format
This commit is contained in:
parent
43f09c3130
commit
aad148c97e
@ -100,7 +100,7 @@ Web login:
|
|||||||
|
|
||||||
Fabric client:
|
Fabric client:
|
||||||
|
|
||||||
- Install [ParacetamolAuth](https://github.com/creeper123123321/ParacetamolAuth) in your Fabric client.
|
- Install [OpenAuthMod](https://github.com/RaphiMC/OpenAuthMod) in your Fabric client.
|
||||||
- Join the server: ```mc.example.net.via.localhost```
|
- Join the server: ```mc.example.net.via.localhost```
|
||||||
- Approve the login
|
- Approve the login
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package com.viaversion.aas.handler.state
|
package com.viaversion.aas.handler.state
|
||||||
|
|
||||||
import com.google.common.net.HostAndPort
|
import com.google.common.net.HostAndPort
|
||||||
import com.google.gson.JsonPrimitive
|
|
||||||
import com.viaversion.aas.*
|
import com.viaversion.aas.*
|
||||||
import com.viaversion.aas.codec.CryptoCodec
|
import com.viaversion.aas.codec.CryptoCodec
|
||||||
import com.viaversion.aas.codec.packet.Packet
|
import com.viaversion.aas.codec.packet.Packet
|
||||||
@ -14,6 +13,7 @@ import com.viaversion.aas.util.StacklessException
|
|||||||
import com.viaversion.viaversion.api.protocol.packet.State
|
import com.viaversion.viaversion.api.protocol.packet.State
|
||||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion
|
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion
|
||||||
import com.viaversion.viaversion.api.type.Type
|
import com.viaversion.viaversion.api.type.Type
|
||||||
|
import com.viaversion.viaversion.libs.gson.JsonPrimitive
|
||||||
import io.netty.buffer.ByteBufAllocator
|
import io.netty.buffer.ByteBufAllocator
|
||||||
import io.netty.channel.Channel
|
import io.netty.channel.Channel
|
||||||
import io.netty.channel.ChannelHandlerContext
|
import io.netty.channel.ChannelHandlerContext
|
||||||
@ -99,6 +99,7 @@ class LoginState : ConnectionState {
|
|||||||
fun reauthMessage(handler: MinecraftHandler, backName: String, backHash: String): CompletableFuture<Boolean> {
|
fun reauthMessage(handler: MinecraftHandler, backName: String, backHash: String): CompletableFuture<Boolean> {
|
||||||
if (!handler.data.frontEncrypted
|
if (!handler.data.frontEncrypted
|
||||||
|| handler.data.frontVer!! < ProtocolVersion.v1_13.version
|
|| handler.data.frontVer!! < ProtocolVersion.v1_13.version
|
||||||
|
|| !frontName.equals(backName, ignoreCase = true)
|
||||||
) {
|
) {
|
||||||
callbackPluginReauth.complete(false)
|
callbackPluginReauth.complete(false)
|
||||||
return callbackPluginReauth
|
return callbackPluginReauth
|
||||||
@ -106,12 +107,11 @@ class LoginState : ConnectionState {
|
|||||||
|
|
||||||
val buf = ByteBufAllocator.DEFAULT.buffer()
|
val buf = ByteBufAllocator.DEFAULT.buffer()
|
||||||
try {
|
try {
|
||||||
Type.STRING.write(buf, backName)
|
|
||||||
Type.STRING.write(buf, backHash)
|
Type.STRING.write(buf, backHash)
|
||||||
|
|
||||||
val packet = PluginRequest()
|
val packet = PluginRequest()
|
||||||
packet.id = ThreadLocalRandom.current().nextInt()
|
packet.id = ThreadLocalRandom.current().nextInt()
|
||||||
packet.channel = "viaaas:reauth"
|
packet.channel = "openauthmod:join"
|
||||||
packet.data = readRemainingBytes(buf)
|
packet.data = readRemainingBytes(buf)
|
||||||
send(handler.data.frontChannel, packet, true)
|
send(handler.data.frontChannel, packet, true)
|
||||||
pendingReauth = packet.id
|
pendingReauth = packet.id
|
||||||
|
@ -7,13 +7,13 @@ import com.google.common.cache.CacheBuilder
|
|||||||
import com.google.common.cache.CacheLoader
|
import com.google.common.cache.CacheLoader
|
||||||
import com.google.common.collect.MultimapBuilder
|
import com.google.common.collect.MultimapBuilder
|
||||||
import com.google.common.collect.Multimaps
|
import com.google.common.collect.Multimaps
|
||||||
import com.google.gson.JsonObject
|
|
||||||
import com.viaversion.aas.AspirinServer
|
import com.viaversion.aas.AspirinServer
|
||||||
import com.viaversion.aas.config.VIAaaSConfig
|
import com.viaversion.aas.config.VIAaaSConfig
|
||||||
import com.viaversion.aas.parseUndashedId
|
import com.viaversion.aas.parseUndashedId
|
||||||
import com.viaversion.aas.reverseLookup
|
import com.viaversion.aas.reverseLookup
|
||||||
import com.viaversion.aas.util.StacklessException
|
import com.viaversion.aas.util.StacklessException
|
||||||
import com.viaversion.aas.webLogger
|
import com.viaversion.aas.webLogger
|
||||||
|
import com.viaversion.viaversion.libs.gson.JsonObject
|
||||||
import io.ktor.client.request.*
|
import io.ktor.client.request.*
|
||||||
import io.ktor.http.cio.websocket.*
|
import io.ktor.http.cio.websocket.*
|
||||||
import io.ktor.server.netty.*
|
import io.ktor.server.netty.*
|
||||||
@ -42,6 +42,7 @@ class WebDashboardServer {
|
|||||||
fun generateToken(account: UUID, username: String): String {
|
fun generateToken(account: UUID, username: String): String {
|
||||||
return JWT.create()
|
return JWT.create()
|
||||||
.withIssuedAt(Date())
|
.withIssuedAt(Date())
|
||||||
|
.withNotBefore(Date())
|
||||||
.withExpiresAt(Date.from(Instant.now().plus(Duration.ofDays(30))))
|
.withExpiresAt(Date.from(Instant.now().plus(Duration.ofDays(30))))
|
||||||
.withSubject(account.toString())
|
.withSubject(account.toString())
|
||||||
.withClaim("name", username)
|
.withClaim("name", username)
|
||||||
|
Loading…
Reference in New Issue
Block a user