Skip to content

Commit f4724b7

Browse files
committed
Clear out the confusion about the use of ACS acronym
ACS is usually used to refer to the Assertion Consumer Service concept in SAML. The ACS may also behave as an Attribute Consuming Services, but in general the two concepts are separate. This fixes the use of the ACS acronym for the Assertion Consumer Service only.
1 parent 4e2698e commit f4724b7

File tree

8 files changed

+56
-44
lines changed

8 files changed

+56
-44
lines changed

README.md

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -513,36 +513,36 @@ The getSPMetadata will return the metadata signed or not based on the security p
513513

514514
Before the XML metadata is exposed, a check takes place to ensure that the info to be provided is valid.
515515

516-
##### Attribute Consuming Service (ACS)
516+
##### Attribute Consuming Services
517517
The SP may optionally specify one or more Attribute Consuming Services in its metadata. These can be configured in the settings.
518518

519-
If just one ACS is required:
519+
If just one Attribute Consuming Service is required:
520520

521521
```properties
522-
# Attribute Consuming Service name when just one ACS should be declared by the SP.
523-
# Comment out or set to empty if no ACS should be declared, or if multiple ones should (see below).
522+
# Attribute Consuming Service name when just one such service should be declared by the SP.
523+
# Comment out or set to empty if no Attribute Consuming Service should be declared, or if multiple ones should (see below).
524524
# The service name is mandatory.
525525
onelogin.saml2.sp.attribute_consuming_service.name = My service
526526

527-
# Attribute Consuming Service description when just one ACS should be declared by the SP.
527+
# Attribute Consuming Service description when just one such service should be declared by the SP.
528528
# Ignored if the previous property is commented or empty.
529529
# The service description is optional.
530530
onelogin.saml2.sp.attribute_consuming_service.description = My service description
531531

532-
# Language used for Attribute Consuming Service name and description when just one ACS should be declared by the SP.
532+
# Language used for Attribute Consuming Service name and description when just one such service should be declared by the SP.
533533
# Ignored if the name property is commented or empty.
534-
# The language is optional and default to "en" (English).
534+
# The language is optional and defaults to "en" (English).
535535
onelogin.saml2.sp.attribute_consuming_service.lang = en
536536

537-
# Requested attributes to be included in the Attribute Consuming Service when just one ACS should be declared by the SP.
537+
# Requested attributes to be included in the Attribute Consuming Service when just one such service should be declared by the SP.
538538
# At least one requested attribute must be specified, otherwise schema validation will fail.
539539
# Attribute properties are indexed properties, starting from 0. The index is used only to enumerate and sort attributes, but it's required.
540540
# The following properties allow to define each requested attribute:
541541
# - name: mandatory
542542
# - name_format: optional; if omitted, defaults to urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified
543543
# - friendly_name: optional; if omitted, it won't appear in SP metadata
544544
# - required: optional; if omitted or empty, defaults to false
545-
# - value[x]: an attribute value; the [x] is only used only to enumerate and sort values, but it's required
545+
# - value[x]: an attribute value; the [x] index is used only to enumerate and sort values, but it's required
546546
# Please note that only simple values are currently supported and treated internally as strings. Hence no structured values
547547
# and no ability to specify an xsi:type attribute.
548548
# Attribute values are optional and most often they are simply omitted.
@@ -554,9 +554,10 @@ onelogin.saml2.sp.attribute_consuming_service.attribute[0].value[0] = foo@exampl
554554
onelogin.saml2.sp.attribute_consuming_service.attribute[0].value[1] = bar@example.org
555555
```
556556

557-
If multiple ACSs are required, they can be specified in a similar way, but using indexes: these indexes are used to enumerate and
558-
identify attribute consuming services within the SP metadata and can be subsequently used in the auth process to specify which
559-
attribute set should be requested to the IdP. The "default" property can also be set to designate the default ACS. Here is an example:
557+
If multiple Attribute Consuming Services are required, they can be specified in a similar way, but using indexes: these indexes
558+
are used to enumerate and identify attribute consuming services within the SP metadata and can be subsequently used in the auth
559+
process to specify which attribute set should be requested to the IdP. The "default" property can also be set to designate the
560+
default Attribute Consuming Service. Here is an example:
560561

561562
```properties
562563
onelogin.saml2.sp.attribute_consuming_service[0].name = Just e-mail
@@ -584,15 +585,17 @@ import static com.onelogin.saml2.authn.AttributeConsumingServiceSelector.*;
584585
Auth auth = new Auth(request, response);
585586
// select by index 1
586587
auth.login(new AuthnRequestParams(false, false, true, byIndex(1));
587-
// or select by ACS name
588+
// or select by service name
588589
auth.login(new AuthnRequestParams(false, false, true, byServiceName(auth.getSettings(), "Anagrafica"));
589590
// or see AttributeConsumingServiceSelector interface implementations for more options
590591
```
591592

