Skip to content

Trying to update but missing TokenCacheProviders\Sql\MsalSqlTokenCacheProvider.cs #220

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 of 14 tasks
thethird1978 opened this issue Dec 4, 2019 · 6 comments
Closed
1 of 14 tasks
Labels
Answered question Further information is requested

Comments

@thethird1978
Copy link

Please provide us with the following information:

This issue is for a: (mark with an x)

- [X] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

The issue was found for the following scenario:

Please add an 'x' for the scenario(s) where you found an issue

  1. Web app that signs in users
    1. with a work and school account in your organization: 1-WebApp-OIDC/1-1-MyOrg
    2. with any work and school account: /1-WebApp-OIDC/1-2-AnyOrg
    3. with any work or school account or Microsoft personal account: 1-WebApp-OIDC/1-3-AnyOrgOrPersonal
    4. with users in National or sovereign clouds 1-WebApp-OIDC/1-4-Sovereign
    5. with B2C users 1-WebApp-OIDC/1-5-B2C
  2. Web app that calls Microsoft Graph
    1. Calling graph with the Microsoft Graph SDK: 2-WebApp-graph-user/2-1-Call-MSGraph
    2. With specific token caches: 2-WebApp-graph-user/2-2-TokenCache
    3. Calling Microsoft Graph in national clouds: 2-WebApp-graph-user/2-4-Sovereign-Call-MSGraph
  3. Web app calling several APIs 3-WebApp-multi-APIs
  4. Web app calling your own Web API 4-WebApp-your-API
  5. Web app restricting users
    1. by Roles: 5-WebApp-AuthZ/5-1-Roles
    2. by Groups: 5-WebApp-AuthZ/5-2-Groups
  6. Deployment to Azure
  7. Other (please describe)

Repro-ing the issue

Repro steps

Expected behavior
To be able to use SQL Token Cache:
services.AddDistributedSqlServerCache(options =>
{
options.ConnectionString = Configuration.GetConnectionString("TokenCacheDbConnStr");
options.SchemaName = "dbo";
options.TableName = "TokenCache";
});

Actual behavior

Possible Solution

Additional context/ Error codes / Screenshots

Any log messages given by the failure

Add any other context about the problem here, such as logs.

OS and Version?

Windows 7, 8 or 10. Linux (which distribution). macOS (Yosemite? El Capitan? Sierra?)

Versions

of ASP.NET Core, of MSAL.NET

Attempting to troubleshooting yourself:

Mention any other details that might be useful


Thanks! We'll be in touch soon.

@TiagoBrenck
Copy link
Contributor

@thethird1978 could you please elaborate? Consider including error message, or more details on what is not working.

@Mrcl1450
Copy link

Mrcl1450 commented Dec 5, 2019

SQL TokenCacheProvider folder was deleted in #214

@jmprieur
Copy link
Contributor

jmprieur commented Dec 5, 2019

@thethird1978 @Mrcl1450, we removed the SQL token cache direct implementation as it's possible and recommended to use a distributed cache with a SQL implementation (out of the box in ASP.NET Core)

// or use a distributed Token Cache by adding 
    services.AddMicrosoftIdentityPlatformAuthentication(Configuration)
            .AddMsal(new string[] { scopesToRequest })
            .AddDistributedTokenCaches();

// and then choose your implementation
// SQL Server token cache
services.AddDistributedSqlServerCache(options =>
{
 options.ConnectionString = _config["DistCache_ConnectionString"];
 options.SchemaName = "dbo";
 options.TableName = "TestCache";
});

@jmprieur jmprieur added Answered question Further information is requested labels Dec 5, 2019
@Mrcl1450
Copy link

Mrcl1450 commented Dec 5, 2019

Yeh Microsoft.Extensions.Caching.SqlServer was missing
image

@jmprieur
Copy link
Contributor

jmprieur commented Dec 5, 2019

@Mrcl1450 What do you mean it's missing?

If you, as an app developer, decide to add a SQL Server cache you have (in your app), to add the corresponding NuGet package:

https://www.nuget.org/packages/Microsoft.Extensions.Caching.SqlServer/

What Microsoft identity web does is provide an adapter to decouple the serialization itself

@TiagoBrenck
Copy link
Contributor

If you meant sample 2-1-Call-MSGraph then yes, the sample doesn't come with Microsoft.Extensions.Caching.SqlServer nuget package installed because that sample`s mainly topic is not about SQL cache. However, sample 2-2-TokenCache has the package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Answered question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants