Class AbstractIdentityBackend
java.lang.Object
org.apache.kerby.config.Configured
org.apache.kerby.kerberos.kerb.identity.backend.AbstractIdentityBackend
- All Implemented Interfaces:
org.apache.kerby.config.Configurable,IdentityBackend,IdentityService
- Direct Known Subclasses:
MemoryIdentityBackend
public abstract class AbstractIdentityBackend
extends org.apache.kerby.config.Configured
implements IdentityBackend
An abstract identity backend that provides default behaviors and a cache
with FIFO and size limit. Note only limited recently active identities are
kept in the cache, and other identities are meant to be loaded from
persistent storage by specific backend, like memory, file, SQL DB, LDAP,
and etc.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.kerby.kerberos.kerb.request.KrbIdentityaddIdentity(org.apache.kerby.kerberos.kerb.request.KrbIdentity identity) Add an identity, and return the newly created result.voiddeleteIdentity(String principalName) Delete the identity specified by principal nameprotected abstract org.apache.kerby.kerberos.kerb.request.KrbIdentitydoAddIdentity(org.apache.kerby.kerberos.kerb.request.KrbIdentity identity) Add an identity, invoked by addIdentity, and return added identity.protected abstract voiddoDeleteIdentity(String principalName) Delete an identity, invoked by deleteIndentity.Perform the real work to get identities.protected abstract org.apache.kerby.kerberos.kerb.request.KrbIdentitydoGetIdentity(String principalName) Add an identity, invoked by addIdentity.protected org.apache.kerby.kerberos.kerb.type.ad.AuthorizationDatadoGetIdentityAuthorizationData(org.apache.kerby.kerberos.kerb.request.KdcClientRequest kdcClientRequest, org.apache.kerby.kerberos.kerb.type.ticket.EncTicketPart encTicketPart) Get an identity's Authorization Data, invoked by getIdentityAuthorizationData.protected voidPerform the real initialization work for the backend.protected voidPerform the real release work for the backend.protected voiddoStart()Perform the real start work for the backend.protected voiddoStop()Perform the real stop work for the backend.protected abstract org.apache.kerby.kerberos.kerb.request.KrbIdentitydoUpdateIdentity(org.apache.kerby.kerberos.kerb.request.KrbIdentity identity) Update an identity, invoked by updateIdentity, and return updated identity.protected BackendConfigGet the Backend Config.Get all of the identity principal names.org.apache.kerby.kerberos.kerb.request.KrbIdentitygetIdentity(String principalName) Get the identity account specified by name.org.apache.kerby.kerberos.kerb.type.ad.AuthorizationDatagetIdentityAuthorizationData(org.apache.kerby.kerberos.kerb.request.KdcClientRequest kdcClientRequest, org.apache.kerby.kerberos.kerb.type.ticket.EncTicketPart encTicketPart) Get an identity's Authorization Data.voidInit work for the backend can be done here.voidrelease()Release the backend associated resources like connection.voidstart()Start the backend and return soon after the backend or the connection to it is well prepared and ready for KDC to use.Start a transaction.voidstop()Stop the backend.booleanQuery to know if xtrans is supported or not.org.apache.kerby.kerberos.kerb.request.KrbIdentityupdateIdentity(org.apache.kerby.kerberos.kerb.request.KrbIdentity identity) Update an identity, and return the updated result.Methods inherited from class org.apache.kerby.config.Configured
getConfig, setConfigMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.kerby.config.Configurable
getConfig, setConfig
-
Constructor Details
-
AbstractIdentityBackend
public AbstractIdentityBackend()
-
-
Method Details
-
getBackendConfig
Get the Backend Config.- Returns:
- The backend config
-
initialize
public void initialize() throws org.apache.kerby.kerberos.kerb.KrbExceptionInit work for the backend can be done here.- Specified by:
initializein interfaceIdentityBackend- Throws:
org.apache.kerby.kerberos.kerb.KrbException- e
-
supportBatchTrans
public boolean supportBatchTrans()Query to know if xtrans is supported or not.- Specified by:
supportBatchTransin interfaceIdentityService- Returns:
- true if supported, false otherwise
-
startBatchTrans
Start a transaction.- Specified by:
startBatchTransin interfaceIdentityService- Returns:
- xtrans The batch trans
- Throws:
org.apache.kerby.kerberos.kerb.KrbException- e
-
doInitialize
protected void doInitialize() throws org.apache.kerby.kerberos.kerb.KrbExceptionPerform the real initialization work for the backend.- Throws:
org.apache.kerby.kerberos.kerb.KrbException- e
-
start
public void start()Start the backend and return soon after the backend or the connection to it is well prepared and ready for KDC to use. Will be called during KDC startup.- Specified by:
startin interfaceIdentityBackend
-
doStart
protected void doStart()Perform the real start work for the backend. -
stop
public void stop() throws org.apache.kerby.kerberos.kerb.KrbExceptionStop the backend. Will be called during KDC stop.- Specified by:
stopin interfaceIdentityBackend- Throws:
org.apache.kerby.kerberos.kerb.KrbException- e
-
doStop
protected void doStop() throws org.apache.kerby.kerberos.kerb.KrbExceptionPerform the real stop work for the backend.- Throws:
org.apache.kerby.kerberos.kerb.KrbException- e
-
release
public void release()Release the backend associated resources like connection. Will be called during KDC shutdown.- Specified by:
releasein interfaceIdentityBackend
-
doRelease
protected void doRelease()Perform the real release work for the backend. -
getIdentities
Get all of the identity principal names. Note it's ordered by principal name.- Specified by:
getIdentitiesin interfaceIdentityService- Returns:
- principal names
- Throws:
org.apache.kerby.kerberos.kerb.KrbException- e
-
doGetIdentities
protected abstract Iterable<String> doGetIdentities() throws org.apache.kerby.kerberos.kerb.KrbExceptionPerform the real work to get identities.- Returns:
- The identities
- Throws:
org.apache.kerby.kerberos.kerb.KrbException- e
-
getIdentity
public org.apache.kerby.kerberos.kerb.request.KrbIdentity getIdentity(String principalName) throws org.apache.kerby.kerberos.kerb.KrbException Get the identity account specified by name.- Specified by:
getIdentityin interfaceIdentityService- Parameters:
principalName- The principal name- Returns:
- identity
- Throws:
org.apache.kerby.kerberos.kerb.KrbException- e
-
doGetIdentity
protected abstract org.apache.kerby.kerberos.kerb.request.KrbIdentity doGetIdentity(String principalName) throws org.apache.kerby.kerberos.kerb.KrbException Add an identity, invoked by addIdentity.- Parameters:
principalName- The principal name- Returns:
- The added identity
- Throws:
org.apache.kerby.kerberos.kerb.KrbException- e
-
getIdentityAuthorizationData
public org.apache.kerby.kerberos.kerb.type.ad.AuthorizationData getIdentityAuthorizationData(org.apache.kerby.kerberos.kerb.request.KdcClientRequest kdcClientRequest, org.apache.kerby.kerberos.kerb.type.ticket.EncTicketPart encTicketPart) throws org.apache.kerby.kerberos.kerb.KrbException Get an identity's Authorization Data.- Specified by:
getIdentityAuthorizationDatain interfaceIdentityService- Parameters:
kdcClientRequest- The KdcClientRequestencTicketPart- The EncTicketPart being built for the KrbIdentity- Returns:
- The Authorization Data
- Throws:
org.apache.kerby.kerberos.kerb.KrbException- e
-
doGetIdentityAuthorizationData
protected org.apache.kerby.kerberos.kerb.type.ad.AuthorizationData doGetIdentityAuthorizationData(org.apache.kerby.kerberos.kerb.request.KdcClientRequest kdcClientRequest, org.apache.kerby.kerberos.kerb.type.ticket.EncTicketPart encTicketPart) throws org.apache.kerby.kerberos.kerb.KrbException Get an identity's Authorization Data, invoked by getIdentityAuthorizationData.- Parameters:
kdcClientRequest- The KdcClientRequestencTicketPart- The EncTicketPart being built for the KrbIdentity- Returns:
- The Authorization Data
- Throws:
org.apache.kerby.kerberos.kerb.KrbException- e
-
addIdentity
public org.apache.kerby.kerberos.kerb.request.KrbIdentity addIdentity(org.apache.kerby.kerberos.kerb.request.KrbIdentity identity) throws org.apache.kerby.kerberos.kerb.KrbException Add an identity, and return the newly created result.- Specified by:
addIdentityin interfaceIdentityService- Parameters:
identity- The identity- Returns:
- identity
- Throws:
org.apache.kerby.kerberos.kerb.KrbException- e
-
doAddIdentity
protected abstract org.apache.kerby.kerberos.kerb.request.KrbIdentity doAddIdentity(org.apache.kerby.kerberos.kerb.request.KrbIdentity identity) throws org.apache.kerby.kerberos.kerb.KrbException Add an identity, invoked by addIdentity, and return added identity.- Parameters:
identity- The identity to be added- Returns:
- The added identity
- Throws:
org.apache.kerby.kerberos.kerb.KrbException- e
-
updateIdentity
public org.apache.kerby.kerberos.kerb.request.KrbIdentity updateIdentity(org.apache.kerby.kerberos.kerb.request.KrbIdentity identity) throws org.apache.kerby.kerberos.kerb.KrbException Update an identity, and return the updated result.- Specified by:
updateIdentityin interfaceIdentityService- Parameters:
identity- The identity- Returns:
- identity
- Throws:
org.apache.kerby.kerberos.kerb.KrbException- e
-
doUpdateIdentity
protected abstract org.apache.kerby.kerberos.kerb.request.KrbIdentity doUpdateIdentity(org.apache.kerby.kerberos.kerb.request.KrbIdentity identity) throws org.apache.kerby.kerberos.kerb.KrbException Update an identity, invoked by updateIdentity, and return updated identity.- Parameters:
identity- The origin identity- Returns:
- The updated identity
- Throws:
org.apache.kerby.kerberos.kerb.KrbException- e
-
deleteIdentity
Delete the identity specified by principal name- Specified by:
deleteIdentityin interfaceIdentityService- Parameters:
principalName- The principal name- Throws:
org.apache.kerby.kerberos.kerb.KrbException- e
-
doDeleteIdentity
protected abstract void doDeleteIdentity(String principalName) throws org.apache.kerby.kerberos.kerb.KrbException Delete an identity, invoked by deleteIndentity.- Parameters:
principalName- The principal name- Throws:
org.apache.kerby.kerberos.kerb.KrbException- e
-