davidjrh / dnn.azureadprovider

The DNN Azure Active Directory Provider is an Authentication provider for DNN Platform (formerly DotNetNuke) that uses Azure Active Directory OAuth2 authentication to authenticate users.
MIT License
35 stars 21 forks source link

Problem with JWT #38

Closed trouble2 closed 2 years ago

trouble2 commented 3 years ago

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'.

davidjrh commented 3 years ago

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>
davidjrh commented 2 years ago

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