简体   繁体   中英

Reusing oauth token from .net 4.5.2 web api in .net core

I have a legacy web api that uses something like the below in a .net 4.5.2 web api:

OAuthBearerOptions = new OAuthBearerAuthenticationOptions();
app.UseOAuthBearerAuthentication(OAuthBearerOptions);

We are rebuilding the api in .net core 2.2 right now and I would like to reuse the same oauth token. The response from the old auth endpoint looks like:

{
    "access_token":"",
    "refresh_token":""
    "token_type":"bearer",
    "expires_in":12345,
    "as:client_id":"client",
    "userName":"email",
    "userId":"12345",
    "role":"role_id",
    "permissions":[],
    ".issued":"",
    ".expires":""
}

In all my searching it looks like .net core is focused on JWTs opposed to the legacy style oauth tokens. Is it possible to configure .net core web apis to reuse the same shape of data that was in 4.5.2 web apis?

And is often the case when posting a question after hours of searching, I found the answer I was looking for. It appears you cannot do it, at least easily using built in tools: OAuth Authorization Service in ASP.NET Core

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM