Change sso to grab from "sso.ticket"

This commit is contained in:
Bill 2021-12-13 00:39:51 -05:00
parent 240d3d0e43
commit 0f9ebe76fd

View File

@ -16,7 +16,6 @@ export class NitroCommunicationDemo extends NitroManager
{ {
private _communication: INitroCommunicationManager; private _communication: INitroCommunicationManager;
private _sso: string;
private _handShaking: boolean; private _handShaking: boolean;
private _didConnect: boolean; private _didConnect: boolean;
@ -28,7 +27,6 @@ export class NitroCommunicationDemo extends NitroManager
this._communication = communication; this._communication = communication;
this._sso = null;
this._handShaking = false; this._handShaking = false;
this._didConnect = false; this._didConnect = false;
@ -66,7 +64,6 @@ export class NitroCommunicationDemo extends NitroManager
connection.removeEventListener(SocketConnectionEvent.CONNECTION_ERROR, this.onConnectionErrorEvent); connection.removeEventListener(SocketConnectionEvent.CONNECTION_ERROR, this.onConnectionErrorEvent);
} }
this._sso = null;
this._handShaking = false; this._handShaking = false;
this.stopPonging(); this.stopPonging();
@ -117,9 +114,9 @@ export class NitroCommunicationDemo extends NitroManager
private tryAuthentication(connection: IConnection): void private tryAuthentication(connection: IConnection): void
{ {
if(!connection || !this._sso) if(!connection || !this.getSSO())
{ {
if(!this._sso) if(!this.getSSO())
{ {
NitroLogger.log('Login without an SSO ticket is not supported'); NitroLogger.log('Login without an SSO ticket is not supported');
} }
@ -129,7 +126,7 @@ export class NitroCommunicationDemo extends NitroManager
return; return;
} }
connection.send(new SSOTicketMessageComposer(this._sso, Nitro.instance.time)); connection.send(new SSOTicketMessageComposer(this.getSSO(), Nitro.instance.time));
} }
private onClientPingEvent(event: ClientPingEvent): void private onClientPingEvent(event: ClientPingEvent): void
@ -147,18 +144,9 @@ export class NitroCommunicationDemo extends NitroManager
this.dispatchCommunicationDemoEvent(NitroCommunicationDemoEvent.CONNECTION_AUTHENTICATED, event.connection); this.dispatchCommunicationDemoEvent(NitroCommunicationDemoEvent.CONNECTION_AUTHENTICATED, event.connection);
//event.connection.send(new UserHomeRoomComposer(555));
event.connection.send(new InfoRetrieveMessageComposer()); event.connection.send(new InfoRetrieveMessageComposer());
} }
public setSSO(sso: string): void
{
if(!sso || (sso === '') || this._sso) return;
this._sso = sso;
}
private startHandshake(connection: IConnection): void private startHandshake(connection: IConnection): void
{ {
this.dispatchCommunicationDemoEvent(NitroCommunicationDemoEvent.CONNECTION_HANDSHAKING, connection); this.dispatchCommunicationDemoEvent(NitroCommunicationDemoEvent.CONNECTION_HANDSHAKING, connection);
@ -202,4 +190,9 @@ export class NitroCommunicationDemo extends NitroManager
{ {
Nitro.instance.events.dispatchEvent(new NitroCommunicationDemoEvent(type, connection)); Nitro.instance.events.dispatchEvent(new NitroCommunicationDemoEvent(type, connection));
} }
private getSSO(): string
{
return Nitro.instance.getConfiguration('sso.ticket', null);
}
} }