davidjrh/dnn.azureadprovider

Problem with JWT

Closed this issue · 2 comments

Just tried to activate the provider on a DNN 9.6.0 installation and it said:

Could not load type 'System.IdentityModel.Tokens.Jwt.JwtSecurityToken' from assembly 'System.IdentityModel.Tokens.Jwt, Version=4.0.20622.1351, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

Ok, this has to do with not specifying the assembly version on the package manifest, there is a pending task to specify the required versions on the manifest, but needs to be tested to avoid issues with other 3rd party modules.

So probably you have another version on that assembly on the \bin folder.

As workaround:

  1. Right click on the "\bin\System.IdentityModel.Tokens.Jwt.dll" file and check the version of the file
  2. Add a binding redirect on the web.config to fix the issue. For example:
<configuration>
  <system.webServer>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <probing privatePath="bin;bin\HttpModules;bin\Providers;bin\Modules;bin\Support;" />
      ...
      <dependentAssembly xmlns="urn:schemas-microsoft-com:asm.v1">
        <assemblyIdentity name="System.IdentityModel.Tokens.Jwt" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-32767.32767.32767.32767" newVersion="5.6.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </system.webServer>
</configuration>

Installed on a v9.10.2 with no issues at all. Closing at this point as the workaround is documented.