592593
If no selector is specified, `AttributeConsumingServiceSelector.useDefault()` will be used, which will simply omit any
593594
`AttributeConsumingServiceIndex` from the request, hence leaving the IdP choose the default attribute set agreed upon.
594595

595-
Then, the following code handles the SAML response that the IdP forwards to the SP through the user's client:
596+
597+
##### Assertion Consumer Service (ACS)
598+
This code handles the SAML response that the IdP forwards to the SP through the user's client:
596599
597600
```java
598601
Auth auth = new Auth(request, response);

core/src/main/java/com/onelogin/saml2/settings/Metadata.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ private StrSubstitutor generateSubstitutor(Saml2Settings settings) throws Certif
177177
valueMap.put("spAssertionConsumerServiceUrl", Util.toXml(settings.getSpAssertionConsumerServiceUrl().toString()));
178178
valueMap.put("sls", toSLSXml(settings.getSpSingleLogoutServiceUrl(), settings.getSpSingleLogoutServiceBinding()));
179179

180-
// if an ACS was specified at construction time, use it in place of the ones specified in settings
180+
// if an Attribute Consuming Service was specified at construction time, use it in place of the ones specified in settings
181181
// this is for backward compatibility
182182
valueMap.put("strAttributeConsumingService",
183183
toAttributeConsumingServicesXml(attributeConsumingService != null

core/src/main/java/com/onelogin/saml2/settings/SettingsBuilder.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -542,17 +542,17 @@ private List<Contact> loadContacts() {
542542
*/
543543
private List<AttributeConsumingService> loadAttributeConsumingServices() {
544544
// first split properties into a map of properties
545-
// key = ACS index; value = ACS properties
545+
// key = service index; value = service properties
546546
final SortedMap<Integer, Map<String, Object>> acsProps =
547547
extractIndexedProperties(SP_ATTRIBUTE_CONSUMING_SERVICE_PROPERTY_KEY_PREFIX, samlData);
548-
// then build each ACS
548+
// then build each Attribute Consuming Service
549549
if(acsProps.containsKey(-1) && acsProps.size() == 1)
550-
// single ACS specified; use index 1 for backward compatibility
550+
// single service specified; use index 1 for backward compatibility
551551
return Arrays.asList(loadAttributeConsumingService(acsProps.get(-1), 1));
552552
else
553-
// multiple indexed ACSs specified
553+
// multiple indexed services specified
554554
return acsProps.entrySet().stream()
555-
// ignore non-indexed ACS
555+
// ignore non-indexed service
556556
.filter(entry -> entry.getKey() != -1)
557557
.map(entry -> loadAttributeConsumingService(entry.getValue(), entry.getKey()))
558558
.collect(Collectors.toList());
@@ -562,10 +562,10 @@ private List<AttributeConsumingService> loadAttributeConsumingServices() {
562562
* Loads a single Attribute Consuming Service from settings.
563563
*
564564
* @param acsProps
565-
* a map containing the ACS settings
565+
* a map containing the Attribute Consuming Service settings
566566
* @param index
567-
* the index to be set on the returned ACS
568-
* @return the loaded ACS
567+
* the index to be set on the returned Attribute Consuming Service
568+
* @return the loaded Attribute Consuming Service
569569
*/
570570
private AttributeConsumingService loadAttributeConsumingService(Map<String, Object> acsProps, int index) {
571571
final String serviceName = loadStringProperty(SP_ATTRIBUTE_CONSUMING_SERVICE_NAME_PROPERTY_KEY_SUFFIX, acsProps);

core/src/test/java/com/onelogin/saml2/test/settings/MetadataTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,7 @@ public void testToAttributeConsumingServiceXmlWithMultipleAttributeValueLegacySp
721721
* @see com.onelogin.saml2.settings.Metadata#toAttributeConsumingServicesXml
722722
*/
723723
@Test
724-
public void testToAttributeConsumingServiceXmlSingleACS() throws IOException, CertificateEncodingException, Error {
724+
public void testToAttributeConsumingServiceXmlSingleService() throws IOException, CertificateEncodingException, Error {
725725
Saml2Settings settings = getSettingFromAllProperties();
726726

727727
Metadata metadataObj = new Metadata(settings, null, null);
@@ -792,8 +792,8 @@ public void testToAttributeConsumingServiceXmlSingleACSSpecialChars() throws IOE
792792
* @see com.onelogin.saml2.settings.Metadata#toAttributeConsumingServicesXml
793793
*/
794794
@Test
795-
public void testToAttributeConsumingServiceXmlMultiACS() throws IOException, CertificateEncodingException, Error {
796-
Saml2Settings settings = getSettingFromAllPropertiesMultiACS();
795+
public void testToAttributeConsumingServiceXmlMultiServices() throws IOException, CertificateEncodingException, Error {
796+
Saml2Settings settings = getSettingFromAllPropertiesMultiAttributeConsumingServices();
797797

798798
Metadata metadataObj = new Metadata(settings, null, null);
799799
String metadataStr = metadataObj.getMetadataString();
@@ -927,7 +927,7 @@ private Saml2Settings getSettingFromAllSpecialCharsProperties() throws Error, IO
927927
return new SettingsBuilder().fromFile("config/config.all_specialchars.properties").build();
928928
}
929929

930-
private Saml2Settings getSettingFromAllPropertiesMultiACS() throws Error, IOException {
930+
private Saml2Settings getSettingFromAllPropertiesMultiAttributeConsumingServices() throws Error, IOException {
931931
return new SettingsBuilder().fromFile("config/config.all_multi_attribute_consuming_services.properties").build();
932932
}
933933

core/src/test/resources/config/config.all.properties

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,22 @@ onelogin.saml2.sp.single_logout_service.binding = urn:oasis:names:tc:SAML:2.0:bi
3131
# Take a look on lib/Saml2/Constants.php to see the NameIdFormat supported
3232
onelogin.saml2.sp.nameidformat = urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified
3333

34-
# Attribute Consuming Service name when just one ACS should be declared by the SP.
35-
# Comment out or set to empty if no ACS should be declared, or if multiple ones should (see below).
34+
# Attribute Consuming Service name when just one such service should be declared by the SP.
35+
# Comment out or set to empty if no Attribute Consuming Service should be declared, or if multiple ones should (see below).
3636
# The service name is mandatory.
3737
onelogin.saml2.sp.attribute_consuming_service.name = My service
3838

39-
# Attribute Consuming Service description when just one ACS should be declared by the SP.
39+
# Attribute Consuming Service description when just one such service should be declared by the SP.
4040
# Ignored if the previous property is commented or empty.
4141
# The service description is optional.
4242
onelogin.saml2.sp.attribute_consuming_service.description = My service description
4343

44-
# Language used for Attribute Consuming Service name and description when just one ACS should be declared by the SP.
44+
# Language used for Attribute Consuming Service name and description when just one such service should be declared by the SP.
4545
# Ignored if the name property is commented or empty.
4646
# The language is optional and default to "en" (English).
4747
onelogin.saml2.sp.attribute_consuming_service.lang = en
4848

49-
# Attributes to be included in the Attribute Consuming Service when just one ACS should be declared by the SP.
49+
# Attributes to be included in the Attribute Consuming Service when just one such service should be declared by the SP.
5050
# These are indexed properties, starting from 0. The index is used only to enumerate and sort attributes, but it's required.
5151
# The following properties allow to define each attribute:
5252
# - name: mandatory

core/src/test/resources/config/config.all_multi_attribute_consuming_services.properties

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,24 +31,24 @@ onelogin.saml2.sp.single_logout_service.binding = urn:oasis:names:tc:SAML:2.0:bi
3131
# Take a look on lib/Saml2/Constants.php to see the NameIdFormat supported
3232
onelogin.saml2.sp.nameidformat = urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified
3333

34-
# THE FOLLOWING PROPERTIES FOR SINGLE ACS MUST BE IGNORED - MULTIPLE SERVICES DEFINED LATER
34+
# THE FOLLOWING PROPERTIES FOR SINGLE ATTRIBUTE CONSUMING SERVICE MUST BE IGNORED - MULTIPLE SERVICES DEFINED LATER
3535

36-
# Attribute Consuming Service name when just one ACS should be declared by the SP.
37-
# Comment out or set to empty if no ACS should be declared, or if multiple ones should (see below).
36+
# Attribute Consuming Service name when just one such service should be declared by the SP.
37+
# Comment out or set to empty if no Attribute Consuming Service should be declared, or if multiple ones should (see below).
3838
# The service name is mandatory.
3939
onelogin.saml2.sp.attribute_consuming_service.name = My service
4040

41-
# Attribute Consuming Service description when just one ACS should be declared by the SP.
41+
# Attribute Consuming Service description when just one such service should be declared by the SP.
4242
# Ignored if the previous property is commented or empty.
4343
# The service description is optional.
4444
onelogin.saml2.sp.attribute_consuming_service.description = My service description
4545

46-
# Language used for Attribute Consuming Service name and description when just one ACS should be declared by the SP.
46+
# Language used for Attribute Consuming Service name and description when just one such service should be declared by the SP.
4747
# Ignored if the name property is commented or empty.
4848
# The language is optional and default to "en" (English).
4949
onelogin.saml2.sp.attribute_consuming_service.lang = en
5050

51-
# Attributes to be included in the Attribute Consuming Service when just one ACS should be declared by the SP.
51+
# Attributes to be included in the Attribute Consuming Service when just one such service should be declared by the SP.
5252
# These are indexed properties, starting from 0. The index is used only to enumerate and sort attributes, but it's required.
5353
# The following properties allow to define each attribute:
5454
# - name: mandatory

core/src/test/resources/config/config.all_specialchars.properties

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,22 @@ onelogin.saml2.sp.single_logout_service.binding = urn:oasis:names:tc:SAML:2.0:bi
3131
# Take a look on lib/Saml2/Constants.php to see the NameIdFormat supported
3232
onelogin.saml2.sp.nameidformat = urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified
3333

34-
# Attribute Consuming Service name when just one ACS should be declared by the SP.
35-
# Comment out or set to empty if no ACS should be declared, or if multiple ones should (see below).
34+
# Attribute Consuming Service name when just one such service should be declared by the SP.
35+
# Comment out or set to empty if no Attribute Consuming Service should be declared, or if multiple ones should (see below).
3636
# The service name is mandatory.
3737
onelogin.saml2.sp.attribute_consuming_service.name = My s&rvice
3838

39-
# Attribute Consuming Service description when just one ACS should be declared by the SP.
39+
# Attribute Consuming Service description when just one such service should be declared by the SP.
4040
# Ignored if the previous property is commented or empty.
4141
# The service description is optional.
4242
onelogin.saml2.sp.attribute_consuming_service.description = My s&rvice description
4343

44-
# Language used for Attribute Consuming Service name and description when just one ACS should be declared by the SP.
44+
# Language used for Attribute Consuming Service name and description when just one such service should be declared by the SP.
4545
# Ignored if the name property is commented or empty.
4646
# The language is optional and default to "en" (English).
4747
onelogin.saml2.sp.attribute_consuming_service.lang = &n
4848

49-
# Attributes to be included in the Attribute Consuming Service when just one ACS should be declared by the SP.
49+
# Attributes to be included in the Attribute Consuming Service when just one such service should be declared by the SP.
5050
# These are indexed properties, starting from 0. The index is used only to enumerate and sort attributes, but it's required.
5151
# The following properties allow to define each attribute:
5252
# - name: mandatory
@@ -171,6 +171,15 @@ onelogin.saml2.security.signature_algorithm = http://www.w3.org/2001/04/xmldsig-
171171
# 'http://www.w3.org/2001/04/xmlenc#sha512'
172172
onelogin.saml2.security.digest_algorithm = http://www.w3.org/2001/04/xmlenc#sha512
173173

174+
# Enable trimming of parsed Name IDs and attribute values
175+
# SAML specification states that no trimming for string elements should be performed, so no trimming will be
176+
# performed by default on extracted Name IDs and attribute values. However, some SAML implementations may add
177+
# undesirable surrounding whitespace when outputting XML (possibly due to formatting/pretty-printing).
178+
# These two options allow to optionally enable value trimming on extracted Name IDs (including issuers) and
179+
# attribute values.
180+
onelogin.saml2.parsing.trim_name_ids = false
181+
onelogin.saml2.parsing.trim_attribute_values = false
182+
174183
# Organization
175184
onelogin.saml2.organization.name = S&P Java
176185
onelogin.saml2.organization.displayname = S&P Java "Example"

core/src/test/resources/config/config.min_multi_attribute_consuming_services.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ onelogin.saml2.sp.assertion_consumer_service.url = http://localhost:8080/java-sa
1010
# URL Location where the <LogoutResponse> from the IdP will be returned or where to send the <LogoutRequest>
1111
onelogin.saml2.sp.single_logout_service.url = http://localhost:8080/java-saml-jspsample/sls.jsp
1212

13-
# Attributes to be included in the Attribute Consuming Service when just one ACS should be declared by the SP.
13+
# Attributes to be included in the Attribute Consuming Service when just one such service should be declared by the SP.
1414
# These are indexed properties, starting from 0. The index is used only to enumerate and sort attributes, but it's required.
1515
# The following properties allow to define each attribute:
1616
# - name: mandatory

0 commit comments

Comments
 (0)