friends/nex/register_common_secure_server_protocols.go
Daniel López Guimaraes 66c6e6028a
feat: Implement token validation from common protocols
We have to do special handling for guest accounts, so the insecure
method is enabled on both TicketGranting and SecureConnection. Alongside
that, we override the RegisterEx function to do the additional
processing required by friends.
2025-04-17 20:44:56 +01:00

22 lines
940 B
Go

package nex
import (
"github.com/PretendoNetwork/friends/globals"
nex_secure_connection "github.com/PretendoNetwork/friends/nex/secure-connection"
common_secure_connection "github.com/PretendoNetwork/nex-protocols-common-go/v2/secure-connection"
secure_connection "github.com/PretendoNetwork/nex-protocols-go/v2/secure-connection"
)
func registerCommonSecureServerProtocols() {
secureConnectionProtocol := secure_connection.NewProtocol()
commonSecureConnectionProtocol := common_secure_connection.NewCommonProtocol(secureConnectionProtocol)
// * On account creation the console logs in with a guest account and uses the Register method
commonSecureConnectionProtocol.EnableInsecureRegister()
// * Override RegisterEx so that we can register the user into the ConnectedUsers map
secureConnectionProtocol.RegisterEx = nex_secure_connection.RegisterEx
globals.SecureEndpoint.RegisterServiceProtocol(secureConnectionProtocol)
}