GithubHelp home page GithubHelp logo

openiddict-test's People

Contributors

capesean avatar ddaviesbrackett avatar fopsdev avatar kevinchalet avatar robertkruis avatar robertzas avatar toralux 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

openiddict-test's Issues

Database doesn't get created

Looks like you're missing 'await' in your Startup.cs

Should be:
public async void Configure(IApplicationBuilder app, IDatabaseInitializer databaseInitializer)
and
await databaseInitializer.Seed();

Empty Roles

For some reason User.Roles is empty when it reaches the controller and throws a 403 for role based authorization.

 public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IDatabaseInitializer databaseInitializer, UserManager<ApplicationUser> userManager)
{
...
app.UseOpenIddictCore(...);
app.UseJwtBearerAuthentication(new JwtBearerOptions() {...});
app.Use(async (context, next) =>
      {
        var user = await userManager.GetUserAsync(context.User);
//-------> user.Roles.Count = 1
        await next.Invoke();
      });
app.UseMvc(...);
...
}

But, in the controller:

[Authorize]
  public class MeController : Controller
  {
    private CoreModelsDbContext _context;
    private readonly UserManager<ApplicationUser> _userManager;

    public MeController(CoreModelsDbContext context, UserManager<ApplicationUser> userManager)
    {
      _context = context;
      _userManager = userManager;
    }

    [Route("api/v1/me"), HttpGet]
    public async Task<IActionResult> Get()
    {
      var user = await _userManager.GetUserAsync(User);
//-------> user.Roles.Count = 0
      return user == null ? Ok("No user / not logged in") : Ok(user);
    }
  }

Any idea how this would happen?

Cannot create a DbSet for 'IdentityRole' because this type is not included in the model for the context.

After applying migrations, starting up the server and pressing the "Get Token" button,
the server responds with a HTTP 500.
According to the logs, instead of using the ApplicationRole the IdentityRole is being used.

I have not been able to find a solution yet. The full log is as follows:

System.InvalidOperationException:Cannot create a DbSet for 'IdentityRole' because this type is not included in the model for the context.
at Microsoft.EntityFrameworkCore.DbContext.SetTEntity
at Microsoft.AspNetCore.Identity.EntityFrameworkCore.UserStore4.get_Roles() at Microsoft.AspNetCore.Identity.EntityFrameworkCore.UserStore4.d__34.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at Microsoft.AspNetCore.Identity.UserManager1.d__105.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at OpenIddict.OpenIddictUserManager1.d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at OpenIddict.Infrastructure.OpenIddictProvider5.d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at AspNet.Security.OpenIdConnect.Server.OpenIdConnectServerHandler.d__17.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at AspNet.Security.OpenIdConnect.Server.OpenIdConnectServerHandler.<HandleRequestAsync>d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult()
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware1.<Invoke>d__18.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware1.d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.d__7.MoveNext()

API Response 401

I fetched token which is also saved in local storage, but can't authorize for API call. Suppose I have to manually realize auth logic writing something to Startup.cs?

Openiddict beta: OpenIddictUser no more present

Hi, I'm trying to create a WebAPI project based on this example, by creating a new ASP.NET Core Web API app and following the code. Anyway, it seems that the OpenIddictUser class is no more present in the current version of Openiddict which gets restored: the version is beta1 0467 at the time of writing.

Sample not working

Hi,

I have downloaded the sample source code from the GitHub. Also, I have checked that I have latest dnx version in my machine. See attached screenshot.

image

But still when I try to run this solution its giving following errors.

image

I think its not supporting dnx 4.5.1 or any other problem I have can you please suggest what I am doing wrong.

Validate openiddict token on node.js server

Hi! Started to explore your library and have, probably, dumb architectural question.

We're using .net core server for authorization and REST API and node.js server for web socket communication (via socket.io).

Currently, PasswordFlow is used and auth part of the code is mostly same as in your sample

We're able to validate token in REST API endpoints on .Net core instance but we also want to use the same token for web sockets.

Is there a way to validate it on node.js server without making a request to .Net core instance?

Angular client

In your corresponding article you wrote that you are planning to use your setup with Angular. Do have any recommandations for a client library that handles the oidc stuff (login, logout, refresh token in particular) or are you planning to implement that yourself?

error: At least one OAuth2/OpenID Connect flow must be enabled.

got this error with newest bits (visual studio update 3 including a kb patch from today) on a fresh git clone:

System.InvalidOperationException was unhandled by user code
  HResult=-2146233079
  Message=At least one OAuth2/OpenID Connect flow must be enabled.
  Source=OpenIddict.Core
  StackTrace:
       at Microsoft.AspNetCore.Builder.OpenIddictExtensions.UseOpenIddict(IApplicationBuilder app)
       at openiddicttest.Startup.Configure(IApplicationBuilder app, IDatabaseInitializer databaseInitializer)


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.