.net-6.0shibboleth

Request.ServerVariables() for Shibboleth in .NET 6


I am trying to use Shibboleth on a site that uses .NET 6. The Shibboleth documentation uses Request.ServerVariables() but when I add that, I get the error "HttpRequest does not contain a definition for 'ServerVariables'".

I instantiated an IServerVariablesFeature object and I can get the SERVER_NAME variable from there, but I can't find any Shibboleth variables like Shib-Application-ID. Is my IServerVariablesFeature the right place to look for the Shibboleth variables or do I need to get Request.ServerVariables() to work?

By visiting https://domain/Shibboleth.sso/Session I can see the session information, so I know that the authentication is working correctly, I'm just trying to access the user information from an application.

Thanks in advance for any help.


Solution

  • IServerVariablesFeature serverVariables = HttpContext.Features.Get<IServerVariablesFeature>(); works, as does HttpContext.GetServerVariable("VARIABLE_NAME");. What I was missing is that these variables are only available to pages that are protected by Shibboleth. I added the path for my page to the shibboleth2.xml file and I could see the variables.