GOG GALAXY SDK Documentation
IUser.h
Go to the documentation of this file.
1 #ifndef GALAXY_I_USER_H
2 #define GALAXY_I_USER_H
3 
9 #include "GalaxyID.h"
10 #include "IListenerRegistrar.h"
11 
12 namespace galaxy
13 {
14  namespace api
15  {
24  typedef uint64_t SessionID;
25 
30  {
31  public:
32 
36  virtual void OnAuthSuccess() = 0;
37 
42  {
51  };
52 
58  virtual void OnAuthFailure(FailureReason failureReason) = 0;
59 
65  virtual void OnAuthLost() = 0;
66  };
67 
72 
77 
81  class IOtherSessionStartListener : public GalaxyTypeAwareListener<OTHER_SESSION_START>
82  {
83  public:
84 
88  virtual void OnOtherSessionStarted() = 0;
89  };
90 
95 
100 
104  class IOperationalStateChangeListener : public GalaxyTypeAwareListener<OPERATIONAL_STATE_CHANGE>
105  {
106  public:
107 
112  {
115  };
116 
122  virtual void OnOperationalStateChanged(uint32_t operationalState) = 0;
123  };
124 
129 
134 
141  class IUserDataListener : public GalaxyTypeAwareListener<USER_DATA>
142  {
143  public:
144 
148  virtual void OnUserDataUpdated() = 0;
149  };
150 
155 
160 
164  class ISpecificUserDataListener : public GalaxyTypeAwareListener<SPECIFIC_USER_DATA>
165  {
166  public:
167 
173  virtual void OnSpecificUserDataUpdated(GalaxyID userID) = 0;
174  };
175 
180 
185 
189  class IEncryptedAppTicketListener : public GalaxyTypeAwareListener<ENCRYPTED_APP_TICKET_RETRIEVE>
190  {
191  public:
192 
199 
204  {
207  };
208 
214  virtual void OnEncryptedAppTicketRetrieveFailure(FailureReason failureReason) = 0;
215  };
216 
221 
226 
227 
231  class IAccessTokenListener : public GalaxyTypeAwareListener<ACCESS_TOKEN_CHANGE>
232  {
233  public:
234 
240  virtual void OnAccessTokenChanged() = 0;
241  };
242 
247 
252 
256  class IPlayFabCreateOpenIDConnectionListener : public GalaxyTypeAwareListener<PLAYFAB_CREATE_OPENID_CONNECTION>
257  {
258  public:
259 
264  virtual void OnPlayFabCreateOpenIDConnectionSuccess(bool connectionAlreadyExists) = 0;
265 
267  {
270  };
271 
277  virtual void OnPlayFabCreateOpenIDConnectionFailure(FailureReason failureReason) = 0;
278  };
279 
284 
289 
293  class IPlayFabLoginWithOpenIDConnectListener : public GalaxyTypeAwareListener<PLAYFAB_LOGIN_WITH_OPENID_CONNECT>
294  {
295  public:
296 
302 
304  {
307  };
308 
314  virtual void OnPlayFabLoginWithOpenIDConnectFailure(FailureReason failureReason) = 0;
315  };
316 
321 
326 
330  class IUser
331  {
332  public:
333 
334  virtual ~IUser()
335  {
336  }
337 
355  virtual bool SignedIn() = 0;
356 
362  virtual GalaxyID GetGalaxyID() = 0;
363 
380  virtual void SignInCredentials(const char* login, const char* password, IAuthListener* const listener = NULL) = 0;
381 
397  virtual void SignInToken(const char* refreshToken, IAuthListener* const listener = NULL) = 0;
398 
412  virtual void SignInLauncher(IAuthListener* const listener = NULL) = 0;
413 
428  virtual void SignInSteam(const void* steamAppTicket, uint32_t steamAppTicketSize, const char* personaName, IAuthListener* const listener = NULL) = 0;
429 
443  virtual void SignInGalaxy(bool requireOnline = false, uint32_t timeout = 15, IAuthListener* const listener = NULL) = 0;
444 
457  virtual void SignInPS4(const char* ps4ClientID, IAuthListener* const listener = NULL) = 0;
458 
471  virtual void SignInXB1(const char* xboxOneUserID, IAuthListener* const listener = NULL) = 0;
472 
485  virtual void SignInXbox(uint64_t xboxID, IAuthListener* const listener = NULL) = 0;
486 
502  virtual void SignInXBLive(const char* token, const char* signature, const char* marketplaceID, const char* locale, IAuthListener* const listener = NULL) = 0;
503 
515  virtual void SignInAnonymous(IAuthListener* const listener = NULL) = 0;
516 
527  virtual void SignInAnonymousTelemetry(IAuthListener* const listener = NULL) = 0;
528 
545  virtual void SignInServerKey(const char* serverKey, IAuthListener* const listener = NULL) = 0;
546 
560  virtual void SignInAuthorizationCode(const char* authorizationCode, const char* redirectURI, IAuthListener* const listener = NULL) = 0;
561 
570  virtual void SignOut() = 0;
571 
580  virtual void RequestUserData(GalaxyID userID = GalaxyID(), ISpecificUserDataListener* const listener = NULL) = 0;
581 
590  virtual bool IsUserDataAvailable(GalaxyID userID = GalaxyID()) = 0;
591 
603  virtual const char* GetUserData(const char* key, GalaxyID userID = GalaxyID()) = 0;
604 
615  virtual void GetUserDataCopy(const char* key, char* buffer, uint32_t bufferLength, GalaxyID userID = GalaxyID()) = 0;
616 
628  virtual void SetUserData(const char* key, const char* value, ISpecificUserDataListener* const listener = NULL) = 0;
629 
638  virtual uint32_t GetUserDataCount(GalaxyID userID = GalaxyID()) = 0;
639 
653  virtual bool GetUserDataByIndex(uint32_t index, char* key, uint32_t keyLength, char* value, uint32_t valueLength, GalaxyID userID = GalaxyID()) = 0;
654 
666  virtual void DeleteUserData(const char* key, ISpecificUserDataListener* const listener = NULL) = 0;
667 
680  virtual bool IsLoggedOn() = 0;
681 
691  virtual void RequestEncryptedAppTicket(const void* data, uint32_t dataSize, IEncryptedAppTicketListener* const listener = NULL) = 0;
692 
705  virtual void GetEncryptedAppTicket(void* encryptedAppTicket, uint32_t maxEncryptedAppTicketSize, uint32_t& currentEncryptedAppTicketSize) = 0;
706 
717  virtual void CreateOpenIDConnection(const char* secretKey, const char* titleID, const char* connectionID, bool ignoreNonce = true, IPlayFabCreateOpenIDConnectionListener* const listener = NULL) = 0;
718 
731  virtual void LoginWithOpenIDConnect(const char* titleID, const char* connectionID, const char* idToken, bool createAccount = true, const char* encryptedRequest = NULL, const char* playerSecret = NULL, IPlayFabLoginWithOpenIDConnectListener* const listener = NULL) = 0;
732 
738  virtual SessionID GetSessionID() = 0;
739 
752  virtual const char* GetAccessToken() = 0;
753 
765  virtual void GetAccessTokenCopy(char* buffer, uint32_t bufferLength) = 0;
766 
782  virtual const char* GetRefreshToken() = 0;
783 
798  virtual void GetRefreshTokenCopy(char* buffer, uint32_t bufferLength) = 0;
799 
815  virtual const char* GetIDToken() = 0;
816 
831  virtual void GetIDTokenCopy(char* buffer, uint32_t bufferLength) = 0;
832 
854  virtual bool ReportInvalidAccessToken(const char* accessToken, const char* info = NULL) = 0;
855  };
856 
858  }
859 }
860 
861 #endif
Contains GalaxyID, which is the class that represents the ID of an entity used by Galaxy Peer.
Contains data structures and interfaces related to callback listeners.
Represents the ID of an entity used by Galaxy Peer.
Definition: GalaxyID.h:30
The class that is inherited by all specific callback listeners and provides a static method that retu...
Definition: IListenerRegistrar.h:117
Listener for the event of a change of current access token.
Definition: IUser.h:232
virtual void OnAccessTokenChanged()=0
Notification for an event of retrieving an access token.
Listener for the events related to user authentication.
Definition: IUser.h:30
virtual void OnAuthLost()=0
Notification for the event of loosing authentication.
FailureReason
Reason of authentication failure.
Definition: IUser.h:42
@ FAILURE_REASON_GALAXY_SERVICE_NOT_AVAILABLE
Galaxy Service is not installed properly or fails to start.
Definition: IUser.h:44
@ FAILURE_REASON_GALAXY_SERVICE_NOT_SIGNED_IN
Galaxy Service is not signed in properly.
Definition: IUser.h:45
@ FAILURE_REASON_UNDEFINED
Undefined error.
Definition: IUser.h:43
@ FAILURE_REASON_INVALID_CREDENTIALS
Unable to match client credentials (ID, secret) or user credentials (username, password).
Definition: IUser.h:48
@ FAILURE_REASON_EXTERNAL_SERVICE_FAILURE
Unable to communicate with external service.
Definition: IUser.h:50
@ FAILURE_REASON_CONNECTION_FAILURE
Unable to communicate with backend services.
Definition: IUser.h:46
@ FAILURE_REASON_NO_LICENSE
User that is being signed in has no license for this application.
Definition: IUser.h:47
@ FAILURE_REASON_GALAXY_NOT_INITIALIZED
Galaxy has not been initialized.
Definition: IUser.h:49
virtual void OnAuthSuccess()=0
Notification for the event of successful sign in.
virtual void OnAuthFailure(FailureReason failureReason)=0
Notification for the event of unsuccessful sign in.
Listener for the event of retrieving a requested Encrypted App Ticket.
Definition: IUser.h:190
FailureReason
The reason of a failure in retrieving an Encrypted App Ticket.
Definition: IUser.h:204
@ FAILURE_REASON_UNDEFINED
Unspecified error.
Definition: IUser.h:205
@ FAILURE_REASON_CONNECTION_FAILURE
Unable to communicate with backend services.
Definition: IUser.h:206
virtual void OnEncryptedAppTicketRetrieveFailure(FailureReason failureReason)=0
Notification for the event of a failure in retrieving an Encrypted App Ticket.
virtual void OnEncryptedAppTicketRetrieveSuccess()=0
Notification for an event of a success in retrieving the Encrypted App Ticket.
Listener for the event of a change of the operational state.
Definition: IUser.h:105
virtual void OnOperationalStateChanged(uint32_t operationalState)=0
Notification for the event of a change of the operational state.
OperationalState
Aspect of the operational state.
Definition: IUser.h:112
@ OPERATIONAL_STATE_LOGGED_ON
User logged on.
Definition: IUser.h:114
@ OPERATIONAL_STATE_SIGNED_IN
User signed in.
Definition: IUser.h:113
Listener for the events related to starting of other sessions.
Definition: IUser.h:82
virtual void OnOtherSessionStarted()=0
Notification for the event of other session being started.
Listener for the event of creating an OpenID connection.
Definition: IUser.h:257
virtual void OnPlayFabCreateOpenIDConnectionSuccess(bool connectionAlreadyExists)=0
Notification for an event of a success in creating OpenID connection.
@ FAILURE_REASON_UNDEFINED
Unspecified error.
Definition: IUser.h:268
@ FAILURE_REASON_CONNECTION_FAILURE
Unable to communicate with backend services.
Definition: IUser.h:269
virtual void OnPlayFabCreateOpenIDConnectionFailure(FailureReason failureReason)=0
Notification for the event of a failure in creating OpenID connection.
Listener for the event of logging with an OpenID Connect.
Definition: IUser.h:294
@ FAILURE_REASON_UNDEFINED
Unspecified error.
Definition: IUser.h:305
@ FAILURE_REASON_CONNECTION_FAILURE
Unable to communicate with backend services.
Definition: IUser.h:306
virtual void OnPlayFabLoginWithOpenIDConnectFailure(FailureReason failureReason)=0
Notification for the event of a failure in logging with OpenID Connect.
virtual void OnPlayFabLoginWithOpenIDConnectSuccess()=0
Notification for an event of a success in logging with OpenID Connect.
Listener for the events related to user data changes.
Definition: IUser.h:165
virtual void OnSpecificUserDataUpdated(GalaxyID userID)=0
Notification for the event of user data change.
Listener for the events related to user data changes of current user only.
Definition: IUser.h:142
virtual void OnUserDataUpdated()=0
Notification for the event of user data change.
The interface for handling the user account.
Definition: IUser.h:331
virtual void SignInGalaxy(bool requireOnline=false, uint32_t timeout=15, IAuthListener *const listener=NULL)=0
Authenticates the Galaxy Peer based on Galaxy Client authentication.
virtual void SignOut()=0
Signs the Galaxy Peer out.
virtual void SignInToken(const char *refreshToken, IAuthListener *const listener=NULL)=0
Authenticates the Galaxy Peer with refresh token.
virtual bool GetUserDataByIndex(uint32_t index, char *key, uint32_t keyLength, char *value, uint32_t valueLength, GalaxyID userID=GalaxyID())=0
Returns a property from the user data storage by index.
virtual void RequestEncryptedAppTicket(const void *data, uint32_t dataSize, IEncryptedAppTicketListener *const listener=NULL)=0
Performs a request for an Encrypted App Ticket.
virtual void SetUserData(const char *key, const char *value, ISpecificUserDataListener *const listener=NULL)=0
Creates or updates an entry in the user data storage.
virtual bool IsLoggedOn()=0
Checks if the user is logged on to Galaxy backend services.
virtual GalaxyID GetGalaxyID()=0
Returns the ID of the user, provided that the user is signed in.
virtual const char * GetRefreshToken()=0
Returns the refresh token for the current session.
virtual void SignInXB1(const char *xboxOneUserID, IAuthListener *const listener=NULL)=0
Authenticates the Galaxy Peer based on XBOX ONE credentials.
virtual const char * GetAccessToken()=0
Returns the access token for current session.
virtual bool ReportInvalidAccessToken(const char *accessToken, const char *info=NULL)=0
Reports current access token as no longer working.
virtual void SignInServerKey(const char *serverKey, IAuthListener *const listener=NULL)=0
Authenticates the Galaxy Peer with a specified server key.
virtual void SignInAnonymousTelemetry(IAuthListener *const listener=NULL)=0
Authenticates the Galaxy Peer anonymously.
virtual void SignInXBLive(const char *token, const char *signature, const char *marketplaceID, const char *locale, IAuthListener *const listener=NULL)=0
Authenticates the Galaxy Peer based on Xbox Live tokens.
virtual bool IsUserDataAvailable(GalaxyID userID=GalaxyID())=0
Checks if user data exists.
virtual void SignInSteam(const void *steamAppTicket, uint32_t steamAppTicketSize, const char *personaName, IAuthListener *const listener=NULL)=0
Authenticates the Galaxy Peer based on Steam Encrypted App Ticket.
virtual void LoginWithOpenIDConnect(const char *titleID, const char *connectionID, const char *idToken, bool createAccount=true, const char *encryptedRequest=NULL, const char *playerSecret=NULL, IPlayFabLoginWithOpenIDConnectListener *const listener=NULL)=0
Performs a request for a PlayFab's LoginWithOpenIdConnect.
virtual void SignInPS4(const char *ps4ClientID, IAuthListener *const listener=NULL)=0
Authenticates the Galaxy Peer based on PS4 credentials.
virtual void RequestUserData(GalaxyID userID=GalaxyID(), ISpecificUserDataListener *const listener=NULL)=0
Retrieves/Refreshes user data storage.
virtual void GetEncryptedAppTicket(void *encryptedAppTicket, uint32_t maxEncryptedAppTicketSize, uint32_t &currentEncryptedAppTicketSize)=0
Returns the Encrypted App Ticket.
virtual void GetAccessTokenCopy(char *buffer, uint32_t bufferLength)=0
Copies the access token for current session.
virtual void SignInAnonymous(IAuthListener *const listener=NULL)=0
Authenticates the Galaxy Game Server anonymously.
virtual SessionID GetSessionID()=0
Returns the ID of current session.
virtual const char * GetUserData(const char *key, GalaxyID userID=GalaxyID())=0
Returns an entry from the data storage of current user.
virtual bool SignedIn()=0
Checks if the user is signed in to Galaxy.
virtual void SignInCredentials(const char *login, const char *password, IAuthListener *const listener=NULL)=0
Authenticates the Galaxy Peer with specified user credentials.
virtual uint32_t GetUserDataCount(GalaxyID userID=GalaxyID())=0
Returns the number of entries in the user data storage.
virtual void GetRefreshTokenCopy(char *buffer, uint32_t bufferLength)=0
Copies the refresh token for the current session.
virtual void GetIDTokenCopy(char *buffer, uint32_t bufferLength)=0
Copies the id token for the current session.
virtual void CreateOpenIDConnection(const char *secretKey, const char *titleID, const char *connectionID, bool ignoreNonce=true, IPlayFabCreateOpenIDConnectionListener *const listener=NULL)=0
Performs a request for a PlayFab's CreateOpenIdConnection.
virtual void SignInLauncher(IAuthListener *const listener=NULL)=0
Authenticates the Galaxy Peer based on launcher authentication.
virtual void SignInXbox(uint64_t xboxID, IAuthListener *const listener=NULL)=0
Authenticates the Galaxy Peer based on XBOX GDK credentials.
virtual void GetUserDataCopy(const char *key, char *buffer, uint32_t bufferLength, GalaxyID userID=GalaxyID())=0
Copies an entry from the data storage of current user.
virtual void DeleteUserData(const char *key, ISpecificUserDataListener *const listener=NULL)=0
Clears a property of user data storage.
virtual const char * GetIDToken()=0
Returns the id token for the current session.
virtual void SignInAuthorizationCode(const char *authorizationCode, const char *redirectURI, IAuthListener *const listener=NULL)=0
Authenticates the Galaxy Peer based on OpenID Connect generated authorization code.
The class that is inherited by the self-registering versions of all specific callback listeners.
Definition: IListenerRegistrar.h:211
SelfRegisteringListener< IAccessTokenListener, GameServerListenerRegistrar > GameServerGlobalAccessTokenListener
Globally self-registering version of IAccessTokenListener for the GameServer.
Definition: IUser.h:251
SelfRegisteringListener< IOperationalStateChangeListener, GameServerListenerRegistrar > GameServerGlobalOperationalStateChangeListener
Globally self-registering version of IOperationalStateChangeListener for the GameServer.
Definition: IUser.h:133
SelfRegisteringListener< IOtherSessionStartListener > GlobalOtherSessionStartListener
Globally self-registering version of IOtherSessionStartListener.
Definition: IUser.h:94
SelfRegisteringListener< ISpecificUserDataListener > GlobalSpecificUserDataListener
Globally self-registering version of ISpecificUserDataListener.
Definition: IUser.h:179
SelfRegisteringListener< IUserDataListener > GlobalUserDataListener
Globally self-registering version of IUserDataListener.
Definition: IUser.h:154
SelfRegisteringListener< IEncryptedAppTicketListener, GameServerListenerRegistrar > GameServerGlobalEncryptedAppTicketListener
Globally self-registering version of IEncryptedAppTicketListener for the Game Server.
Definition: IUser.h:225
SelfRegisteringListener< IPlayFabCreateOpenIDConnectionListener, GameServerListenerRegistrar > GameServerGlobalPlayFabCreateOpenIDConnectionListener
Globally self-registering version of IPlayFabCreateOpenIDConnectionListener for the GameServer.
Definition: IUser.h:288
SelfRegisteringListener< IAuthListener > GlobalAuthListener
Globally self-registering version of IAuthListener.
Definition: IUser.h:71
SelfRegisteringListener< IUserDataListener, GameServerListenerRegistrar > GameServerGlobalUserDataListener
Globally self-registering version of IUserDataListener for the GameServer.
Definition: IUser.h:159
SelfRegisteringListener< IOperationalStateChangeListener > GlobalOperationalStateChangeListener
Globally self-registering version of IOperationalStateChangeListener.
Definition: IUser.h:128
SelfRegisteringListener< IAccessTokenListener > GlobalAccessTokenListener
Globally self-registering version of IAccessTokenListener.
Definition: IUser.h:246
SelfRegisteringListener< IPlayFabLoginWithOpenIDConnectListener > GlobalPlayFabLoginWithOpenIDConnectListener
Globally self-registering version of IPlayFabLoginWithOpenIDConnectListener.
Definition: IUser.h:320
SelfRegisteringListener< IOtherSessionStartListener, GameServerListenerRegistrar > GameServerGlobalOtherSessionStartListener
Globally self-registering version of IOtherSessionStartListener for the Game Server.
Definition: IUser.h:99
uint64_t SessionID
The ID of the session.
Definition: IUser.h:24
SelfRegisteringListener< IEncryptedAppTicketListener > GlobalEncryptedAppTicketListener
Globally self-registering version of IEncryptedAppTicketListener.
Definition: IUser.h:220
SelfRegisteringListener< IPlayFabLoginWithOpenIDConnectListener, GameServerListenerRegistrar > GameServerGlobalPlayFabLoginWithOpenIDConnectListener
Globally self-registering version of IPlayFabLoginWithOpenIDConnectListener for the GameServer.
Definition: IUser.h:325
SelfRegisteringListener< ISpecificUserDataListener, GameServerListenerRegistrar > GameServerGlobalSpecificUserDataListener
Globally self-registering version of ISpecificUserDataListener for the Game Server.
Definition: IUser.h:184
SelfRegisteringListener< IPlayFabCreateOpenIDConnectionListener > GlobalPlayFabCreateOpenIDConnectionListener
Globally self-registering version of IPlayFabCreateOpenIDConnectionListener.
Definition: IUser.h:283
SelfRegisteringListener< IAuthListener, GameServerListenerRegistrar > GameServerGlobalAuthListener
Globally self-registering version of IAuthListener for the Game Server.
Definition: IUser.h:76