Package de.elo.ix.client
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.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final EAuthenticationType
protected final Properties
protected ArrayList<IXAuthenticationListener>
protected AtomicReference<LoginResult>
protected AtomicReference<PublicKey>
protected static final String[]
protected AtomicReference<ServerInfo>
Information about the Indexserver execution environment.protected final Properties
protected long
protected long
Fields inherited from interface de.elo.ix.client.IXAuthenticationIF
LOGIN_FOR_PUBLIC_ENCR_KEY
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
IXAuthentication
(ClientInfo clientInfo, Properties sessOpts, EAuthenticationType authType) Constructor -
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(IXAuthenticationListener listener) Add a listener that is called on re-login.void
authenticate
(byps.BClient client1, byps.BAsyncResult<Boolean> asyncResult) Authenticate the current user.encryptPassword
(String pwd) Encrypt the given text before sending over the wire.void
Store provided SessionOptions object in current session options.Type of this authentication object.This object is implicitly passed to each Indexserver request and contains the authentication ticket.Get database engine name.Reserved.Return IXID defined in Indexserver options.LoginResult
received from Indexserver as the result of authentication.protected CompletableFuture<Void>
getPublicEncrKey
(de.elo.ix.client.BClient_Indexserver client) Public-RSA-Key vom IX holen und merken.protected CompletableFuture<Void>
getServerInfo
(de.elo.ix.client.BClient_Indexserver client) ServerInfo vom IX lesen und merken.Server time.void
getSession
(byps.BClient client, int typeId, byps.BAsyncResult<Object> asyncResult) Return the object representing the current session.Session-Options zurückgeben.Return IX version.protected abstract void
internalAuthenticate
(de.elo.ix.client.BClient_Indexserver client, byps.BAsyncResult<Boolean> asyncResult) Process authentication.boolean
Check whether the current sessionClientInfo.ticket
is expired.boolean
isReloginException
(byps.BClient client, Throwable e, int typeId) Return true, if the given exception has to trigger authentication.Build SessionOptions object from current session options.boolean
Check whether the current sessionClientInfo.ticket
needs to be renewed.protected void
notifyListeners
(byps.BClient client, Throwable e) void
removeListener
(IXAuthenticationListener listener) Remove a listener that was previously set byIXAuthenticationIF.addListener(IXAuthenticationListener)
.void
Called after authentication to pass theLoginResult
.toString()
protected Throwable
Wenn die übergebene Exception eine CompletionException ist, dann gib deren cause zurück.
-
Field Details
-
loginResultRef
-
sessOpts
-
encrPasswords
-
serverInfo
Information about the Indexserver execution environment. E.g. database, version, server time. EIX-2519 -
listeners
-
publicKey
-
ticketBestBefore
protected volatile long ticketBestBefore -
ticketBestBeforeAlive
protected volatile long ticketBestBeforeAlive -
authType
-
RELOGIN_ERRORS
-
-
Constructor Details
-
IXAuthentication
protected IXAuthentication(ClientInfo clientInfo, Properties sessOpts, EAuthenticationType authType) Constructor- Parameters:
clientInfo
- ClientInfosessOpts
- Session optionsauthType
- 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
LoginResult
received from Indexserver as the result of authentication.- Specified by:
getLoginResult
in interfaceIXAuthenticationIF
- Returns:
- LoginResult
-
authenticate
Authenticate the current user.- Specified by:
authenticate
in interfacebyps.BAuthentication
- Parameters:
client1
- BClient objectasyncResult
- Result object, only the exception is evaluated.
-
getPublicEncrKey
Public-RSA-Key vom IX holen und merken.- Parameters:
client
- BClient- Returns:
- CompletableFuture
-
getServerInfo
ServerInfo vom IX lesen und merken.- Parameters:
client
- BClient- Returns:
- CompletableFuture
-
isReloginException
Return true, if the given exception has to trigger authentication.- Specified by:
isReloginException
in interfacebyps.BAuthentication
- Parameters:
client
- BClient objecte
- 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
This object is implicitly passed to each Indexserver request and contains the authentication ticket.- Specified by:
getClientInfo
in interfaceIXAuthenticationIF
- Returns:
- ClientInfo
-
getSession
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 interfacebyps.BAuthentication
- Parameters:
client
- BClient objecttypeId
- Type ID (serialVersionUID) of the last request class, seeBAuthentication.isReloginException(BClient, Throwable, int)
.asyncResult
- This object receives the session object or an exception.- See Also:
-
BMethodRequest.setSession(Object)
-
makeSessOptsObj
Build SessionOptions object from current session options.- Specified by:
makeSessOptsObj
in interfaceIXAuthenticationIF
- Returns:
- SessionOptions
-
fromSessOptsObj
Store provided SessionOptions object in current session options. This function does not send the options to IX.- Specified by:
fromSessOptsObj
in interfaceIXAuthenticationIF
- Parameters:
opts
- SessionOptions object.
-
encryptPassword
Encrypt the given text before sending over the wire.- Specified by:
encryptPassword
in interfaceIXAuthenticationIF
- Parameters:
pwd
- Plain text to be encrypted- Returns:
- Encrypted text
-
addListener
Add a listener that is called on re-login.- Specified by:
addListener
in interfaceIXAuthenticationIF
- Parameters:
listener
- Callback object
-
removeListener
Remove a listener that was previously set byIXAuthenticationIF.addListener(IXAuthenticationListener)
.- Specified by:
removeListener
in interfaceIXAuthenticationIF
- Parameters:
listener
- Callback object
-
notifyListeners
-
unwrapCompletionException
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 sessionClientInfo.ticket
is expired.- Specified by:
isExpired
in interfaceIXAuthenticationIF
- Returns:
- true if expired
-
needAlive
public boolean needAlive()Check whether the current sessionClientInfo.ticket
needs to be renewed.- Specified by:
needAlive
in interfaceIXAuthenticationIF
- Returns:
- true if renew is required
-
setLoginResult
Called after authentication to pass theLoginResult
.- Specified by:
setLoginResult
in interfaceIXAuthenticationIF
- Parameters:
lr
- Authentication result
-
getSessionOptions
Session-Options zurückgeben.- Specified by:
getSessionOptions
in interfaceIXAuthenticationIF
- Returns:
- Session-Options.
-
getDatabaseEngine
Get database engine name. This value is received by a call toIXServicePortIF.getServerInfo(ClientInfo)
and corresponds toServerInfo.databaseEngine
.- Specified by:
getDatabaseEngine
in interfaceIXAuthenticationIF
- Returns:
- Database engine
-
getEncryptionPasswords
Reserved.- Specified by:
getEncryptionPasswords
in interfaceIXAuthenticationIF
- Returns:
-
getAuthenticationType
Type of this authentication object.- Specified by:
getAuthenticationType
in interfaceIXAuthenticationIF
- Returns:
- Authentication type
-
getVersion
Description copied from interface:IXAuthenticationIF
Return IX version.- Specified by:
getVersion
in interfaceIXAuthenticationIF
- Returns:
- IX version. EIX-2519
-
getServerTime
Description copied from interface:IXAuthenticationIF
Server time. EIX-2519- Specified by:
getServerTime
in interfaceIXAuthenticationIF
- Returns:
- Server time
-
getInstanceName
Description copied from interface:IXAuthenticationIF
Return IXID defined in Indexserver options.- Specified by:
getInstanceName
in interfaceIXAuthenticationIF
- Returns:
- Instance name
-
toString
-
getServerInfoOpt
-