Search code examples
wifasp.net-identitydecompilingildasmilspy

Why can't I decompile System.IdentityModel.Services.dll?


I am trying to decompile System.IdentityModel.Services.dll but none of the decompiling tools show the method details

I cannot even get the IL for these methods in ILDASM. Same story for ILSpy.

for example: System.IdentityModel.Services.SessionAuthenticationModule

ILDASM:

.method family hidebysig newslot virtual 
        instance void  OnAuthenticateRequest(object sender,
                                             class [mscorlib]System.EventArgs eventArgs) cil managed
{
  // Code size       0 (0x0)
} // end of method SessionAuthenticationModule::OnAuthenticateRequest


.method family hidebysig instance class [mscorlib]System.Collections.ObjectModel.ReadOnlyCollection`1<class [mscorlib]System.Security.Claims.ClaimsIdentity> 
        ValidateSessionToken(class [System.IdentityModel]System.IdentityModel.Tokens.SessionSecurityToken sessionSecurityToken) cil managed
{
  // Code size       0 (0x0)
} // end of method SessionAuthenticationModule::ValidateSessionToken

I had thought at least the IL was always available. Is this not the case?


Solution

  • r# is capable of finding the microsoft reference sources and Reflector is capable of generating :

        protected ReadOnlyCollection<ClaimsIdentity> ValidateSessionToken(SessionSecurityToken sessionSecurityToken)
    {
        ReadOnlyCollection<ClaimsIdentity> onlys;
        SessionSecurityTokenHandler handler = base.FederationConfiguration.IdentityConfiguration.SecurityTokenHandlers[typeof(SessionSecurityToken)] as SessionSecurityTokenHandler;
        if (handler == null)
        {
            throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString("ID4011", new object[] { typeof(SessionSecurityToken) })));
        }
        try
        {
            onlys = new ReadOnlyCollection<ClaimsIdentity>(handler.ValidateToken(sessionSecurityToken, this.CookieHandler.Path));
        }
        catch (SecurityTokenExpiredException exception)
        {
            throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new FederatedSessionExpiredException(DateTime.UtcNow, sessionSecurityToken.ValidTo, exception));
        }
        catch (SecurityTokenNotYetValidException exception2)
        {
            throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new FederationException(SR.GetString("ID1071", new object[] { DateTime.UtcNow, sessionSecurityToken.ValidFrom }), exception2));
        }
        return onlys;
    }
    

    ILSpy is generating very similar code. So I guess you are looking at the wrong assembly or missing something else.