Trade external access token for local one - ASP.Net Identity -


when using asp.net identity , retrieving external access token external provider, how trade-in/issue local access token using external access token?

i've seen [hostauthentication(defaultauthenticationtypes.externalbearer)] have not been able working on action method. if send headers

 authentication: bearer external_access_token    

it not populate user.identity

startup.auth.cs:

app.useoauthauthorizationserver(new oauthauthorizationserveroptions     {         tokenendpointpath = new pathstring("/token"),         provider = new applicationoauthprovider(),         authorizeendpointpath = new pathstring("/accountapi/externallogin"),         accesstokenexpiretimespan = timespan.fromdays(14),         allowinsecurehttp = true     }); app.useoauthbearerauthentication(new oauthbearerauthenticationoptions()); 

the workflow of owin middleware external authentication involves

  • redirecting / querying external oauth provider
  • registering new user asp.net identity using external cookie , claims information
  • returning bearer token presentation layer.

the [hostauthentication(defaultauthenticationtypes.externalbearer)] not used allow external bearer tokens used in-place of local authority bearer tokens. external bearer tokens used authenticate user's identity.

owin middleware authentication should conclude owin middleware bearer token returned user. whether user authenticates local login/password or external authentication cookie / token, user must local authority token make use of secure methods.

if user not exist in identity database after external authentication, register user , return new bearer token.


Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -