Class IXAuthentication

java.lang.Object
de.elo.ix.client.IXAuthentication
All Implemented Interfaces:
byps.BAuthentication, IXAuthenticationIF

public abstract class IXAuthentication extends Object implements byps.BAuthentication, IXAuthenticationIF
BAuthentication implementation for IXConnection.
  • Field Details

  • Constructor Details

    • IXAuthentication

      protected IXAuthentication(ClientInfo clientInfo, Properties sessOpts, EAuthenticationType authType)
      Constructor
      Parameters:
      clientInfo - ClientInfo
      sessOpts - Session options
      authType - Authentication type
  • Method Details

    • internalAuthenticate

      protected abstract void internalAuthenticate(de.elo.ix.client.BClient_Indexserver client, byps.BAsyncResult<Boolean> asyncResult)
      Process authentication. Login with name/password, etc. Store the LoginResult in this.loginResult.
      Parameters:
      client -
      asyncResult -
    • getLoginResult

      public LoginResult getLoginResult()
      LoginResult received from Indexserver as the result of authentication.
      Specified by:
      getLoginResult in interface IXAuthenticationIF
      Returns:
      LoginResult
    • authenticate

      public void authenticate(byps.BClient client1, byps.BAsyncResult<Boolean> asyncResult)
      Authenticate the current user.
      Specified by:
      authenticate in interface byps.BAuthentication
      Parameters:
      client1 - BClient object
      asyncResult - Result object, only the exception is evaluated.
    • getPublicEncrKey

      protected CompletableFuture<Void> getPublicEncrKey(de.elo.ix.client.BClient_Indexserver client)
      Public-RSA-Key vom IX holen und merken.
      Parameters:
      client - BClient
      Returns:
      CompletableFuture
    • getServerInfo

      protected CompletableFuture<Void> getServerInfo(de.elo.ix.client.BClient_Indexserver client)
      ServerInfo vom IX lesen und merken.
      Parameters:
      client - BClient
      Returns:
      CompletableFuture
    • isReloginException

      public boolean isReloginException(byps.BClient client, Throwable e, int typeId)
      Return true, if the given exception has to trigger authentication.
      Specified by:
      isReloginException in interface byps.BAuthentication
      Parameters:
      client - BClient object
      e - Exception returned from the last request.
      typeId - Type ID (serialVersionUID) of the last request class. For each API function, the generator has created a request class named BRequest_functionname. The passed type ID is the serialVersionUID of this class.
      Returns:
      true triggers authentication, false forwards the exception to the caller.
    • getClientInfo

      public ClientInfo getClientInfo()
      This object is implicitly passed to each Indexserver request and contains the authentication ticket.
      Specified by:
      getClientInfo in interface IXAuthenticationIF
      Returns:
      ClientInfo
    • getSession

      public void getSession(byps.BClient client, int typeId, byps.BAsyncResult<Object> asyncResult)
      Return the object representing the current session. This object will be passed to every request class (e.g. BRequest_functionname) for remote interfaces tagged with @BSessionParamType. If the function throws an exception, the isReloginException and maybe the authentication functions are called before the current method request is sent.
      Specified by:
      getSession in interface byps.BAuthentication
      Parameters:
      client - BClient object
      typeId - Type ID (serialVersionUID) of the last request class, see BAuthentication.isReloginException(BClient, Throwable, int).
      asyncResult - This object receives the session object or an exception.
      See Also:
      • BMethodRequest.setSession(Object)
    • makeSessOptsObj

      public SessionOptions makeSessOptsObj()
      Build SessionOptions object from current session options.
      Specified by:
      makeSessOptsObj in interface IXAuthenticationIF
      Returns:
      SessionOptions
    • fromSessOptsObj

      public void fromSessOptsObj(SessionOptions opts)
      Store provided SessionOptions object in current session options. This function does not send the options to IX.
      Specified by:
      fromSessOptsObj in interface IXAuthenticationIF
      Parameters:
      opts - SessionOptions object.
    • encryptPassword

      public String encryptPassword(String pwd)
      Encrypt the given text before sending over the wire.
      Specified by:
      encryptPassword in interface IXAuthenticationIF
      Parameters:
      pwd - Plain text to be encrypted
      Returns:
      Encrypted text
    • addListener

      public void addListener(IXAuthenticationListener listener)
      Add a listener that is called on re-login.
      Specified by:
      addListener in interface IXAuthenticationIF
      Parameters:
      listener - Callback object
    • removeListener

      public void removeListener(IXAuthenticationListener listener)
      Remove a listener that was previously set by IXAuthenticationIF.addListener(IXAuthenticationListener).
      Specified by:
      removeListener in interface IXAuthenticationIF
      Parameters:
      listener - Callback object
    • notifyListeners

      protected void notifyListeners(byps.BClient client, Throwable e)
    • unwrapCompletionException

      protected Throwable unwrapCompletionException(Throwable e)
      Wenn die übergebene Exception eine CompletionException ist, dann gib deren cause zurück.
      Parameters:
      e - Exception
      Returns:
      Exception oder Exception.cause
    • isExpired

      public boolean isExpired()
      Check whether the current session ClientInfo.ticket is expired.
      Specified by:
      isExpired in interface IXAuthenticationIF
      Returns:
      true if expired
    • needAlive

      public boolean needAlive()
      Check whether the current session ClientInfo.ticket needs to be renewed.
      Specified by:
      needAlive in interface IXAuthenticationIF
      Returns:
      true if renew is required
    • setLoginResult

      public void setLoginResult(LoginResult lr)
      Called after authentication to pass the LoginResult.
      Specified by:
      setLoginResult in interface IXAuthenticationIF
      Parameters:
      lr - Authentication result
    • getSessionOptions

      public Properties getSessionOptions()
      Session-Options zurückgeben.
      Specified by:
      getSessionOptions in interface IXAuthenticationIF
      Returns:
      Session-Options.
    • getDatabaseEngine

      public String getDatabaseEngine()
      Get database engine name. This value is received by a call to IXServicePortIF.getServerInfo(ClientInfo) and corresponds to ServerInfo.databaseEngine.
      Specified by:
      getDatabaseEngine in interface IXAuthenticationIF
      Returns:
      Database engine
    • getEncryptionPasswords

      public Properties getEncryptionPasswords()
      Reserved.
      Specified by:
      getEncryptionPasswords in interface IXAuthenticationIF
      Returns:
    • getAuthenticationType

      public EAuthenticationType getAuthenticationType()
      Type of this authentication object.
      Specified by:
      getAuthenticationType in interface IXAuthenticationIF
      Returns:
      Authentication type
    • getVersion

      public String getVersion()
      Description copied from interface: IXAuthenticationIF
      Return IX version.
      Specified by:
      getVersion in interface IXAuthenticationIF
      Returns:
      IX version. EIX-2519
    • getServerTime

      public Date getServerTime()
      Description copied from interface: IXAuthenticationIF
      Server time. EIX-2519
      Specified by:
      getServerTime in interface IXAuthenticationIF
      Returns:
      Server time
    • getInstanceName

      public String getInstanceName()
      Description copied from interface: IXAuthenticationIF
      Return IXID defined in Indexserver options.
      Specified by:
      getInstanceName in interface IXAuthenticationIF
      Returns:
      Instance name
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getServerInfoOpt

      public Optional<ServerInfo> getServerInfoOpt()