Package com.onelogin.saml2.settings
Class SettingsBuilder
java.lang.Object
com.onelogin.saml2.settings.SettingsBuilder
SettingsBuilder class of OneLogin's Java Toolkit.
A class that implements the settings builder
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringDeprecated.static final StringDeprecated.static final StringDeprecated.static final StringDeprecated.static final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringprivate static final org.slf4j.LoggerPrivate property to construct a logger for this class.static final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringprivate Saml2SettingsSaml2Settings objectPrivate property that contains the SAML settingsstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds the Saml2Settings object.build(Saml2Settings saml2Setting) Builds the Saml2Settings object.extractIndexedProperties(String prefix, Map<String, Object> data) Given a map containing settings data, extracts all the indexed properties identified by a given prefix.extractIndexedValues(String prefix, Map<String, Object> data) Given a map containing settings data, extracts all the indexed values identified by a given prefix.Load settings from the filefromFile(String propFileName, KeyStoreSettings keyStoreSetting) Load settings from the filefromProperties(Properties prop) Loads the settings from a properties objectfromValues(Map<String, Object> samlData) Loads the settings from mapped values.fromValues(Map<String, Object> samlData, KeyStoreSettings keyStoreSetting) Loads the settings from mapped values and KeyStore settings.protected X509CertificategetCertificateFromKeyStore(KeyStore keyStore, String alias, String password) protected PrivateKeygetPrivateKeyFromKeyStore(KeyStore keyStore, String alias, String password) private booleanAux method that verifies if an Object is an stringprivate BooleanloadBooleanProperty(String propertyKey) Loads a property of the type Boolean from the Properties objectprotected X509CertificateloadCertificateFromProp(Object propValue) Loads a property of the type X509Certificate from the property valueprotected X509CertificateloadCertificateFromProp(String propertyKey) Loads a property of the type X509Certificate from the Properties objectprivate List<X509Certificate> loadCertificateListFromProp(String propertyKey) Loads a property of the type List of X509Certificate from the Properties objectprivate voidLoads the compress settings from the properties fileprivate ContactloadContact(Map<String, Object> contactProps, int index) Loads a single contact from settings.Loads the contacts settings from the properties fileprivate voidLoads the IdP settings from the properties fileloadListProperty(String propertyKey) Loads a property of the type List from the Properties objectprivate OrganizationLoads the organization settings from the properties fileprivate voidLoads the parsing settings from the properties fileprotected PrivateKeyloadPrivateKeyFromProp(String propertyKey) Loads a property of the type PrivateKey from the Properties objectprivate voidLoads the security settings from the properties fileprivate voidLoads the SP settings from the properties fileprivate StringloadStringProperty(String propertyKey) Loads a property of the type String from the Properties objectprivate StringloadStringProperty(String propertyKey, Map<String, Object> data) Loads a property of the type String from the specified dataprivate StringLoads the unique ID prefix.private URLloadURLProperty(String propertyKey) Loads a property of the type URL from the Properties objectprivate voidparseKeyStore(KeyStoreSettings setting) Parses the KeyStore dataprivate voidparseProperties(Properties properties) Parses propertiestoStringList(Map<Integer, Object> indexedValues) Given a map of indexed property values (possibly extracted withextractIndexedValues(String, Map)), returns a list containing all theStringvalues contained in the map, sorted by their iteration order.
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGERPrivate property to construct a logger for this class. -
samlData
Private property that contains the SAML settings -
saml2Setting
Saml2Settings object -
STRICT_PROPERTY_KEY
- See Also:
-
DEBUG_PROPERTY_KEY
- See Also:
-
SP_ENTITYID_PROPERTY_KEY
- See Also:
-
SP_ASSERTION_CONSUMER_SERVICE_URL_PROPERTY_KEY
- See Also:
-
SP_ASSERTION_CONSUMER_SERVICE_BINDING_PROPERTY_KEY
- See Also:
-
SP_SINGLE_LOGOUT_SERVICE_URL_PROPERTY_KEY
- See Also:
-
SP_SINGLE_LOGOUT_SERVICE_BINDING_PROPERTY_KEY
- See Also:
-
SP_NAMEIDFORMAT_PROPERTY_KEY
- See Also:
-
SP_X509CERT_PROPERTY_KEY
- See Also:
-
SP_PRIVATEKEY_PROPERTY_KEY
- See Also:
-
SP_X509CERTNEW_PROPERTY_KEY
- See Also:
-
SP_CONTACT_PROPERTY_KEY_PREFIX
- See Also:
-
SP_CONTACT_CONTACT_TYPE_PROPERTY_KEY_SUFFIX
- See Also:
-
SP_CONTACT_COMPANY_PROPERTY_KEY_SUFFIX
- See Also:
-
SP_CONTACT_GIVEN_NAME_PROPERTY_KEY_SUFFIX
- See Also:
-
SP_CONTACT_SUR_NAME_PROPERTY_KEY_SUFFIX
- See Also:
-
SP_CONTACT_EMAIL_ADDRESS_PROPERTY_KEY_PREFIX
- See Also:
-
SP_CONTACT_TELEPHONE_NUMBER_PROPERTY_KEY_PREFIX
- See Also:
-
KEYSTORE_KEY
- See Also:
-
KEYSTORE_ALIAS
- See Also:
-
KEYSTORE_KEY_PASSWORD
- See Also:
-
IDP_ENTITYID_PROPERTY_KEY
- See Also:
-
IDP_SINGLE_SIGN_ON_SERVICE_URL_PROPERTY_KEY
- See Also:
-
IDP_SINGLE_SIGN_ON_SERVICE_BINDING_PROPERTY_KEY
- See Also:
-
IDP_SINGLE_LOGOUT_SERVICE_URL_PROPERTY_KEY
- See Also:
-
IDP_SINGLE_LOGOUT_SERVICE_RESPONSE_URL_PROPERTY_KEY
- See Also:
-
IDP_SINGLE_LOGOUT_SERVICE_BINDING_PROPERTY_KEY
- See Also:
-
IDP_X509CERT_PROPERTY_KEY
- See Also:
-
IDP_X509CERTMULTI_PROPERTY_KEY
- See Also:
-
CERTFINGERPRINT_PROPERTY_KEY
- See Also:
-
CERTFINGERPRINT_ALGORITHM_PROPERTY_KEY
- See Also:
-
SECURITY_NAMEID_ENCRYPTED
- See Also:
-
SECURITY_AUTHREQUEST_SIGNED
- See Also:
-
SECURITY_LOGOUTREQUEST_SIGNED
- See Also:
-
SECURITY_LOGOUTRESPONSE_SIGNED
- See Also:
-
SECURITY_WANT_MESSAGES_SIGNED
- See Also:
-
SECURITY_WANT_ASSERTIONS_SIGNED
- See Also:
-
SECURITY_WANT_ASSERTIONS_ENCRYPTED
- See Also:
-
SECURITY_WANT_NAMEID
- See Also:
-
SECURITY_WANT_NAMEID_ENCRYPTED
- See Also:
-
SECURITY_SIGN_METADATA
- See Also:
-
SECURITY_REQUESTED_AUTHNCONTEXT
- See Also:
-
SECURITY_REQUESTED_AUTHNCONTEXTCOMPARISON
- See Also:
-
SECURITY_WANT_XML_VALIDATION
- See Also:
-
SECURITY_SIGNATURE_ALGORITHM
- See Also:
-
SECURITY_DIGEST_ALGORITHM
- See Also:
-
SECURITY_REJECT_UNSOLICITED_RESPONSES_WITH_INRESPONSETO
- See Also:
-
SECURITY_ALLOW_REPEAT_ATTRIBUTE_NAME_PROPERTY_KEY
- See Also:
-
SECURITY_REJECT_DEPRECATED_ALGORITHM
- See Also:
-
COMPRESS_REQUEST
- See Also:
-
COMPRESS_RESPONSE
- See Also:
-
PARSING_TRIM_NAME_IDS
- See Also:
-
PARSING_TRIM_ATTRIBUTE_VALUES
- See Also:
-
CONTACT_TECHNICAL_GIVEN_NAME
Deprecated.- See Also:
-
CONTACT_TECHNICAL_EMAIL_ADDRESS
Deprecated.- See Also:
-
CONTACT_SUPPORT_GIVEN_NAME
Deprecated.- See Also:
-
CONTACT_SUPPORT_EMAIL_ADDRESS
Deprecated.- See Also:
-
ORGANIZATION_NAME
- See Also:
-
ORGANIZATION_DISPLAYNAME
- See Also:
-
ORGANIZATION_URL
- See Also:
-
ORGANIZATION_LANG
- See Also:
-
UNIQUE_ID_PREFIX_PROPERTY_KEY
- See Also:
-
-
Constructor Details
-
SettingsBuilder
public SettingsBuilder()
-
-
Method Details
-
fromFile
Load settings from the file- Parameters:
propFileName- OneLogin_Saml2_Settings- Returns:
- the SettingsBuilder object with the settings loaded from the file
- Throws:
IOExceptionError
-
fromFile
public SettingsBuilder fromFile(String propFileName, KeyStoreSettings keyStoreSetting) throws Error, IOException Load settings from the file- Parameters:
propFileName- OneLogin_Saml2_SettingskeyStoreSetting- KeyStore which have the Private/Public keys- Returns:
- the SettingsBuilder object with the settings loaded from the file
- Throws:
IOExceptionError
-
fromProperties
Loads the settings from a properties object- Parameters:
prop- contains the properties- Returns:
- the SettingsBuilder object with the settings loaded from the prop object
-
fromValues
Loads the settings from mapped values.- Parameters:
samlData- Mapped values.- Returns:
- the SettingsBuilder object with the settings loaded from the prop object
-
fromValues
Loads the settings from mapped values and KeyStore settings.- Parameters:
samlData- Mapped values.keyStoreSetting- KeyStore model- Returns:
- the SettingsBuilder object with the settings loaded from the prop object
-
build
Builds the Saml2Settings object. Read the Properties object and set all the SAML settings- Returns:
- the Saml2Settings object with all the SAML settings loaded
-
build
Builds the Saml2Settings object. Read the Properties object and set all the SAML settings- Parameters:
saml2Setting- an existing Saml2Settings- Returns:
- the Saml2Settings object with all the SAML settings loaded
-
loadIdpSetting
private void loadIdpSetting()Loads the IdP settings from the properties file -
loadSecuritySetting
private void loadSecuritySetting()Loads the security settings from the properties file -
loadCompressSetting
private void loadCompressSetting()Loads the compress settings from the properties file -
loadParsingSetting
private void loadParsingSetting()Loads the parsing settings from the properties file -
loadOrganization
Loads the organization settings from the properties file -
loadContacts
Loads the contacts settings from the properties file- Returns:
- a list containing all the loaded contacts
-
loadContact
Loads a single contact from settings.- Parameters:
contactProps- a map containing the contact settingsindex- the contact index- Returns:
- the loaded contact
-
extractIndexedProperties
private SortedMap<Integer,Map<String, extractIndexedPropertiesObject>> (String prefix, Map<String, Object> data) Given a map containing settings data, extracts all the indexed properties identified by a given prefix. The returned map has indexes as keys and a map describing the extracted indexed data as values. Keys are sorted by their natural order (i.e. iterating over the map will return entries in index order).For instance, if the prefix is
foo, all the following properties will be extracted:foo[0].prop1=<value1> foo[0].prop2=<value2> foo[1].prop1=<value3>
and the returned map will be:0 => prop1=<value1> prop2=<value2> 1 => prop1=<value3>The index is optional: if missing, "-1" is returned. In other words, in the above example:foo.prop1=<value1> foo.prop2=<value2>
will be mapped to:-1 => prop1=<value1> prop2=<value2>Indices can be made of maximum 9 digits, to prevent overflows. Leading zeroes are discarded.- Parameters:
prefix- the prefix that identifies the indexed property to extractdata- the input data- Returns:
- a map with extracted data for each identified index
-
extractIndexedValues
Given a map containing settings data, extracts all the indexed values identified by a given prefix. The returned map has indexes as keys and the corresponding values as values. Keys are sorted by their natural order (i.e. iterating over the map will return entries in index order).For instance, if the prefix is
foo, all the following values will be extracted:foo[0]=<value1> foo[1]=<value2> foo[2]=<value3>
and the returned map will be:0 => <value1> 1 => <value2> 3 => <value3>
The index is optional: if missing, "-1" is returned. In other words, in the above example:foo=<value1>
will be mapped to:-1 => <value1>
Indices can be made of maximum 9 digits, to prevent overflows. Leading zeroes are discarded.- Parameters:
prefix- the prefix that identifies the indexed property to extractdata- the input data- Returns:
- a map with extracted values for each identified index
-
toStringList
Given a map of indexed property values (possibly extracted withextractIndexedValues(String, Map)), returns a list containing all theStringvalues contained in the map, sorted by their iteration order.- Parameters:
indexedValues- a map containing indexed values (key = index; value = actual value)- Returns:
- a list containing all the string values in the input map, sorted by
their iteration order; therefore, if the map is a
SortedMap, the returned list has values sorted by their index
-
loadUniqueIDPrefix
Loads the unique ID prefix. Uses default if property not set. -
loadSpSetting
private void loadSpSetting()Loads the SP settings from the properties file -
loadStringProperty
Loads a property of the type String from the Properties object- Parameters:
propertyKey- the property name- Returns:
- the value
-
loadStringProperty
Loads a property of the type String from the specified data- Parameters:
propertyKey- the property namedata- the input data- Returns:
- the value
-
loadBooleanProperty
Loads a property of the type Boolean from the Properties object- Parameters:
propertyKey- the property name- Returns:
- the value
-
loadListProperty
Loads a property of the type List from the Properties object- Parameters:
propertyKey- the property name- Returns:
- the value
-
loadURLProperty
Loads a property of the type URL from the Properties object- Parameters:
propertyKey- the property name- Returns:
- the value
-
getPrivateKeyFromKeyStore
-
getCertificateFromKeyStore
protected X509Certificate getCertificateFromKeyStore(KeyStore keyStore, String alias, String password) -
loadCertificateFromProp
Loads a property of the type X509Certificate from the property value- Parameters:
propValue- the property value- Returns:
- the X509Certificate object
-
loadCertificateFromProp
Loads a property of the type X509Certificate from the Properties object- Parameters:
propertyKey- the property name- Returns:
- the X509Certificate object
-
loadCertificateListFromProp
Loads a property of the type List of X509Certificate from the Properties object- Parameters:
propertyKey- the property name- Returns:
- the X509Certificate object list
-
loadPrivateKeyFromProp
Loads a property of the type PrivateKey from the Properties object- Parameters:
propertyKey- the property name- Returns:
- the PrivateKey object
-
parseProperties
Parses properties- Parameters:
properties- the Properties object to be parsed
-
parseKeyStore
Parses the KeyStore data- Parameters:
setting- the KeyStoreSettings object to be parsed
-
isString
Aux method that verifies if an Object is an string- Parameters:
propValue- the Object to be verified
-