garnt_type = password:
refresh, AuthroizationServer
public class SimpleRefreshTokenProvider : IAuthenticationTokenProvider
{
private static ConcurrentDictionary<string, AuthenticationTicket> _refreshTokens =
new ConcurrentDictionary<string, AuthenticationTicket>();
public async Task CreateAsync(AuthenticationTokenCreateContext context)
{.......}
public async Task ReceiveAsync(AuthenticationTokenReceiveContext context)
{.......}
}
AccountController :
public AccountController()
: this(Startup.UserManagerFactory(), Startup.OAuthOptions.AccessTokenFormat)
{
}
public AccountController(UserManager<User, int> userManager, ISecureDataFormat<AuthenticationTicket> accessTokenFormat)
{
UserManager = userManager;
AccessTokenFormat = accessTokenFormat;
UserManager.UserValidator = new CustomUserValidator<User>(UserManager);
}
AuthenticationTokenCreateContext RefreshTokenProvider, Refresh Guid _refreshTokens, , refreshGuid, . Identity ExternalUser
ClaimsIdentity oAuthIdentity = await UserManager.CreateIdentityAsync(user,
OAuthDefaults.AuthenticationType);
AuthenticationProperties properties = ApplicationOAuthProvider.CreateProperties(user.Id.ToString());
oAuthIdentity.AddClaim(new Claim("TokenGuid", Guid.NewGuid().ToString()));
var ticket = new AuthenticationTicket(oAuthIdentity, properties);
await Startup.OAuthOptions.RefreshTokenProvider.CreateAsync(new AuthenticationTokenCreateContext(Request.GetOwinContext(), AccessTokenFormat, ticket));
Authentication.SignIn(properties, oAuthIdentity);
, TokenGuid RefreshTokenProvider, GUID, /Token? grant_type = refresh_token.....
P.S. , .