How to add AttributeConsumingServiceIndex in HighLevelAPI?

Hello,

I try to use HighLevelAPI sample code to connect our IDP Application.

It’s work, but I need more information for our IDP.

So it’s mean I need define the AttributeConsumingServiceIndex when I call “SAMLServiceProvider.InitiateSSO”.

I guess the only way is set the SSOOptions.

If I only setting AttributeConsumingServiceIndex, I will recvive the error from our IDP, the message is “SAMLRequest not found.”

What attribute I need to set in the SSOOptions?

Do you mean the AttributeConsumingServiceIndex or AssertionConsumerServiceIndex?
The latter may be set in the SSOOptions as part of SAML SSO.
AttributeConsumingServiceIndex isn’t commonly used.
I’m not sure what the “SAMLRequest not found” message means.
It could be that the IdP is expecting the authn request to be sent in an HTTP Post rather than an HTTP Redirect or some other transport level error is occurring.
I suggest asking the IdP for more details regarding the error they’re seeing.

[quote]
ComponentSpace - 3/11/2019
Do you mean the AttributeConsumingServiceIndex or AssertionConsumerServiceIndex?
The latter may be set in the SSOOptions as part of SAML SSO.
AttributeConsumingServiceIndex isn't commonly used.
I'm not sure what the "SAMLRequest not found" message means.
It could be that the IdP is expecting the authn request to be sent in an HTTP Post rather than an HTTP Redirect or some other transport level error is occurring.
I suggest asking the IdP for more details regarding the error they're seeing.
[/quote]

Sorry, it's "AttributeConsumingServiceIndex"
In LowLevelAPI sample
If I set the AttributeConsumingServiceIndex, I could recvive more information from our IPD

like:
authnRequest.AttributeConsumingServiceIndex = 1;

I should not set SSOOptions, it is a wrong way.

So, where I could set the "AttributeConsumingServiceIndex" when I call "InitiateSSO" function?

Thanks for your reply.

It’s not supported in the high-level API.
We haven’t come across a use case that requires the AttributeConsumingServiceIndex.
Are you sure you have to set this value?
If you set this value using the low-level API, are you saying the IdP returns more SAML attributes in the SAML assertion?
If so, that does seem unusual.

[quote]
ComponentSpace - 3/12/2019
It's not supported in the high-level API.
We haven't come across a use case that requires the AttributeConsumingServiceIndex.
Are you sure you have to set this value?
If you set this value using the low-level API, are you saying the IdP returns more SAML attributes in the SAML assertion?
If so, that does seem unusual.
[/quote]

When I provide the metadata to our IDP.
I will define the AttributeConsumingServiceIndex, and our IDP will return more information to our SP by different AttributeConsumingServiceIndex.

The SMALResponse like:
......


http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns7:string">78e7b4045a2f70c6512281c1edf6778740686d3e


......

I need the token value to valid something in my SP.

PS. Our IDP is a customize application from our headquarters office.

Thanks for your reply.


Below is some example code demonstrating using the ISAMLObserver interface to update the SAML authn request.


using ComponentSpace.SAML2.Notifications;
using ComponentSpace.SAML2.Protocols;

public class SAMLObserver : AbstractSAMLObserver
{
public override AuthnRequest OnAuthnRequestCreated(AuthnRequest authnRequest)
{
authnRequest.AttributeConsumingServiceIndex = 1;

return authnRequest;
}
}



You need to subscribe to events, for example, at application start-up in Global.asax.


protected void Application_Start()
{
SAMLObservable.Subscribe(new SAMLObserver());
}