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 ofIdPModule
relying 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 String
DEFAULT_RESOURCE
Default name of module properties resource.private List<String>
locales
Available message locales.private org.slf4j.Logger
log
Class logger.static String
MODULE_DESC_PROPERTY
Suffix of property for module description.static String
MODULE_DEST_PROPERTY
Suffix of property for resource destination.static String
MODULE_EXEC_PROPERTY
Suffix of property for resource executability.static String
MODULE_LANGS_PROPERTY
Suffix of property for module languages.static String
MODULE_NAME_PROPERTY
Suffix of property for module name.static String
MODULE_OPTIONAL_PROPERTY
Suffix of property for resource optionality.static String
MODULE_PLUGIN_PROPERTY
Suffix of property for module plugin owner.static String
MODULE_POSTDISABLE_PROPERTY
Suffix of property for module post-disable message.static String
MODULE_POSTENABLE_PROPERTY
Suffix of property for module post-enable message.static String
MODULE_REPLACE_PROPERTY
Suffix of property for resource replacement.static String
MODULE_SRC_PROPERTY
Suffix of property for resource source.static String
MODULE_URL_PROPERTY
Suffix of property for module URL.private String
moduleId
Module ID.private String
moduleName
Module name.private Properties
moduleProperties
Properties describing module.private String
moduleURL
Module URL.private String
pluginId
Plugin ID.private boolean
requireHttpClient
Whether 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.String
getDescription(ModuleContext moduleContext)
Gets module description.String
getId()
String
getName(ModuleContext moduleContext)
Gets module name.String
getOwnerId()
Gets the plugin name of the module's owner, if the module is provided by a plugin.String
getURL()
Gets module URL.boolean
isHttpClientRequired()
Gets whether module enablement requires access to anHttpClient
.protected void
load()
Load module information from properties.void
setURL(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, ModuleException
Constructor.- 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, ModuleException
Constructor.- 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 ModuleException
Constructor.- Parameters:
properties
- property set- Throws:
ModuleException
- if the module is not in a valid state
-
-
Method Detail
-
load
protected void load() throws ModuleException
Load 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:
enable
in interfaceIdPModule
- Overrides:
enable
in 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:
disable
in interfaceIdPModule
- Overrides:
disable
in 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
-
-