if (location.href.indexOf('is-external=true') == -1) { parent.document.; } //-->
allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //-->
com.ibm.mfp.server.security.external.checks.impl
Class ExternalizableSecurityCheck
- java.lang.Object
- com.ibm.mfp.server.security.external.checks.impl.ExternalizableSecurityCheck
- All Implemented Interfaces:
- SecurityCheck, java.io.Externalizable, java.io.Serializable
public abstract class ExternalizableSecurityCheck extends java.lang.Object implements SecurityCheck
Convenience base class for security check implementations. Provides the following features:
- Automatic externalization as JSON object. Not externalizable fields must be marked transient.
- Configuration property
inactivityTimeoutSec- Implementation of
ExternalizableSecurityCheck.getExpiresAt()via state management mechanism that includesExternalizableSecurityCheck.initStateDurations(Map),ExternalizableSecurityCheck.setState(String)
, andExternalizableSecurityCheck.getState()
- Empty implementation of the
ExternalizableSecurityCheck.logout()method
- See Also:
- Serialized Form
Field Summary
Fields Modifier and Type Field and Description protected AuthorizationContext authorizationContext protected ExternalizableSecurityCheckConfig config protected RegistrationContext registrationContext protected static java.lang.String STATE_EXPIREDPredefined state name that means the security check is expired and its state will not be preserved.
Constructor Summary
Constructors Constructor and Description ExternalizableSecurityCheck()
Method Summary
Methods Modifier and Type Method and Description SecurityCheckConfiguration createConfiguration(java.util.Properties properties)Create configuration object and populate fields from the given properties.
protected ExternalizableSecurityCheckConfig getConfiguration() long getExpiresAt()Calculates the expiration for the current state set via
ExternalizableSecurityCheck.setState(String)based on state durations returned byExternalizableSecurityCheck.initStateDurations(Map)
If the current state isExternalizableSecurityCheck.STATE_EXPIRED, this method returns 0 int getInactivityTimeoutSec()Get the security check inactivity timeout, usually the configured value.
protected java.lang.String getName() java.lang.String getState()Get the current state set via method
ExternalizableSecurityCheck.setState(String) protected abstract void initStateDurations(java.util.Map durations)Put the state names supported by this security check and their durations in seconds into the input map.
Implementations may useExternalizableSecurityCheck.getConfiguration()method to access configured values. void logout()Called upon explicit logout from this security check.
void readExternal(java.io.ObjectInput in) void setContext(java.lang.String name, SecurityCheckConfiguration config, AuthorizationContext authorizationContext, RegistrationContext registrationContext)Initialize the security check with the context and configuration properties.
protected void setState(java.lang.String name)Set the given state and mark the time.
If the state is already set to the given value, no change is done. void writeExternal(java.io.ObjectOutput out)
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.ibm.mfp.server.security.external.checks.SecurityCheck
authorize, introspect
Field Detail
STATE_EXPIRED
protected static final java.lang.String STATE_EXPIRED
Predefined state name that means the security check is expired and its state will not be preserved.
- See Also:
- Constant Field Values
config
protected transient ExternalizableSecurityCheckConfig config
authorizationContext
protected transient AuthorizationContext authorizationContext
registrationContext
protected transient RegistrationContext registrationContext
Method Detail
createConfiguration
public SecurityCheckConfiguration createConfiguration(java.util.Properties properties)
Description copied from interface:
SecurityCheckCreate configuration object and populate fields from the given properties. Use errors and warnings maps to report problems.
Called during deployment.
- Specified by:
createConfiguration in interfaceSecurityCheck
- Parameters:
properties - the merged properties to read and validate- Returns:
- new configuration object, not null
getExpiresAt
public long getExpiresAt()
Calculates the expiration for the current state set via
ExternalizableSecurityCheck.setState(String)based on state durations returned byExternalizableSecurityCheck.initStateDurations(Map)
If the current state isExternalizableSecurityCheck.STATE_EXPIRED, this method returns 0
- Specified by:
getExpiresAt in interfaceSecurityCheck
- Returns:
- the time when the current state will be expired, or 0 if the current state is null
getInactivityTimeoutSec
public int getInactivityTimeoutSec()
Description copied from interface:
SecurityCheckGet the security check inactivity timeout, usually the configured value. 0 means no inactivity timeout defined for this check
- Specified by:
getInactivityTimeoutSec in interfaceSecurityCheck
- Returns:
- inactivity timeout in seconds, 0 if none
setContext
public void setContext(java.lang.String name, SecurityCheckConfiguration config, AuthorizationContext authorizationContext, RegistrationContext registrationContext)
Description copied from interface:
SecurityCheckInitialize the security check with the context and configuration properties. This method is called after instantiation and also on each retrieve. The security checks should not keep the configuration data in the persistent state
- Specified by:
setContext in interfaceSecurityCheck
- Parameters:
name - name of the security checkconfig
- security check configuration created bySecurityCheck.createConfiguration(Properties)
authorizationContext
- provides access to the transient state of the calling clientregistrationContext
- provides access to the persistent state of the calling client
logout
public void logout()
Description copied from interface:
SecurityCheckCalled upon explicit logout from this security check. The implementation may choose to modify or delete its persistent (registered) state, or other custom logic.
The transient state of this security check is destroyed automatically.
- Specified by:
logout in interfaceSecurityCheck
writeExternal
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
- Specified by:
writeExternal in interfacejava.io.Externalizable
- Throws:
java.io.IOException
readExternal
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
- Specified by:
readExternal in interfacejava.io.Externalizable
- Throws:
java.io.IOException java.lang.ClassNotFoundException
getConfiguration
protected ExternalizableSecurityCheckConfig getConfiguration()
getName
protected java.lang.String getName()
setState
protected void setState(java.lang.String name)
Set the given state and mark the time.
If the state is already set to the given value, no change is done.
- Parameters:
name - the name of the state, must be one of those defined byExternalizableSecurityCheck.initStateDurations(Map)
, orExternalizableSecurityCheck.STATE_EXPIRED
- See Also:
ExternalizableSecurityCheck.getExpiresAt()
getState
public java.lang.String getState()
Get the current state set via method
ExternalizableSecurityCheck.setState(String)
- Returns:
- the current state name
initStateDurations
protected abstract void initStateDurations(java.util.Map durations)
Put the state names supported by this security check and their durations in seconds into the input map.
Implementations may useExternalizableSecurityCheck.getConfiguration()method to access configured values. The stateExternalizableSecurityCheck.STATE_EXPIREDis predefined, and should not be put into the map.
- Parameters:
durations - map with the state names as keys and their durations in seconds as values
allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //-->
© Copyright IBM Corp. 2006, 2015. All Rights Reserved.