Class MetadataGeneratorImpl
java.lang.Object
net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
net.shibboleth.idp.installer.metadata.impl.MetadataGeneratorImpl
- All Implemented Interfaces:
MetadataGenerator
,Component
,DestructableComponent
,InitializableComponent
public class MetadataGeneratorImpl
extends AbstractInitializableComponent
implements MetadataGenerator
This class gathers information which it then uses to generate IdP Metadata. Loosely based on the SP metadata
generator, and the V2 metadata.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static enum
The end points we understand. -
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final Set<MetadataGeneratorImpl.Endpoints>
AttributeAuthority endpoints.(package private) static final Set<MetadataGeneratorImpl.Endpoints>
the Artifact endpoints.(package private) static final Set<MetadataGeneratorImpl.Endpoints>
Those endpoints which require a backchannel.private int
Comment depth.private EnumSet<MetadataGeneratorImpl.Endpoints>
Which endpoints to generate.private File
Where to write to - asFile
.private MetadataGeneratorParameters
The parameters.private boolean
Whether SAML1 is commented out.private boolean
Whether to comment out the SAML2 AA endpoint.private boolean
Whether to comment out the SAML2 SLO endpoints.(package private) static final Set<MetadataGeneratorImpl.Endpoints>
the SLO endpoints.(package private) static final Set<MetadataGeneratorImpl.Endpoints>
the SSO endpoints.private BufferedWriter
Where to write to - asBufferedWriter
. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
Add a close comment.protected void
Write out the close <\Extensions> Element.protected void
void
generate()
Generate the metadata given the parameters.Get the Endpoints.boolean
Returns whether to comment SAML1 endpoints.boolean
Returns whether to comment the SAML2 AA endpoint.boolean
Returns whether to comment the SAML2 Logout endpoints.private void
Add an open comment.protected void
Write the open <Extensions> elements.protected void
Output the SAML for a single endpoint.void
remove back channel endpoints.void
Set the Endpoints.void
Set where to write the metadata.void
Set a description of the IdP.void
setSAML1Commented
(boolean asComment) Sets whether to comment the comment SAML1 endpoints.void
setSAML2AttributeQueryCommented
(boolean asComment) Sets whether to comment the SAML2 AA endpoint.void
setSAML2LogoutCommented
(boolean asComment) Sets whether to comment the SAML2 Logout endpoints.private void
Write the <AttributeAuthorityDescriptor>.protected void
Add appropriate comments to metadata header.protected void
Write the <IDPSSODescriptor>.protected void
Write out any <KeyDescriptor>Elements.protected void
writeKeyDescriptors
(List<List<String>> certs, String use) Write out <KeyDescriptor>Elements.protected void
writeLangAttribute
(String language) Write the language attribute.protected void
Write out the <mdui:UIINFO> element and children.protected void
writeNameSpace
(String prefix, String name) Writeout a prefix/namespace pair.protected void
writeNameSpaceQualified
(String nameSpace, String what) Write a namespace:identifier pair.protected void
writeRoleDescriptor
(String name, List<String> protocols) Write out an role descriptor.protected void
Write out the <shibmd:Scope> element.Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
destroy, doDestroy, initialize, isDestroyed, isInitialized
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.shibboleth.utilities.java.support.component.InitializableComponent
initialize, isInitialized
-
Field Details
-
BACKCHANNEL_ENDPOINTS
Those endpoints which require a backchannel. -
ARTIFACT_ENDPOINTS
the Artifact endpoints. -
SSO_ENDPOINTS
the SSO endpoints. -
SLO_ENDPOINTS
the SLO endpoints. -
AA_ENDPOINTS
AttributeAuthority endpoints. -
endpoints
Which endpoints to generate. -
saml2AttributeQueryCommented
private boolean saml2AttributeQueryCommentedWhether to comment out the SAML2 AA endpoint. -
saml2LogoutCommented
private boolean saml2LogoutCommentedWhether to comment out the SAML2 SLO endpoints. -
saml1Commented
private boolean saml1CommentedWhether SAML1 is commented out. -
commentDepth
private int commentDepthComment depth. -
writer
Where to write to - asBufferedWriter
. -
output
Where to write to - asFile
. -
params
The parameters.
-
-
Constructor Details
-
MetadataGeneratorImpl
public MetadataGeneratorImpl()
-
-
Method Details
-
doInitialize
- Overrides:
doInitialize
in classAbstractInitializableComponent
- Throws:
ComponentInitializationException
-
setOutput
Set where to write the metadata.- Specified by:
setOutput
in interfaceMetadataGenerator
- Parameters:
file
- what to set.
-
setParameters
Set a description of the IdP.- Specified by:
setParameters
in interfaceMetadataGenerator
- Parameters:
what
- what to set. This component does not have to be initialized.
-
removeBackChannel
public void removeBackChannel()remove back channel endpoints. -
getEndpoints
Get the Endpoints.- Returns:
- Returns the Endpoints
-
setEndpoints
Set the Endpoints.- Parameters:
points
- what to set.
-
isSAML2AttributeQueryCommented
public boolean isSAML2AttributeQueryCommented()Returns whether to comment the SAML2 AA endpoint.- Returns:
- whether to comment the SAML2 AA endpoint
-
setSAML2AttributeQueryCommented
public void setSAML2AttributeQueryCommented(boolean asComment) Sets whether to comment the SAML2 AA endpoint.- Parameters:
asComment
- whether to comment or not.
-
isSAML1Commented
public boolean isSAML1Commented()Returns whether to comment SAML1 endpoints.- Returns:
- whether to comment SAML1 endpoints
-
setSAML1Commented
public void setSAML1Commented(boolean asComment) Sets whether to comment the comment SAML1 endpoints.- Parameters:
asComment
- whether to comment or not.
-
isSAML2LogoutCommented
public boolean isSAML2LogoutCommented()Returns whether to comment the SAML2 Logout endpoints.- Returns:
- whether to comment the SAML2 Logout endpoints
-
setSAML2LogoutCommented
public void setSAML2LogoutCommented(boolean asComment) Sets whether to comment the SAML2 Logout endpoints.- Parameters:
asComment
- whether to comment or not
-
generate
public void generate() throws org.apache.tools.ant.BuildExceptionGenerate the metadata given the parameters.- Specified by:
generate
in interfaceMetadataGenerator
- Throws:
org.apache.tools.ant.BuildException
- if badness occurs.
-
writeComments
Add appropriate comments to metadata header.- Throws:
IOException
- if badness occurs in the writer
-
writeNameSpace
Writeout a prefix/namespace pair.- Parameters:
prefix
- the prefix, or nullname
- the namespace- Throws:
IOException
- if badness happens
-
writeIDPSSO
Write the <IDPSSODescriptor>.- Throws:
IOException
- if badness happens
-
writeAttributeAuthorityDescriptor
Write the <AttributeAuthorityDescriptor>.- Throws:
IOException
- if badness happens
-
writeRoleDescriptor
Write out an role descriptor.- Parameters:
name
- the nameprotocols
- the supported protocols- Throws:
IOException
- when badness happebns
-
openExtensions
Write the open <Extensions> elements.- Throws:
IOException
- if badness happens
-
closeExtensions
Write out the close <\Extensions> Element.- Throws:
IOException
- if badness happens
-
writeScope
Write out the <shibmd:Scope> element.- Throws:
IOException
- if badness happens
-
writeMDUI
Write out the <mdui:UIINFO> element and children.- Throws:
IOException
- if badness happens
-
writeLangAttribute
Write the language attribute.- Parameters:
language
- which languages- Throws:
IOException
- if badness happens
-
writeKeyDescriptors
Write out any <KeyDescriptor>Elements.- Throws:
IOException
- if badness happens
-
writeKeyDescriptors
protected void writeKeyDescriptors(@Nullable List<List<String>> certs, @Nonnull @NotEmpty String use) throws IOException Write out <KeyDescriptor>Elements. of a specific type- Parameters:
certs
- the certificatesuse
- the type - signing or encryption- Throws:
IOException
- if badness happens
-
outputEndpoint
Output the SAML for a single endpoint.- Parameters:
endpoint
- the type- Throws:
IOException
- if badness happens.
-
writeNameSpaceQualified
Write a namespace:identifier pair.- Parameters:
nameSpace
- the namespacewhat
- the identifier- Throws:
IOException
- if badness happens
-
openComment
Add an open comment. If we are nested closes the previous one.- Throws:
IOException
- if badness happens
-
closeComment
Add a close comment. If we are nested reopens the previous one.- Throws:
IOException
- if badness happens
-