Git Product home page Git Product logo

Comments (5)

leastprivilege avatar leastprivilege commented on May 28, 2024

you need to debug I guess. Maybe because the Katana logger factory is not set up.

— 
cheers
Dominick Baier

On 23 Sep 2015 at 00:24:08, jraadt ([email protected]) wrote:

I have everything working with AccessTokenValidation 1.2.2, but when I upgrade the library to 2.2.0 I get the following NullReferenceException. I don't have this running on the same server as the IdentityServer.

at IdentityServer3.AccessTokenValidation.ValidationEndpointTokenProvider..ctor(IdentityServerBearerTokenAuthenticationOptions options, ILoggerFactory loggerFactory) in c:\etc\Dropbox\identity\IdentityServer3\AccessTokenValidation\source\AccessTokenValidation\Plumbing\ValidationEndpointTokenProvider.cs:line 39
at Owin.IdentityServerBearerTokenValidationAppBuilderExtensions.ConfigureEndpointValidation(IdentityServerBearerTokenAuthenticationOptions options, ILoggerFactory loggerFactory) in c:\etc\Dropbox\identity\IdentityServer3\AccessTokenValidation\source\AccessTokenValidation\IdentityServerBearerTokenValidationAppBuilderExtensions.cs:line 92
at Owin.IdentityServerBearerTokenValidationAppBuilderExtensions.UseIdentityServerBearerTokenAuthentication(IAppBuilder app, IdentityServerBearerTokenAuthenticationOptions options) in c:\etc\Dropbox\identity\IdentityServer3\AccessTokenValidation\source\AccessTokenValidation\IdentityServerBearerTokenValidationAppBuilderExtensions.cs:line 55
at MyProject.Startup.<>c__DisplayClass1_0.<Configure>b__2(IAppBuilder builder) in C:\MyApp\src\MyProject\Startup.cs:line 55
at MyProject.IApplicationBuilderExtensions.<>c__DisplayClass0_0.<UseAppBuilder>b__1(Func`2 next) in C:\MyApp\src\MyProject\IApplicationBuilderExtensions.cs:line 21
at Microsoft.AspNet.Builder.OwinExtensions.<>c__DisplayClass0_1.<UseOwin>b__1(RequestDelegate next1)
at Microsoft.AspNet.Builder.Internal.ApplicationBuilder.Build()
at Microsoft.AspNet.Hosting.Internal.HostingEngine.BuildApplication()
at Microsoft.AspNet.Hosting.Internal.HostingEngine.Start()
at Microsoft.AspNet.Loader.IIS.RuntimeHttpApplication.ApplicationStart(IHttpApplication application)
at Microsoft.AspNet.Loader.IIS.HttpApplicationBase.InvokeApplicationStart(IHttpApplication application)

It's erroring on the builder.UseIdentityServerBearerTokenAuthentication(options); part of my Startup.cs file:

public void Configure(IApplicationBuilder app, ILoggerFactory loggerfactory)
{
    ...
    var options = new IdentityServerBearerTokenAuthenticationOptions
    {
        Authority = "http://my-identity-server/oauth",
        RequiredScopes = new string[] { "my_api" }
    };
    app.UseAppBuilder(builder => { builder.UseIdentityServerBearerTokenAuthentication(options); }, "WebApi");

    app.UseMvc();
}

And here is the IApplicationBuilderExtensions class:

public static class IApplicationBuilderExtensions
{
public static IApplicationBuilder UseAppBuilder(this IApplicationBuilder app, Action configure, string owinHostAppName)
{
app.UseOwin(addToPipeline =>
{
addToPipeline(next =>
{
var builder = new Microsoft.Owin.Builder.AppBuilder();
builder.Properties["builder.DefaultApp"] = next;
builder.Properties["host.AppName"] = owinHostAppName;
configure(builder);

            var appFunc = builder.Build(typeof(Func<IDictionary<string, object>, Task>)) as Func<IDictionary<string, object>, Task>;
            return appFunc;
        });
    });
    return app;
}

}


Reply to this email directly or view it on GitHub.

from identityserver3.accesstokenvalidation.

jraadt avatar jraadt commented on May 28, 2024

Thanks for the quick response. I ended trying the ASP.NET 5 OAuth 2.0 middleware that supports JWTs out of the box (app.UseOAuthBearerAuthentication) and it seemed to work fine.

from identityserver3.accesstokenvalidation.

leastprivilege avatar leastprivilege commented on May 28, 2024

But it does not do scope verification. See my asp5 sample.

from identityserver3.accesstokenvalidation.

jraadt avatar jraadt commented on May 28, 2024

It was your asp5 sample that lead me down the path to the "out of the box" solution so I also included your RequiredScopesMiddleware. The big difference I'm having between these solutions is the AccessTokenValidation returned nice 401s when validation failed, such as token expiration. The "out of the box" throws an SecurityTokenExpiredException which returns a 500. I tried to catch that exception, but it seems that same class with the same classpath also exists in your IdentityModel package, which I also need in this project. So I couldn't figure out a way to use SecurityTokenExpiredException since it exists in both Microsoft and your libraries with the same classpath.

from identityserver3.accesstokenvalidation.

leastprivilege avatar leastprivilege commented on May 28, 2024

Open an issue at github/aspnet in the security repo. Sounds like a bug to me

Sent from my iPad

On 24 Sep 2015, at 20:59, jraadt [email protected] wrote:

It was your asp5 sample that lead me down the path to the "out of the box" solution so I also included your RequiredScopesMiddleware. The big difference I'm having between these solutions is the AccessTokenValidation returned nice 401s when validation failed, such as token expiration. The "out of the box" throws an SecurityTokenExpiredException which returns a 500. I tried to catch that exception, but it seems that same class with the same classpath also exists in your IdentityModel package, which I also need in this project. So I couldn't figure out a way to use SecurityTokenExpiredException since it exists in both Microsoft and your libraries with the same classpath.


Reply to this email directly or view it on GitHub.

from identityserver3.accesstokenvalidation.

Related Issues (20)

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.