private async Task <AuthenticationTicket> DecryptTokenAsync(string token) { var notification = new DecryptTokenContext(Context, Options, token) { DataFormat = Options.AccessTokenFormat }; await Options.Events.DecryptToken(notification); if (notification.Handled) { Logger.LogInformation("The default authentication handling was skipped from user code."); return(notification.Ticket); } if (notification.DataFormat == null) { throw new InvalidOperationException("A data formatter must be provided."); } return(notification.DataFormat.Unprotect(token)); }
/// <summary> /// Invoked when a token is to be decrypted. /// </summary> public virtual Task DecryptToken(DecryptTokenContext context) => OnDecryptToken(context);