How can I see a Web API bearer token before it's returned?

MStodd

I have my own OAuthAuthorizationServerProvider, but it looks like there's no place to hook into to see the generated bearer token after it's generated.

Is there a way to grab the to-be-returned token before it's returned? (hack or not)

Here's my setup:

OAuthAuthorizationServerOptions OAuthServerOptions = new OAuthAuthorizationServerOptions()
{
    AllowInsecureHttp = true,
    TokenEndpointPath = new PathString("/token"),
    AccessTokenExpireTimeSpan = TimeSpan.FromDays(1),
    Provider = new SimpleAuthorizationServerProvider()
};

// Token Generation
app.UseOAuthAuthorizationServer(OAuthServerOptions);
app.UseOAuthBearerAuthentication(new OAuthBearerAuthenticationOptions());
MStodd

After decompiling, grabbing OAuth source from http://katanaproject.codeplex.com/, and upgrading my NuGet packages to the latest Owin implementation, I can now override a new method in my SimpleAuthorizationServerProvider.

public override Task TokenEndpointResponse(OAuthTokenEndpointResponseContext context)
    {
        string token = context.AccessToken;
        return base.TokenEndpointResponse(context);
    }

The above will give the ResponseContext to be returned, which contains everything I need: enctypted token, user identity, claims...

This is a new method in the IOAuthAuthorizationServerProvider interface as of NuGet package 3 (I believe)

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

Using Microsoft Graph token to secure ASP.NET Core Web API with Jwt Bearer tokens

분류에서Dev

Can I see what's going on in a tmux session without attaching to it?

분류에서Dev

How can I see the I/O activity of certain programs?

분류에서Dev

JQuery Ajax를 통해 Authorization Token Bearer 보내기-백엔드는 .NET Core Web Api입니다.

분류에서Dev

How can I see when a package was released/updated using `apt`?

분류에서Dev

How can I see which user is working on what task in Fogbugz?

분류에서Dev

How can I avoid cheat engine to see my strings at runtime

분류에서Dev

How can I see the Microsoft Edge start page in another browser?

분류에서Dev

Where can I see the name of the remote add repository and how to delete it?

분류에서Dev

How can I see when my PC was rebooted?

분류에서Dev

How can I see the number of visitors in my website via CLI

분류에서Dev

In R, how can I see the signatures for which a generic method is implemented?

분류에서Dev

How can I query keywords within a user's timeline using Twitter's API v1.1?

분류에서Dev

How can I suppress chrome-extension:// output from Web Inspector's console log?

분류에서Dev

Copy-item failing without error, I'm sure it's something simple but I can't see it

분류에서Dev

How can I filter content of a web page?

분류에서Dev

How can I intercept the result of openDocument before NSDocument loads?

분류에서Dev

How can i get rid of putting "new" before a function

분류에서Dev

How can I extract text before a character or string in a batch file?

분류에서Dev

I'm Working with a button command, but can't see what's wrong with this code using elseif statements

분류에서Dev

How can I create a web application using Angular frontend and Node backend and Git hub API starting from OAuth?

분류에서Dev

Can I filter a returned JSON by <b> tag?

분류에서Dev

How can I throttle stack of api requests?

분류에서Dev

Cancelling window closing with a task. How can I detect if task returned synchronously?

분류에서Dev

How can I make this SQL query work to prevent the "subquery returned more than one row" error?

분류에서Dev

Why can't I see gnome extensions?

분류에서Dev

I can not see the table dba_object

분류에서Dev

Can I see the number of PCI slots with a command?

분류에서Dev

Why can not I see the screen output consecutively?

Related 관련 기사

  1. 1

    Using Microsoft Graph token to secure ASP.NET Core Web API with Jwt Bearer tokens

  2. 2

    Can I see what's going on in a tmux session without attaching to it?

  3. 3

    How can I see the I/O activity of certain programs?

  4. 4

    JQuery Ajax를 통해 Authorization Token Bearer 보내기-백엔드는 .NET Core Web Api입니다.

  5. 5

    How can I see when a package was released/updated using `apt`?

  6. 6

    How can I see which user is working on what task in Fogbugz?

  7. 7

    How can I avoid cheat engine to see my strings at runtime

  8. 8

    How can I see the Microsoft Edge start page in another browser?

  9. 9

    Where can I see the name of the remote add repository and how to delete it?

  10. 10

    How can I see when my PC was rebooted?

  11. 11

    How can I see the number of visitors in my website via CLI

  12. 12

    In R, how can I see the signatures for which a generic method is implemented?

  13. 13

    How can I query keywords within a user's timeline using Twitter's API v1.1?

  14. 14

    How can I suppress chrome-extension:// output from Web Inspector's console log?

  15. 15

    Copy-item failing without error, I'm sure it's something simple but I can't see it

  16. 16

    How can I filter content of a web page?

  17. 17

    How can I intercept the result of openDocument before NSDocument loads?

  18. 18

    How can i get rid of putting "new" before a function

  19. 19

    How can I extract text before a character or string in a batch file?

  20. 20

    I'm Working with a button command, but can't see what's wrong with this code using elseif statements

  21. 21

    How can I create a web application using Angular frontend and Node backend and Git hub API starting from OAuth?

  22. 22

    Can I filter a returned JSON by <b> tag?

  23. 23

    How can I throttle stack of api requests?

  24. 24

    Cancelling window closing with a task. How can I detect if task returned synchronously?

  25. 25

    How can I make this SQL query work to prevent the "subquery returned more than one row" error?

  26. 26

    Why can't I see gnome extensions?

  27. 27

    I can not see the table dba_object

  28. 28

    Can I see the number of PCI slots with a command?

  29. 29

    Why can not I see the screen output consecutively?

뜨겁다태그

보관