Skip to content

Commit 9888eb8

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 f282e6d commit 9888eb8

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
@@ -500,36 +500,36 @@ The getSPMetadata will return the metadata signed or not based on the security p
500500

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

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

506-
If just one ACS is required:
506+
If just one Attribute Consuming Service is required:
507507

508508
```properties
509-
# Attribute Consuming Service name when just one ACS should be declared by the SP.
510-
# Comment out or set to empty if no ACS should be declared, or if multiple ones should (see below).
509+
# Attribute Consuming Service name when just one such service should be declared by the SP.
510+
# Comment out or set to empty if no Attribute Consuming Service should be declared, or if multiple ones should (see below).
511511
# The service name is mandatory.
512512
onelogin.saml2.sp.attribute_consuming_service.name = My service
513513

514-
# Attribute Consuming Service description when just one ACS should be declared by the SP.
514+
# Attribute Consuming Service description when just one such service should be declared by the SP.
515515
# Ignored if the previous property is commented or empty.
516516
# The service description is optional.
517517
onelogin.saml2.sp.attribute_consuming_service.description = My service description
518518

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

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

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

548549
```properties
549550
onelogin.saml2.sp.attribute_consuming_service[0].name = Just e-mail
@@ -571,15 +572,17 @@ import static com.onelogin.saml2.authn.AttributeConsumingServiceSelector.*;
571572
Auth auth = new Auth(request, response);
572573
// select by index 1
573574
auth.login(new AuthnRequestParams(false, false, true, byIndex(1));
574-
// or select by ACS name
575+
// or select by service name
575576
auth.login(new AuthnRequestParams(false, false, true, byServiceName(auth.getSettings(), "Anagrafica"));
576577
// or see AttributeConsumingServiceSelector interface implementations for more options
577578
```
578579

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

582-
Then, the following code handles the SAML response that the IdP forwards to the SP through the user's client:
583+
584+
##### Assertion Consumer Service (ACS)
585+
This code handles the SAML response that the IdP forwards to the SP through the user's client:
583586
584587
```java
585588
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
@@ -519,17 +519,17 @@ private List<Contact> loadContacts() {
519519
*/
520520
private List<AttributeConsumingService> loadAttributeConsumingServices() {
521521
// first split properties into a map of properties
522-
// key = ACS index; value = ACS properties
522+
// key = service index; value = service properties
523523
final SortedMap<Integer, Map<String, Object>> acsProps =
524524
extractIndexedProperties(SP_ATTRIBUTE_CONSUMING_SERVICE_PROPERTY_KEY_PREFIX, samlData);
525-
// then build each ACS
525+
// then build each Attribute Consuming Service
526526
if(acsProps.containsKey(-1) && acsProps.size() == 1)
527-
// single ACS specified; use index 1 for backward compatibility
527+
// single service specified; use index 1 for backward compatibility
528528
return Arrays.asList(loadAttributeConsumingService(acsProps.get(-1), 1));
529529
else
530-
// multiple indexed ACSs specified
530+
// multiple indexed services specified
531531
return acsProps.entrySet().stream()
532-
// ignore non-indexed ACS
532+
// ignore non-indexed service
533533
.filter(entry -> entry.getKey() != -1)
534534
.map(entry -> loadAttributeConsumingService(entry.getValue(), entry.getKey()))
535535
.collect(Collectors.toList());
@@ -539,10 +539,10 @@ private List<AttributeConsumingService> loadAttributeConsumingServices() {
539539
* Loads a single Attribute Consuming Service from settings.
540540
*
541541
* @param acsProps
542-
* a map containing the ACS settings
542+
* a map containing the Attribute Consuming Service settings
543543
* @param index
544-
* the index to be set on the returned ACS
545-
* @return the loaded ACS
544+
* the index to be set on the returned Attribute Consuming Service
545+
* @return the loaded Attribute Consuming Service
546546
*/
547547
private AttributeConsumingService loadAttributeConsumingService(Map<String, Object> acsProps, int index) {
548548
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
@@ -660,7 +660,7 @@ public void testToAttributeConsumingServiceXmlWithMultipleAttributeValueLegacySp
660660
* @see com.onelogin.saml2.settings.Metadata#toAttributeConsumingServicesXml
661661
*/
662662
@Test
663-
public void testToAttributeConsumingServiceXmlSingleACS() throws IOException, CertificateEncodingException, Error {
663+
public void testToAttributeConsumingServiceXmlSingleService() throws IOException, CertificateEncodingException, Error {
664664
Saml2Settings settings = getSettingFromAllProperties();
665665

666666
Metadata metadataObj = new Metadata(settings, null, null);
@@ -731,8 +731,8 @@ public void testToAttributeConsumingServiceXmlSingleACSSpecialChars() throws IOE
731731
* @see com.onelogin.saml2.settings.Metadata#toAttributeConsumingServicesXml
732732
*/
733733
@Test
734-
public void testToAttributeConsumingServiceXmlMultiACS() throws IOException, CertificateEncodingException, Error {
735-
Saml2Settings settings = getSettingFromAllPropertiesMultiACS();
734+
public void testToAttributeConsumingServiceXmlMultiServices() throws IOException, CertificateEncodingException, Error {
735+
Saml2Settings settings = getSettingFromAllPropertiesMultiAttributeConsumingServices();
736736

737737
Metadata metadataObj = new Metadata(settings, null, null);
738738
String metadataStr = metadataObj.getMetadataString();
@@ -866,7 +866,7 @@ private Saml2Settings getSettingFromAllSpecialCharsProperties() throws Error, IO
866866
return new SettingsBuilder().fromFile("config/config.all_specialchars.properties").build();
867867
}
868868

869-
private Saml2Settings getSettingFromAllPropertiesMultiACS() throws Error, IOException {
869+
private Saml2Settings getSettingFromAllPropertiesMultiAttributeConsumingServices() throws Error, IOException {
870870
return new SettingsBuilder().fromFile("config/config.all_multi_attribute_consuming_services.properties").build();
871871
}
872872

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)