Package net.shibboleth.idp.module
Class PropertyDrivenIdPModule
- java.lang.Object
-
- net.shibboleth.idp.module.AbstractIdPModule
-
- net.shibboleth.idp.module.PropertyDrivenIdPModule
-
- All Implemented Interfaces:
IdPModule,Component,IdentifiedComponent
- Direct Known Subclasses:
CoreIdPModule,PluginIdPModule
public class PropertyDrivenIdPModule extends AbstractIdPModule
Implementation ofIdPModulerelying on JavaProperties.- Since:
- 4.1.0
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class net.shibboleth.idp.module.AbstractIdPModule
AbstractIdPModule.BasicModuleResource
-
Nested classes/interfaces inherited from interface net.shibboleth.idp.module.IdPModule
IdPModule.ModuleResource, IdPModule.ResourceResult
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_RESOURCEDefault name of module properties resource.private List<String>localesAvailable message locales.private org.slf4j.LoggerlogClass logger.static StringMODULE_DESC_PROPERTYSuffix of property for module description.static StringMODULE_DEST_PROPERTYSuffix of property for resource destination.static StringMODULE_EXEC_PROPERTYSuffix of property for resource executability.static StringMODULE_LANGS_PROPERTYSuffix of property for module languages.static StringMODULE_NAME_PROPERTYSuffix of property for module name.static StringMODULE_OPTIONAL_PROPERTYSuffix of property for resource optionality.static StringMODULE_PLUGIN_PROPERTYSuffix of property for module plugin owner.static StringMODULE_POSTDISABLE_PROPERTYSuffix of property for module post-disable message.static StringMODULE_POSTENABLE_PROPERTYSuffix of property for module post-enable message.static StringMODULE_REPLACE_PROPERTYSuffix of property for resource replacement.static StringMODULE_SRC_PROPERTYSuffix of property for resource source.static StringMODULE_URL_PROPERTYSuffix of property for module URL.private StringmoduleIdModule ID.private StringmoduleNameModule name.private PropertiesmodulePropertiesProperties describing module.private StringmoduleURLModule URL.private StringpluginIdPlugin ID.private booleanrequireHttpClientWhether to require an HTTP client.
-
Constructor Summary
Constructors Constructor Description PropertyDrivenIdPModule(InputStream inputStream)Constructor.PropertyDrivenIdPModule(Class<? extends IdPModule> claz)Constructor.PropertyDrivenIdPModule(Properties properties)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<IdPModule.ModuleResource,IdPModule.ResourceResult>disable(ModuleContext moduleContext, boolean clean)Disable the module.Map<IdPModule.ModuleResource,IdPModule.ResourceResult>enable(ModuleContext moduleContext)Enable the module.StringgetDescription(ModuleContext moduleContext)Gets module description.StringgetId()StringgetName(ModuleContext moduleContext)Gets module name.StringgetOwnerId()Gets the plugin name of the module's owner, if the module is provided by a plugin.StringgetURL()Gets module URL.booleanisHttpClientRequired()Gets whether module enablement requires access to anHttpClient.protected voidload()Load module information from properties.voidsetURL(String url)Set the module URL.-
Methods inherited from class net.shibboleth.idp.module.AbstractIdPModule
equals, getResources, hashCode, isEnabled, setResources, toString
-
-
-
-
Field Detail
-
DEFAULT_RESOURCE
@Nonnull @NotEmpty public static final String DEFAULT_RESOURCE
Default name of module properties resource.- See Also:
- Constant Field Values
-
MODULE_NAME_PROPERTY
@Nonnull @NotEmpty public static final String MODULE_NAME_PROPERTY
Suffix of property for module name.- See Also:
- Constant Field Values
-
MODULE_DESC_PROPERTY
@Nonnull @NotEmpty public static final String MODULE_DESC_PROPERTY
Suffix of property for module description.- See Also:
- Constant Field Values
-
MODULE_URL_PROPERTY
@Nonnull @NotEmpty public static final String MODULE_URL_PROPERTY
Suffix of property for module URL.- See Also:
- Constant Field Values
-
MODULE_PLUGIN_PROPERTY
@Nonnull @NotEmpty public static final String MODULE_PLUGIN_PROPERTY
Suffix of property for module plugin owner.- See Also:
- Constant Field Values
-
MODULE_SRC_PROPERTY
@Nonnull @NotEmpty public static final String MODULE_SRC_PROPERTY
Suffix of property for resource source.- See Also:
- Constant Field Values
-
MODULE_DEST_PROPERTY
@Nonnull @NotEmpty public static final String MODULE_DEST_PROPERTY
Suffix of property for resource destination.- See Also:
- Constant Field Values
-
MODULE_REPLACE_PROPERTY
@Nonnull @NotEmpty public static final String MODULE_REPLACE_PROPERTY
Suffix of property for resource replacement.- See Also:
- Constant Field Values
-
MODULE_OPTIONAL_PROPERTY
@Nonnull @NotEmpty public static final String MODULE_OPTIONAL_PROPERTY
Suffix of property for resource optionality.- See Also:
- Constant Field Values
-
MODULE_EXEC_PROPERTY
@Nonnull @NotEmpty public static final String MODULE_EXEC_PROPERTY
Suffix of property for resource executability.- See Also:
- Constant Field Values
-
MODULE_POSTENABLE_PROPERTY
@Nonnull @NotEmpty public static final String MODULE_POSTENABLE_PROPERTY
Suffix of property for module post-enable message.- See Also:
- Constant Field Values
-
MODULE_POSTDISABLE_PROPERTY
@Nonnull @NotEmpty public static final String MODULE_POSTDISABLE_PROPERTY
Suffix of property for module post-disable message.- See Also:
- Constant Field Values
-
MODULE_LANGS_PROPERTY
@Nonnull @NotEmpty public static final String MODULE_LANGS_PROPERTY
Suffix of property for module languages.- See Also:
- Constant Field Values
-
log
@Nonnull private org.slf4j.Logger log
Class logger.
-
moduleProperties
@Nonnull private final Properties moduleProperties
Properties describing module.
-
locales
@Nonnull @NonnullElements private List<String> locales
Available message locales.
-
requireHttpClient
private boolean requireHttpClient
Whether to require an HTTP client.
-
-
Constructor Detail
-
PropertyDrivenIdPModule
public PropertyDrivenIdPModule(@Nonnull Class<? extends IdPModule> claz) throws IOException, ModuleExceptionConstructor.- Parameters:
claz- type of object used to locate default module.properties resource- Throws:
IOException- if unable to read fileModuleException- if the module is not in a valid state
-
PropertyDrivenIdPModule
public PropertyDrivenIdPModule(@Nonnull InputStream inputStream) throws IOException, ModuleExceptionConstructor.- Parameters:
inputStream- property stream- Throws:
IOException- if unable to read fileModuleException- if the module is not in a valid state
-
PropertyDrivenIdPModule
public PropertyDrivenIdPModule(@Nonnull Properties properties) throws ModuleExceptionConstructor.- Parameters:
properties- property set- Throws:
ModuleException- if the module is not in a valid state
-
-
Method Detail
-
load
protected void load() throws ModuleExceptionLoad module information from properties.- Throws:
ModuleException- on errors
-
getName
@Nonnull @NotEmpty public String getName(@Nullable ModuleContext moduleContext)
Gets module name.- Parameters:
moduleContext- optional context for supplying i18n input- Returns:
- a human-readable name for the module
-
getDescription
@Nullable @NotEmpty public String getDescription(@Nullable ModuleContext moduleContext)
Gets module description.- Parameters:
moduleContext- optional context for supplying i18n input- Returns:
- a human-readable description for the module
-
getURL
@Nullable @NotEmpty public String getURL()
Gets module URL.- Returns:
- a URL for obtaining additional information about the module
-
setURL
public void setURL(@Nullable @NotEmpty String url)
Set the module URL.- Parameters:
url- URL to set
-
getOwnerId
@Nullable @NotEmpty public String getOwnerId()
Gets the plugin name of the module's owner, if the module is provided by a plugin.- Returns:
- plugin ID, if any
-
isHttpClientRequired
public boolean isHttpClientRequired()
Gets whether module enablement requires access to anHttpClient.- Returns:
- true iff enabling the module requires HTTP client
-
enable
@Nonnull @NonnullElements public Map<IdPModule.ModuleResource,IdPModule.ResourceResult> enable(@Nullable ModuleContext moduleContext) throws ModuleException
Enable the module.This operation MUST be idempotent.
- Specified by:
enablein interfaceIdPModule- Overrides:
enablein classAbstractIdPModule- Parameters:
moduleContext- module context- Returns:
- summary of resource results
- Throws:
ModuleException- if not successful
-
disable
@Nonnull @NonnullElements public Map<IdPModule.ModuleResource,IdPModule.ResourceResult> disable(@Nullable ModuleContext moduleContext, boolean clean) throws ModuleException
Disable the module.This operation MUST be idempotent with respect to the value of the input parameter.
- Specified by:
disablein interfaceIdPModule- Overrides:
disablein classAbstractIdPModule- Parameters:
moduleContext- module contextclean- if true, the module should attempt to fully remove traces of previous use in a potentially destructive fashion- Returns:
- summary of resource results
- Throws:
ModuleException- if not successful
-
-