chore: add guest account

This commit is contained in:
Jonathan Barrow 2024-04-08 16:23:06 -04:00
parent 491b475a9c
commit d6fdde6161
No known key found for this signature in database
GPG Key ID: E86E9FE9049C741F
4 changed files with 11 additions and 0 deletions

View File

@ -19,6 +19,10 @@ func AccountDetailsByPID(pid *types.PID) (*nex.Account, *nex.Error) {
return SecureEndpoint.ServerAccount, nil
}
if pid.Equals(GuestAccount.PID) {
return GuestAccount, nil
}
ctx := metadata.NewOutgoingContext(context.Background(), GRPCAccountCommonMetadata)
response, err := GRPCAccountClient.GetNEXPassword(ctx, &pb.GetNEXPasswordRequest{Pid: pid.LegacyValue()})

View File

@ -20,6 +20,10 @@ func AccountDetailsByUsername(username string) (*nex.Account, *nex.Error) {
return SecureEndpoint.ServerAccount, nil
}
if username == GuestAccount.Username {
return GuestAccount, nil
}
// TODO - This is fine for our needs, but not for servers which use non-PID usernames?
pid, err := strconv.Atoi(username)
if err != nil {

View File

@ -10,6 +10,7 @@ import (
)
var Logger *plogger.Logger
var GuestAccount *nex.Account
var KerberosPassword = "password" // * Default password
var AuthenticationServer *nex.PRUDPServer
var AuthenticationEndpoint *nex.PRUDPEndPoint

View File

@ -26,6 +26,8 @@ func StartSecureServer() {
globals.SecureEndpoint.AccountDetailsByUsername = globals.AccountDetailsByUsername
globals.SecureEndpoint.ServerAccount = nex.NewAccount(types.NewPID(2), "Quazal Rendez-Vous", os.Getenv("PN_FRIENDS_CONFIG_SECURE_PASSWORD"))
globals.GuestAccount = nex.NewAccount(types.NewPID(100), "guest", "MMQea3n!fsik") // * Guest account password is always the same, known to all consoles
globals.SecureEndpoint.OnConnectionEnded(func(connection *nex.PRUDPConnection) {
pid := connection.PID().LegacyValue()