Git Product home page Git Product logo

identityserver4.samples.mongo's People

Contributors

boase avatar dudleycodes avatar mich4xd avatar r-cbc avatar rilton avatar souzartn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

identityserver4.samples.mongo's Issues

can not pass new Resources(identityResources, apiResources, scopes);

hi. i did switch branch to dev and when I call .well-known/openid-configuration i can not pass var result = new Resources(GetAllIdentityResources(), GetAllApiResources(), GetAllApiScopes()); in

public Task GetAllResourcesAsync()
{
var result = new Resources(GetAllIdentityResources(), GetAllApiResources(), GetAllApiScopes());
return Task.FromResult(result);
}

and I got an Exception

Element '_id' does not match any field or property of class IdentityServer4.Models.ApiScope.

I think the problem comes from IEnumerable

Call Api failes

When i'm logged in and i click "call api with user token" ->
I get unauthorized back.

IDX10501: Signature validation failed. Unable to match 'kid': '84509862e868dad806485e7e3c230244',

In the client i can see:

Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerMiddleware:Information: Failed to validate the token eyJhbGciOiJSUzI1NiIsImtpZCI6Ijg0NTA5ODYyZTg2OGRhZDgwNjQ4NWU3ZTNjMjMwMjQ0IiwidHlwIjoiSldUIn0.eyJuYmYiOjE0OTQ1ODk1OTUsImV4cCI6MTQ5NDU5MzE5NSwiaXNzIjoiaHR0cDovL2xvY2FsaG9zdDo1MDAwIiwiYXVkIjpbImh0dHA6Ly9sb2NhbGhvc3Q6NTAwMC9yZXNvdXJjZXMiLCJhcGkxIl0sImNsaWVudF9pZCI6Im12YyIsInN1YiI6IjIiLCJhdXRoX3RpbWUiOjE0OTQ1ODk1OTIsImlkcCI6ImxvY2FsIiwic2NvcGUiOlsib3BlbmlkIiwicHJvZmlsZSIsImFwaTEiLCJvZmZsaW5lX2FjY2VzcyJdLCJhbXIiOlsicHdkIl19.UcBFhFGRpsLKGuR9Lr3IDpTo9IgpD72pprj-Fiw9cVXVzCH6SMri43G1RecUt8tfgqqXJRlDsB-qAodMFbUeLJdJyIvjF4bEMy-IpeYELywn1-3yX5XyzNw0YQF_5eX6NoPnl1nPjJ15dx1wrc4S5oHdRekg3hw97ElPVZc3GwTzwbtduPxZZz9SXcoTeXMXu8i-ht8yqQEmOcfX3Py2SCM7-1ULL_m7e51Jn8h-SfuinHPjoIz738evNg_14TILBiTxF93B3RpBuv1EocVaIcWV84_mGKCQxAPpHhZfVdVU_z3lywHOrBSEDpeFcWqDL0ksWF5CY2tCm4wyqbatng.

Microsoft.IdentityModel.Tokens.SecurityTokenSignatureKeyNotFoundException: IDX10501: Signature validation failed. Unable to match 'kid': '84509862e868dad806485e7e3c230244',
token: '{"alg":"RS256","typ":"JWT","kid":"84509862e868dad806485e7e3c230244"}.{"nbf":1494589595,"exp":1494593195,"iss":"http://localhost:5000","aud":["http://localhost:5000/resources","api1"],"client_id":"mvc","sub":"2","auth_time":1494589592,"idp":"local","scope":["openid","profile","api1","offline_access"],"amr":["pwd"]}'.
at System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateSignature(String token, TokenValidationParameters validationParameters)
at System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateToken(String token, TokenValidationParameters validationParameters, SecurityToken& validatedToken)
at Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler.d__1.MoveNext()

Q: Tread safety with static instance of Database class

Hi, I just wonder how do you know that it is safe to perform _database.GetCollection call from multiple threads on a static(btw it is got reinitialised each time new instance created, this seems to me incorrect) database object

    public IQueryable<T> All<T>() where T : class, new()
    {
        return _database.GetCollection<T>(typeof(T).Name).AsQueryable();
    }

The documentation doesn't say anything about it
http://api.mongodb.com/csharp/current/html/M_MongoDB_Driver_IMongoDatabase_GetCollection__1.htm
http://api.mongodb.com/csharp/current/html/T_MongoDB_Driver_IMongoDatabase.htm

Issue with registration of CustomPersistedGrantStore

I was getting the following error :
" You are using the in-memory version of the persisted grant store. This will store consent decisions, authorization codes, refresh and reference tokens in memory only. If you are using any of those features in production, you want to switch to a different store implementation."

It seems that when running .AddPersistedGrants() in the configureServices, it does not register the new service due to the fact that TryAddSingleton is used - and IPersistedGrantStore is already implemented by the default implementation:
Lifetime = Singleton, ServiceType = {IdentityServer4.Stores.IPersistedGrantStore}, ImplementationType = {IdentityServer4.Stores.InMemoryPersistedGrantStore} - Value of it when inspecting it in the services collection.

I was able to resolve the issue by correcting the following:

-- File :IdentityServerBuilderExtensions .cs --method : AddPersistedGrants
Changing builder.Services.TryAddSingleton<IPersistedGrantStore, CustomPersistedGrantStore>();
to builder.Services.AddSingleton<IPersistedGrantStore, CustomPersistedGrantStore>();

IdentityServer4.Samples.Mongo Identity Server not working for DotNetCore >=2.1

Hi,
I am just trying to build new project with the reference of this project, did all things as it is, but i am getting the error at ** position in the IdentityServerBuilderExtensions.cs file.

Errors are :

  1. Error CS7069: Reference to type 'IUserTwoFactorStore<>' claims it is defined in 'Microsoft.AspNetCore.Identity', but it could not be found

  2. Error CS0266: Cannot implicitly convert type 'Microsoft.AspNetCore.Identity.MongoDB.UserStore' to 'Microsoft.AspNetCore.Identity.IUserStore'. An explicit conversion exists (are you missing a cast?)

  3. Error CS1662: Cannot convert lambda expression to intended delegate type because some of the return types in the block are not implicitly convertible to the delegate return type

  4. Error CS7069: Reference to type 'IRoleStore<>' claims it is defined in 'Microsoft.AspNetCore.Identity', but it could not be found

       builder.Services.AddSingleton<IUserStore<TIdentity>>(x =>
         {
             var usersCollection = database.GetCollection<TIdentity>("Identity_Users");
             IndexChecks.EnsureUniqueIndexOnNormalizedEmail(usersCollection);
             IndexChecks.EnsureUniqueIndexOnNormalizedUserName(usersCollection);
             **return new UserStore<TIdentity>(usersCollection);**
         });
    
         builder.Services.AddSingleton<IRoleStore<TRole>>(x =>
         {
             var rolesCollection = database.GetCollection<TRole>("Identity_Roles");
             IndexChecks.EnsureUniqueIndexOnNormalizedRoleName(rolesCollection);
             **return new RoleStore<TRole>(rolesCollection);**
         });
    

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.