Quantcast
Channel: Security
Viewing all articles
Browse latest Browse all 4737

Custom OAUTH provider to issue tokens - how to make a mvc web application auth againest the provider

$
0
0

I have written a custom oauth provider which allows me to issue JWT.

It doesn't matter if am using oauth/ the membership2.0 system , as long as the provider issues a valid signed JWT token
I should be able to use

 public void ConfigureOAuth(IAppBuilder app)
    {
        var issuer = "http://localhost:60118/oauth/token";
        var audience = "414e1927a3884f68abc79f7283837fd1";
        var secret = TextEncodings.Base64Url.Decode("qMCdFDQuF23RV1Y-1Gq9L3cF3VmuFwVbam4fMTdAfpo");

        // Api controllers with an [Authorize] attribute will be validated with JWT
        app.UseJwtBearerAuthentication(
            new JwtBearerAuthenticationOptions
            {
                AuthenticationMode = AuthenticationMode.Active,
                AllowedAudiences = new[] { audience },
                IssuerSecurityTokenProviders = new IIssuerSecurityTokenProvider[]
                {
                    new SymmetricKeyIssuerSecurityTokenProvider(issuer, secret)
                },
                Provider = new OAuthBearerAuthenticationProvider() { }
            });

    }

to authenticate right?

It doesn't seem to work as it doesn't hit any of the break points set in the login provider.

I know the provider works properly since am able to get a token when I call the api via console client test app I wrote.


Viewing all articles
Browse latest Browse all 4737

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>